karin-plugin-teamspeak 1.5.9 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,4 +13,5 @@ export interface Config {
13
13
  RECONNECT_TIMER: number //断线重连次数 -1表示将不断尝试
14
14
  DIS_NOTIFY_NAME_LIST: string[] //不提醒的昵称列表 可多个 默认不提醒当前加入ts的机器人
15
15
  SERVER_NAME: string //展示的服务器名
16
+ ENABLE_CHANNEL_MOVE_NOTIFY: string //是否开启移动频道播报功能 ("true" | "false")
16
17
  }
@@ -14,5 +14,6 @@
14
14
  "DIS_NOTIFY_NAME_LIST": [
15
15
  "TESTBOT"
16
16
  ],
17
- "SERVER_NAME": "xxxxxxx"
17
+ "SERVER_NAME": "xxxxxxx",
18
+ "ENABLE_CHANNEL_MOVE_NOTIFY": "true"
18
19
  }
package/lib/apps/ts3.js CHANGED
@@ -62,6 +62,17 @@ class ts3 {
62
62
  }
63
63
  }
64
64
  });
65
+ // 监听用户移动频道事件
66
+ _teamspeak.on("clientmoved", (e) => {
67
+ if (TS.ENABLE_CHANNEL_MOVE_NOTIFY === "true" && e.client && !disNotifyNameList.includes(e.client.nickname)) {
68
+ logger.info(loggerPluginName + e.client.nickname + "移动到频道: " + e.channel.name);
69
+ const msg = segment.text(e.client.nickname + "移动到频道: " + e.channel.name);
70
+ TS.NOTICE_GROUP_NO.forEach((groupNo) => {
71
+ const contact = karin.contact("group", groupNo + "");
72
+ karin.sendMsg(karin.getBotAll()[1].account.selfId, contact, msg);
73
+ });
74
+ }
75
+ });
65
76
  };
66
77
  //获取ts3服务器的所有对应频道的人 -- 并组装成文字可直接发
67
78
  getAllChannelList = async () => {
@@ -2,7 +2,7 @@ import { Config } from "config/config/config";
2
2
  declare const _default: {
3
3
  info: {};
4
4
  /** 动态渲染的组件 */
5
- components: () => (import("node-karin").InputProps | import("node-karin").InputGroupProps | import("node-karin").RadioGroupProps)[];
5
+ components: () => (import("node-karin").InputProps | import("node-karin").RadioGroupProps | import("node-karin").InputGroupProps)[];
6
6
  /** 前端点击保存之后调用的方法 */
7
7
  save: (config: Config) => {
8
8
  success: boolean;
package/lib/web.config.js CHANGED
@@ -108,6 +108,27 @@ export default {
108
108
  },
109
109
  data: [...config().DIS_NOTIFY_NAME_LIST],
110
110
  }),
111
+ components.radio.group("ENABLE_CHANNEL_MOVE_NOTIFY", {
112
+ defaultValue: config().ENABLE_CHANNEL_MOVE_NOTIFY ? "true" : "false",
113
+ label: "移动频道播报功能",
114
+ description: "当用户在Teamspeak中移动频道时自动播报",
115
+ size: "sm",
116
+ orientation: "horizontal",
117
+ radio: [
118
+ {
119
+ componentType: "radio",
120
+ key: "ENABLE_CHANNEL_MOVE_NOTIFY_TRUE",
121
+ value: "true",
122
+ label: "开启",
123
+ },
124
+ {
125
+ componentType: "radio",
126
+ key: "ENABLE_CHANNEL_MOVE_NOTIFY_FALSE",
127
+ value: "false",
128
+ label: "关闭",
129
+ },
130
+ ],
131
+ }),
111
132
  ],
112
133
  /** 前端点击保存之后调用的方法 */
113
134
  save: (config) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karin-plugin-teamspeak",
3
- "version": "1.5.9",
3
+ "version": "1.6.0",
4
4
  "description": "karin 的 teamspeak 插件",
5
5
  "homepage": "https://github.com/jacksixth/karin-plugin-teamspeak3",
6
6
  "bugs": {