dfghfhgfg commited on
Commit
126f9dd
·
verified ·
1 Parent(s): ba61459

Upload 75 files

Browse files
Yunzai/README.md CHANGED
@@ -96,7 +96,7 @@ bash <(curl -L https://gitee.com/TimeRainStarSky/Yunzai/raw/main/lib/tools/docke
96
  | CMD | 启动命令 | tsyz |
97
  | CMDPATH | 命令文件夹 | /usr/local/bin |
98
  | DKNAME | 容器名 | Yunzai |
99
- | DKURL | Docker 源 | docker.nju.edu.cn |
100
  | GITURL | GIT 源 | https://gitee.com/TimeRainStarSky/Yunzai |
101
  | APTURL | APT 源 | mirrors.ustc.edu.cn |
102
  | APTDEP | APT 依赖 | chromium fonts-lxgw-wenkai fonts-noto-color-emoji |
 
96
  | CMD | 启动命令 | tsyz |
97
  | CMDPATH | 命令文件夹 | /usr/local/bin |
98
  | DKNAME | 容器名 | Yunzai |
99
+ | DKURL | Docker 源 | docker.m.daocloud.io |
100
  | GITURL | GIT 源 | https://gitee.com/TimeRainStarSky/Yunzai |
101
  | APTURL | APT 源 | mirrors.ustc.edu.cn |
102
  | APTDEP | APT 依赖 | chromium fonts-lxgw-wenkai fonts-noto-color-emoji |
Yunzai/config/default_config/bot.yaml CHANGED
@@ -9,6 +9,8 @@ log_object: true
9
  url: http://localhost:2536
10
  # 服务器端口
11
  port: 2536
 
 
12
 
13
  # 自动更新时间
14
  update_time: 1440
 
9
  url: http://localhost:2536
10
  # 服务器端口
11
  port: 2536
12
+ # 服务器缺省跳转地址
13
+ redirect: https://github.com/TimeRainStarSky/Yunzai
14
 
15
  # 自动更新时间
16
  update_time: 1440
Yunzai/lib/bot.js CHANGED
@@ -145,7 +145,7 @@ export default class Yunzai extends EventEmitter {
145
  await PluginsLoader.load()
146
  await ListenerLoader.load()
147
 
148
- this.express.use(req => req.res.redirect("https://github.com/TimeRainStarSky/Yunzai"))
149
  this.makeLog("info", `连接地址:${logger.blue(`${cfg.bot.url.replace(/^http/, "ws")}/`)}${logger.cyan(`[${Object.keys(this.wsf)}]`)}`, "WebSocket")
150
  this.emit("online", this)
151
  }
 
145
  await PluginsLoader.load()
146
  await ListenerLoader.load()
147
 
148
+ this.express.use(req => req.res.redirect(cfg.bot.redirect))
149
  this.makeLog("info", `连接地址:${logger.blue(`${cfg.bot.url.replace(/^http/, "ws")}/`)}${logger.cyan(`[${Object.keys(this.wsf)}]`)}`, "WebSocket")
150
  this.emit("online", this)
151
  }
Yunzai/lib/plugins/loader.js CHANGED
@@ -256,7 +256,7 @@ class PluginsLoader {
256
  break a
257
  }
258
  } catch (err) {
259
- Bot.makeLog("error", [`${e.logFnc}${e.logText}`, err], false)
260
  break a
261
  }
262
  }
@@ -344,7 +344,7 @@ class PluginsLoader {
344
  e.img = [i.url]
345
  break
346
  case "at":
347
- if (i.qq === e.self_id)
348
  e.atBot = true
349
  else
350
  e.at = i.qq
@@ -404,24 +404,18 @@ class PluginsLoader {
404
 
405
  e.logText = `${logger.cyan(e.logText)}${logger.red(`[${lodash.truncate(e.msg || e.raw_message || Bot.String(e), { length: 100 })}]`)}`
406
 
407
- if (e.user_id && cfg.master[e.self_id]?.includes(String(e.user_id))) {
408
  e.isMaster = true
409
- }
410
 
411
  /** 只关注主动at msg处理 */
412
  if (e.msg && e.isGroup) {
413
- let groupCfg = cfg.getGroup(e.self_id, e.group_id)
414
- let alias = groupCfg.botAlias
415
- if (!Array.isArray(alias)) {
416
- alias = [alias]
417
- }
418
- for (let name of alias) {
419
- if (e.msg.startsWith(name)) {
420
- e.msg = lodash.trimStart(e.msg, name).trim()
421
  e.hasAlias = true
422
  break
423
  }
424
- }
425
  }
426
  }
427
 
 
256
  break a
257
  }
258
  } catch (err) {
259
+ Bot.makeLog("error", [`${e.logText}${e.logFnc}`, err], false)
260
  break a
261
  }
262
  }
 
344
  e.img = [i.url]
345
  break
346
  case "at":
347
+ if (i.qq == e.self_id)
348
  e.atBot = true
349
  else
350
  e.at = i.qq
 
404
 
405
  e.logText = `${logger.cyan(e.logText)}${logger.red(`[${lodash.truncate(e.msg || e.raw_message || Bot.String(e), { length: 100 })}]`)}`
406
 
407
+ if (e.user_id && cfg.master[e.self_id]?.includes(String(e.user_id)))
408
  e.isMaster = true
 
409
 
410
  /** 只关注主动at msg处理 */
411
  if (e.msg && e.isGroup) {
412
+ const alias = cfg.getGroup(e.self_id, e.group_id).botAlias
413
+ for (const i of Array.isArray(alias) ? alias : [alias])
414
+ if (e.msg.startsWith(i)) {
415
+ e.msg = lodash.trimStart(e.msg, i).trim()
 
 
 
 
416
  e.hasAlias = true
417
  break
418
  }
 
419
  }
420
  }
421
 
Yunzai/lib/plugins/plugin.js CHANGED
@@ -70,11 +70,7 @@ export default class plugin {
70
  }
71
 
72
  conKey(isGroup = false) {
73
- if (isGroup) {
74
- return `${this.name}.${this.group_id || this.groupId || this.e.group_id}`
75
- } else {
76
- return `${this.name}.${this.user_id || this.userId || this.e.user_id}`
77
- }
78
  }
79
 
80
  /**
 
70
  }
71
 
72
  conKey(isGroup = false) {
73
+ return `${this.name}.${this.self_id || this.e.self_id}.${isGroup ? (this.group_id || this.e.group_id) : (this.user_id || this.e.user_id)}`
 
 
 
 
74
  }
75
 
76
  /**
Yunzai/lib/tools/docker.sh CHANGED
@@ -1,5 +1,5 @@
1
  #TRSS Yunzai Docker 安装脚本 作者:时雨🌌星空
2
- NAME=v1.0.0;VERSION=202405290
3
  R="" G="" Y="" C="" B="" O=""
4
  echo "$B———————————————————————————
5
  $R TRSS$Y Yunzai$G Docker$C Script$O
@@ -13,7 +13,7 @@ DIR="${DIR:-$HOME/Yunzai}"
13
  CMD="${CMD:-tsyz}"
14
  CMDPATH="${CMDPATH:-/usr/local/bin}"
15
  DKNAME="${DKNAME:-Yunzai}"
16
- DKURL="${DKURL:-docker.nju.edu.cn}"
17
  GITURL="${GITURL:-https://gitee.com/TimeRainStarSky/Yunzai}"
18
  APTURL="${APTURL:-mirrors.ustc.edu.cn}"
19
  APTDEP="${APTDEP:-chromium fonts-lxgw-wenkai fonts-noto-color-emoji}"
@@ -53,11 +53,12 @@ $R! 下载失败,5秒后切换镜像源$O"
53
  sleep 5
54
  ((N++))
55
  case "$N" in
56
- 1)DKURL="docker.nju.edu.cn";;
57
  2)DKURL="mirror.ccs.tencentyun.com";;
58
- 3)DKURL="mirror.baidubce.com";;
59
- 4)DKURL="dockerproxy.com";;
60
- 5)DKURL="docker.m.daocloud.io";;
 
61
  *)DKURL="docker.io";N=0
62
  esac
63
  done
 
1
  #TRSS Yunzai Docker 安装脚本 作者:时雨🌌星空
2
+ NAME=v1.0.0 VERSION=202406200
3
  R="" G="" Y="" C="" B="" O=""
4
  echo "$B———————————————————————————
5
  $R TRSS$Y Yunzai$G Docker$C Script$O
 
13
  CMD="${CMD:-tsyz}"
14
  CMDPATH="${CMDPATH:-/usr/local/bin}"
15
  DKNAME="${DKNAME:-Yunzai}"
16
+ DKURL="${DKURL:-docker.m.daocloud.io}"
17
  GITURL="${GITURL:-https://gitee.com/TimeRainStarSky/Yunzai}"
18
  APTURL="${APTURL:-mirrors.ustc.edu.cn}"
19
  APTDEP="${APTDEP:-chromium fonts-lxgw-wenkai fonts-noto-color-emoji}"
 
53
  sleep 5
54
  ((N++))
55
  case "$N" in
56
+ 1)DKURL="docker.m.daocloud.io";;
57
  2)DKURL="mirror.ccs.tencentyun.com";;
58
+ 3)DKURL="dockerhub.timeweb.cloud";;
59
+ 4)DKURL="mirror.baidubce.com";;
60
+ 5)DKURL="docker.nju.edu.cn";;
61
+ 6)DKURL="dockerproxy.com";;
62
  *)DKURL="docker.io";N=0
63
  esac
64
  done
Yunzai/package.json CHANGED
@@ -20,7 +20,7 @@
20
  "chokidar": "^3.6.0",
21
  "express": "^4.19.2",
22
  "file-type": "^19.0.0",
23
- "https-proxy-agent": "7.0.4",
24
  "image-size": "^1.1.1",
25
  "level": "^8.0.1",
26
  "lodash": "^4.17.21",
@@ -30,22 +30,22 @@
30
  "node-fetch": "link:lib/modules/node-fetch",
31
  "node-schedule": "^2.1.1",
32
  "oicq": "link:lib/modules/oicq",
33
- "pm2": "^5.4.0",
34
  "puppeteer": "*",
35
  "redis": "^4.6.14",
36
  "sequelize": "^6.37.3",
37
  "sqlite3": "5.1.6",
38
  "strip-ansi": "^7.1.0",
39
  "ulid": "^2.3.0",
40
- "ws": "^8.17.0",
41
- "yaml": "^2.4.3"
42
  },
43
  "devDependencies": {
44
  "eslint": "^8.57.0",
45
  "eslint-config-standard": "^17.1.0",
46
  "eslint-plugin-import": "^2.29.1",
47
  "eslint-plugin-n": "^16.6.2",
48
- "eslint-plugin-promise": "^6.2.0"
49
  },
50
  "imports": {
51
  "#miao": "./plugins/miao-plugin/components/index.js",
 
20
  "chokidar": "^3.6.0",
21
  "express": "^4.19.2",
22
  "file-type": "^19.0.0",
23
+ "https-proxy-agent": "7.0.5",
24
  "image-size": "^1.1.1",
25
  "level": "^8.0.1",
26
  "lodash": "^4.17.21",
 
30
  "node-fetch": "link:lib/modules/node-fetch",
31
  "node-schedule": "^2.1.1",
32
  "oicq": "link:lib/modules/oicq",
33
+ "pm2": "^5.4.1",
34
  "puppeteer": "*",
35
  "redis": "^4.6.14",
36
  "sequelize": "^6.37.3",
37
  "sqlite3": "5.1.6",
38
  "strip-ansi": "^7.1.0",
39
  "ulid": "^2.3.0",
40
+ "ws": "^8.17.1",
41
+ "yaml": "^2.4.5"
42
  },
43
  "devDependencies": {
44
  "eslint": "^8.57.0",
45
  "eslint-config-standard": "^17.1.0",
46
  "eslint-plugin-import": "^2.29.1",
47
  "eslint-plugin-n": "^16.6.2",
48
+ "eslint-plugin-promise": "^6.4.0"
49
  },
50
  "imports": {
51
  "#miao": "./plugins/miao-plugin/components/index.js",
Yunzai/plugins/adapter/GSUIDCore.js CHANGED
@@ -9,7 +9,7 @@ Bot.adapter.push(new class GSUIDCoreAdapter {
9
  return Bot.String(msg).replace(/base64:\/\/.*?"/g, "base64://...\"")
10
  }
11
 
12
- makeButton(data, button) {
13
  const msg = {
14
  text: button.text,
15
  pressed_text: button.clicked_text,
@@ -301,4 +301,4 @@ Bot.adapter.push(new class GSUIDCoreAdapter {
301
  ws.on("message", data => this.message(data, ws, ...args))
302
  )
303
  }
304
- })
 
9
  return Bot.String(msg).replace(/base64:\/\/.*?"/g, "base64://...\"")
10
  }
11
 
12
+ makeButton(button) {
13
  const msg = {
14
  text: button.text,
15
  pressed_text: button.clicked_text,
 
301
  ws.on("message", data => this.message(data, ws, ...args))
302
  )
303
  }
304
+ })
Yunzai/plugins/adapter/OneBotv11.js CHANGED
@@ -250,7 +250,7 @@ Bot.adapter.push(new class OneBotv11Adapter {
250
  group_name: `${guild.guild_name}-${channel.channel_name}`,
251
  })
252
  } catch (err) {
253
- Bot.makeLog("error", ["获取频道列表错误", err])
254
  }
255
  return array
256
  }
 
250
  group_name: `${guild.guild_name}-${channel.channel_name}`,
251
  })
252
  } catch (err) {
253
+ //Bot.makeLog("error", ["获取频道列表错误", err])
254
  }
255
  return array
256
  }