karin-plugin-teamspeak 1.12.0 → 1.13.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.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 渲染ts3服务器内存在用户的列表
3
+ * 触发指令: 人数
4
+ */
5
+ export declare const image: import("node-karin").Command<keyof import("node-karin").MessageEventMap>;
@@ -0,0 +1,38 @@
1
+ import { karin, segment, logger } from "node-karin";
2
+ import teamspeak3 from "./ts3.js";
3
+ const loggerPluginName = logger.chalk.hex("#90CAF9")(" ===== ts3 ===== ");
4
+ /**
5
+ * 渲染ts3服务器内存在用户的列表
6
+ * 触发指令: 人数
7
+ */
8
+ export const image = karin.command(/^#?人数$/, async (e) => {
9
+ try {
10
+ const list = await teamspeak3.getAllChannelList();
11
+ if (list) {
12
+ if (e.bot.adapter.protocol == "qqbot") {
13
+ await e.reply(segment.markdown(list));
14
+ }
15
+ else {
16
+ await e.reply(segment.text(list));
17
+ }
18
+ }
19
+ else {
20
+ await e.reply(segment.text("获取频道列表失败,可能是连接ts3服务器失败"));
21
+ }
22
+ return true;
23
+ }
24
+ catch (error) {
25
+ logger.error(loggerPluginName, error);
26
+ await e.reply(JSON.stringify(error));
27
+ return true;
28
+ }
29
+ }, {
30
+ /** 插件优先级 */
31
+ priority: 9999,
32
+ /** 插件触发是否打印触发日志 */
33
+ log: true,
34
+ /** 插件名称 */
35
+ name: "显示ts服务器内人数",
36
+ /** 谁可以触发这个插件 'all' | 'master' | 'admin' | 'group.owner' | 'group.admin' */
37
+ permission: "all",
38
+ });
@@ -0,0 +1,23 @@
1
+ import { TeamSpeak } from "ts3-nodejs-library";
2
+ declare class ts3 {
3
+ teamspeak: undefined | TeamSpeak;
4
+ connectTimer: number;
5
+ private isReConnecting;
6
+ init: () => Promise<void>;
7
+ getAllChannelList: () => Promise<string | undefined>;
8
+ quitTs: () => Promise<void>;
9
+ private handelReconnect;
10
+ }
11
+ declare const teamspeak3: ts3;
12
+ export declare const getAllUserList: () => Promise<{
13
+ name: string;
14
+ res: {
15
+ [name: string]: {
16
+ nickName: string;
17
+ lastconnected: string;
18
+ connectTime: string;
19
+ }[];
20
+ };
21
+ count: number;
22
+ } | null>;
23
+ export default teamspeak3;
@@ -0,0 +1,204 @@
1
+ import { QueryProtocol, TeamSpeak } from "ts3-nodejs-library";
2
+ import { config } from "../utils/index.js";
3
+ import karin, { logger, segment, app } from "node-karin";
4
+ import moment from "node-karin/moment";
5
+ import express from "node-karin/express";
6
+ const loggerPluginName = logger.chalk.hex("#90CAF9")(" ===== ts3 ===== ");
7
+ logger.info(loggerPluginName + "初始化ts3插件");
8
+ let disNotifyNameList = [];
9
+ class ts3 {
10
+ teamspeak;
11
+ connectTimer = 0;
12
+ isReConnecting = false;
13
+ //初始化 如果已经有连接了就关闭连接重新连接
14
+ init = async () => {
15
+ const TS = config();
16
+ this.isReConnecting = false;
17
+ disNotifyNameList = [TS.NICKNAME, ...TS.DIS_NOTIFY_NAME_LIST];
18
+ logger.info(loggerPluginName + "开始连接ts3服务器...");
19
+ if (this.teamspeak) {
20
+ await this.quitTs();
21
+ }
22
+ const _teamspeak = new TeamSpeak({
23
+ host: TS.HOST,
24
+ protocol: QueryProtocol[TS.PROTOCOL],
25
+ queryport: TS.QUERY_PORT,
26
+ serverport: TS.SERVER_PORT,
27
+ username: TS.USERNAME,
28
+ password: TS.PASSWORD,
29
+ nickname: TS.NICKNAME,
30
+ });
31
+ _teamspeak.on("ready", async () => {
32
+ if (this.isReConnecting) {
33
+ logger.info(loggerPluginName + "重连成功");
34
+ }
35
+ else {
36
+ logger.info(loggerPluginName + "ts3连接成功");
37
+ }
38
+ this.isReConnecting = false;
39
+ this.teamspeak = _teamspeak;
40
+ });
41
+ _teamspeak.on("close", (e) => {
42
+ logger.error(loggerPluginName + "ts3连接断开", e);
43
+ this.handelReconnect();
44
+ });
45
+ _teamspeak.on("error", (err) => {
46
+ logger.error(loggerPluginName + "ts3连接出错", err);
47
+ });
48
+ _teamspeak.on("clientconnect", (e) => {
49
+ if (!disNotifyNameList.includes(e.client.nickname)) {
50
+ logger.info(loggerPluginName + e.client.nickname + "进入ts");
51
+ const bots = karin.getBotAll().filter(bot => bot.account.selfId !== "console");
52
+ TS.NOTICE_GROUP_NO.forEach((groupNo) => {
53
+ const contact = karin.contact("group", groupNo + "");
54
+ bots.forEach(bot => {
55
+ const msg = bot.adapter.protocol === "qqbot"
56
+ ? segment.markdown(`**${e.client.nickname}** 进入了 TS 服务器`)
57
+ : segment.text(`${e.client.nickname} 进入了 TS 服务器`);
58
+ karin.sendMsg(bot.account.selfId, contact, msg);
59
+ });
60
+ });
61
+ }
62
+ });
63
+ _teamspeak.on("clientdisconnect", (e) => {
64
+ if (e.client) {
65
+ if (!disNotifyNameList.includes(e.client.nickname)) {
66
+ logger.info(loggerPluginName + e.client.nickname + "离开ts");
67
+ const bots = karin.getBotAll().filter(bot => bot.account.selfId !== "console");
68
+ TS.NOTICE_GROUP_NO.forEach((groupNo) => {
69
+ const contact = karin.contact("group", groupNo + "");
70
+ bots.forEach(bot => {
71
+ const msg = bot.adapter.protocol === "qqbot"
72
+ ? segment.markdown(`**${e.client.nickname}** 离开了 TS 服务器`)
73
+ : segment.text(`${e.client.nickname} 离开了 TS 服务器`);
74
+ karin.sendMsg(bot.account.selfId, contact, msg);
75
+ });
76
+ });
77
+ }
78
+ }
79
+ });
80
+ // 监听用户移动频道事件
81
+ _teamspeak.on("clientmoved", (e) => {
82
+ if (TS.ENABLE_CHANNEL_MOVE_NOTIFY === "true" &&
83
+ e.client &&
84
+ !disNotifyNameList.includes(e.client.nickname)) {
85
+ logger.info(loggerPluginName +
86
+ e.client.nickname +
87
+ "移动到频道: " +
88
+ e.channel.name);
89
+ const bots = karin.getBotAll().filter(bot => bot.account.selfId !== "console");
90
+ TS.NOTICE_GROUP_NO.forEach((groupNo) => {
91
+ const contact = karin.contact("group", groupNo + "");
92
+ bots.forEach(bot => {
93
+ const msg = bot.adapter.protocol === "qqbot"
94
+ ? segment.markdown(`**${e.client.nickname}** 移动到了频道 **${e.channel.name}**`)
95
+ : segment.text(`${e.client.nickname} 移动到了频道 ${e.channel.name}`);
96
+ karin.sendMsg(bot.account.selfId, contact, msg);
97
+ });
98
+ });
99
+ }
100
+ });
101
+ };
102
+ //获取ts3服务器的所有对应频道的人 -- 并组装成文字可直接发
103
+ getAllChannelList = async () => {
104
+ if (!this.teamspeak) {
105
+ return;
106
+ }
107
+ const TS = config();
108
+ const renderList = [];
109
+ renderList.push(`# ${TS.SERVER_NAME || TS.HOST}`);
110
+ renderList.push(`> 仅展示有人的频道`);
111
+ const channelList = await this.teamspeak.channelList(); //所有频道
112
+ let count = 0;
113
+ for (let index = 0; index < channelList.length; index++) {
114
+ const channel = channelList[index]; //频道
115
+ const allClient = await channel.getClients(); //在当前频道的人
116
+ //排除不显示的人
117
+ const clients = allClient.filter((c) => !disNotifyNameList.includes(c.nickname));
118
+ count += clients.length;
119
+ if (clients.length == 0)
120
+ continue;
121
+ renderList.push(`---`);
122
+ renderList.push(`**${channel.name}**`);
123
+ for (let index = 0; index < clients.length; index++) {
124
+ const client = clients[index];
125
+ const connectTimeSec = moment().diff(moment.unix(client.lastconnected), "second");
126
+ let connectTime = `(${Math.floor(connectTimeSec / 60)}:${Math.floor(connectTimeSec % 60)})`;
127
+ renderList.push(`- ${client.nickname} ${connectTime}`);
128
+ }
129
+ }
130
+ renderList.splice(2, 0, `> 当前在线 **${count}** 人`);
131
+ return renderList.join("\n");
132
+ };
133
+ //关闭连接
134
+ quitTs = async () => {
135
+ if (this.teamspeak) {
136
+ this.teamspeak.removeAllListeners();
137
+ this.teamspeak.quit();
138
+ this.teamspeak = undefined;
139
+ }
140
+ };
141
+ //重连逻辑
142
+ async handelReconnect() {
143
+ const TS = config();
144
+ if (!this.teamspeak || this.isReConnecting)
145
+ return;
146
+ this.isReConnecting = true;
147
+ logger.info(loggerPluginName + "重连中...");
148
+ try {
149
+ await this.teamspeak.reconnect(TS.RECONNECT_TIMER, 1000);
150
+ }
151
+ catch (e) {
152
+ logger.error(loggerPluginName + "连接TS3失败", e);
153
+ }
154
+ }
155
+ }
156
+ const teamspeak3 = new ts3();
157
+ setTimeout(() => {
158
+ //确保配置文件生成且正确保存
159
+ teamspeak3.init();
160
+ }, 1000);
161
+ //获取ts3服务器内所有频道内在线人数 -- 给接口用
162
+ export const getAllUserList = async () => {
163
+ if (teamspeak3.teamspeak) {
164
+ let count = 0;
165
+ const res = {};
166
+ const channelList = await teamspeak3.teamspeak.channelList().catch(() => {
167
+ return [];
168
+ }); //所有频道
169
+ for (let index = 0; index < channelList.length; index++) {
170
+ const channel = channelList[index]; //频道
171
+ const allClient = await channel.getClients(); //在当前频道的人
172
+ //排除不显示的人
173
+ const clients = allClient.filter((c) => !disNotifyNameList.includes(c.nickname));
174
+ count += clients.length;
175
+ res[channel.name] = clients.map((c) => {
176
+ const connectTimeSec = moment().diff(moment.unix(c.lastconnected), "second");
177
+ let connectTime = `${Math.floor(connectTimeSec / 60)}:${Math.floor(connectTimeSec % 60)}`;
178
+ return {
179
+ nickName: c.nickname, //昵称
180
+ lastconnected: moment
181
+ .unix(c.lastconnected)
182
+ .format("YYYY-MM-DD HH:mm:ss"), //上次连接进来的时间
183
+ connectTime, //已经连接的时间 - 单位分:秒
184
+ };
185
+ });
186
+ }
187
+ return {
188
+ name: config().SERVER_NAME || config().HOST,
189
+ res,
190
+ count,
191
+ };
192
+ }
193
+ else {
194
+ return null;
195
+ }
196
+ };
197
+ const router = express.Router();
198
+ router.get("/getAllUserList", async (req, res) => {
199
+ const result = await getAllUserList();
200
+ res.send(result);
201
+ });
202
+ //将路由挂载到express实例中
203
+ app.use("/api/teamspeak", router);
204
+ export default teamspeak3;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/lib/cli/pr.js ADDED
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/env node
2
+ import fs from "fs";
3
+ /**
4
+ * @description 获取package.json路径
5
+ */
6
+ const getPkgPath = () => process.cwd() + "/package.json";
7
+ /**
8
+ * @description 读取package.json
9
+ */
10
+ const readPkg = () => JSON.parse(fs.readFileSync(getPkgPath(), "utf-8"));
11
+ /**
12
+ * @description 写入package.json
13
+ * @param pkg package.json
14
+ */
15
+ const writePkg = (pkg) => fs.writeFileSync(getPkgPath(), JSON.stringify(pkg, null, 2));
16
+ /**
17
+ * @description 构建pr版本号 <主版本号>.<次版本号>.<修订号>.<PR标识>.<PR编号>.<当前提交唯一短哈希>
18
+ * @example 1.0.0.pr.184.a1b2c3d
19
+ * @param pkg package.json
20
+ */
21
+ const updateVersion = (pkg) => {
22
+ const list = pkg.version.split(".");
23
+ const shortHash = process.env.GITHUB_SHA?.substring(0, 7) ?? "unknown";
24
+ list[2] = `${Number(list[2]) + 1}`;
25
+ pkg.version = `${list.join(".")}-pr${process.env.PR_NUMBER}.${shortHash}`;
26
+ };
27
+ /**
28
+ * @description 设置环境变量
29
+ * @param pkg package.json
30
+ */
31
+ const setEnvVariables = (pkg) => {
32
+ const githubEnvPath = process.env.GITHUB_ENV;
33
+ if (!githubEnvPath) {
34
+ throw new Error("GITHUB_ENV 环境变量未定义");
35
+ }
36
+ fs.appendFileSync(githubEnvPath, `PKG_NAME=${pkg.name}\nPKG_VERSION=${pkg.version}\n`);
37
+ };
38
+ /**
39
+ * @description 更新版本号并设置环境变量
40
+ */
41
+ const version = () => {
42
+ console.log("开始执行版本更新...");
43
+ const pkg = readPkg();
44
+ console.log(`当前版本: ${pkg.version}`);
45
+ updateVersion(pkg);
46
+ console.log(`更新后版本: ${pkg.version}`);
47
+ writePkg(pkg);
48
+ console.log("package.json 写入成功");
49
+ setEnvVariables(pkg);
50
+ console.log("环境变量设置完成");
51
+ };
52
+ /**
53
+ * @description 删除devDependencies和
54
+ */
55
+ const clean = () => {
56
+ console.log("开始清理依赖...");
57
+ const pkg = readPkg();
58
+ console.log("正在删除 devDependencies");
59
+ delete pkg.devDependencies;
60
+ writePkg(pkg);
61
+ console.log("依赖清理完成");
62
+ };
63
+ /**
64
+ * @description 执行所有操作
65
+ */
66
+ const all = () => {
67
+ console.log("开始执行所有操作...");
68
+ const pkg = readPkg();
69
+ console.log(`当前版本: ${pkg.version}`);
70
+ updateVersion(pkg);
71
+ console.log(`更新后版本: ${pkg.version}`);
72
+ console.log("正在删除 devDependencies");
73
+ delete pkg.devDependencies;
74
+ writePkg(pkg);
75
+ console.log("package.json 写入成功");
76
+ setEnvVariables(pkg);
77
+ console.log("环境变量设置完成");
78
+ console.log("所有操作执行完毕");
79
+ };
80
+ const cmd = process.argv[2];
81
+ console.log(`执行命令: ${cmd}`);
82
+ if (cmd.includes("version")) {
83
+ version();
84
+ }
85
+ else if (cmd.includes("clean")) {
86
+ clean();
87
+ }
88
+ else if (cmd.includes("all")) {
89
+ all();
90
+ }
91
+ else {
92
+ console.log("未知命令,可用命令: version, clean, all");
93
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/lib/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { logger } from "node-karin";
2
+ import { basename, pkg } from "./utils/index.js";
3
+ /** 请不要在这编写插件 不会有任何效果~ */
4
+ logger.info(`${logger.violet(`[插件:${pkg().version}]`)} ${logger.green(basename)} 初始化完成~`);
@@ -0,0 +1,11 @@
1
+ import { Config } from "../../config/config/config.d";
2
+ export declare const dir: string;
3
+ export declare const dirConfig: string;
4
+ /**
5
+ * @description 配置文件
6
+ */
7
+ export declare const config: () => Config;
8
+ /**
9
+ * @description package.json
10
+ */
11
+ export declare const pkg: () => any;
@@ -0,0 +1,34 @@
1
+ import { dirPath, basename } from "../utils/index.js";
2
+ import { watch, logger, basePath, filesByExt, copyConfigSync, requireFileSync, } from "node-karin";
3
+ import teamspeak3 from "../apps/ts3.js";
4
+ export const dir = `${basePath}/${basename}`;
5
+ export const dirConfig = `${dir}/config`;
6
+ const defDir = `${dirPath}/config`;
7
+ const defConfig = `${defDir}/config`;
8
+ /**
9
+ * @description 初始化配置文件
10
+ */
11
+ copyConfigSync(defConfig, dirConfig, [".json"]);
12
+ /**
13
+ * @description 配置文件
14
+ */
15
+ export const config = () => {
16
+ const cfg = requireFileSync(`${dirConfig}/config.json`);
17
+ const def = requireFileSync(`${defConfig}/config.json`);
18
+ return { ...def, ...cfg };
19
+ };
20
+ /**
21
+ * @description package.json
22
+ */
23
+ export const pkg = () => requireFileSync(`${dirPath}/package.json`);
24
+ /**
25
+ * @description 监听配置文件
26
+ */
27
+ setTimeout(() => {
28
+ const list = filesByExt(dirConfig, ".json", "abs");
29
+ list.forEach((file) => watch(file, (old, now) => {
30
+ logger.info("旧数据:\n", old);
31
+ logger.info("新数据:\n", now);
32
+ teamspeak3.init();
33
+ }));
34
+ }, 2000);
@@ -0,0 +1,5 @@
1
+ /** 插件包绝对路径 */
2
+ declare const dirPath: string;
3
+ /** 插件包的名称 */
4
+ declare const basename: string;
5
+ export { dirPath, basename };
@@ -0,0 +1,9 @@
1
+ import path from "path";
2
+ import { fileURLToPath } from "url";
3
+ /** 当前文件的绝对路径 */
4
+ const filePath = fileURLToPath(import.meta.url).replace(/\\/g, "/");
5
+ /** 插件包绝对路径 */
6
+ const dirPath = path.resolve(filePath, "../../../");
7
+ /** 插件包的名称 */
8
+ const basename = path.basename(dirPath);
9
+ export { dirPath, basename };
@@ -0,0 +1,2 @@
1
+ export * from "./dir.js";
2
+ export * from "./config.js";
@@ -0,0 +1,2 @@
1
+ export * from "./dir.js";
2
+ export * from "./config.js";
@@ -0,0 +1,15 @@
1
+ import { Config } from "config/config/config.d";
2
+ declare const _default: {
3
+ info: {
4
+ name: string;
5
+ description: string;
6
+ };
7
+ /** 动态渲染的组件 */
8
+ components: () => (import("node-karin").InputProps | import("node-karin").RadioGroupProps | import("node-karin").InputGroupProps)[];
9
+ /** 前端点击保存之后调用的方法 */
10
+ save: (config: Config) => {
11
+ success: boolean;
12
+ message: string;
13
+ };
14
+ };
15
+ export default _default;
@@ -0,0 +1,144 @@
1
+ import { components, logger, writeJsonSync } from "node-karin";
2
+ import { config, dirConfig } from "./utils/index.js";
3
+ export default {
4
+ info: {
5
+ // 插件信息配置
6
+ name: "Teamspeak3 服务器",
7
+ description: "连接并管理 Teamspeak3 语音服务器",
8
+ },
9
+ /** 动态渲染的组件 */
10
+ components: () => [
11
+ components.input.string("HOST", {
12
+ label: "teamspeak 服务器地址或域名(不带端口)",
13
+ defaultValue: config().HOST,
14
+ variant: "underlined",
15
+ placeholder: "请输入服务器地址或域名",
16
+ rules: [
17
+ {
18
+ regex: /^((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$|^([0-9a-zA-Z-]{1,}\.)+([a-zA-Z]{2,})$/,
19
+ error: "请输入正确的IP地址或域名",
20
+ },
21
+ ],
22
+ }),
23
+ components.input.string("SERVER_NAME", {
24
+ label: "展示的服务器名(不填写则显示服务器地址)",
25
+ placeholder: "请输入展示的服务器名",
26
+ defaultValue: config().SERVER_NAME,
27
+ variant: "underlined",
28
+ isRequired: false,
29
+ }),
30
+ components.radio.group("PROTOCOL", {
31
+ defaultValue: config().PROTOCOL,
32
+ label: "teamspeak 服务器查询 (一般使用默认的RAW即可)",
33
+ size: "sm",
34
+ orientation: "horizontal",
35
+ radio: [
36
+ {
37
+ componentType: "radio",
38
+ key: "PROTOCOL_RAW",
39
+ value: "RAW",
40
+ label: "RAW",
41
+ },
42
+ {
43
+ componentType: "radio",
44
+ key: "PROTOCOL_SSH",
45
+ value: "SSH",
46
+ label: "SSH",
47
+ },
48
+ ],
49
+ }),
50
+ components.input.number("QUERY_PORT", {
51
+ label: "teamspeak 服务器查询端口 (一般使用默认 10011 即可)",
52
+ type: "number",
53
+ placeholder: "请输入服务器查询端口",
54
+ variant: "underlined",
55
+ defaultValue: config().QUERY_PORT + "",
56
+ rules: [{ min: 1, max: 65535 }],
57
+ }),
58
+ components.input.number("SERVER_PORT", {
59
+ label: "teamspeak 服务器语音端口 (一般使用默认 9987 即可)",
60
+ defaultValue: config().SERVER_PORT + "",
61
+ placeholder: "请输入服务器语音端口",
62
+ variant: "underlined",
63
+ rules: [{ min: 1, max: 65535 }],
64
+ }),
65
+ components.input.number("RECONNECT_TIMER", {
66
+ label: "teamspeak 连接断开后重连次数 (-1表示将不断尝试)",
67
+ defaultValue: config().RECONNECT_TIMER + "",
68
+ placeholder: "请输入重连次数",
69
+ variant: "underlined",
70
+ rules: [{ min: -1 }],
71
+ }),
72
+ components.input.string("USERNAME", {
73
+ label: "teamspeak 管理员用户名 (建服时出现的,没修改时默认是 serveradmin )",
74
+ defaultValue: config().USERNAME,
75
+ placeholder: "请输入管理员用户名",
76
+ variant: "underlined",
77
+ }),
78
+ components.input.string("PASSWORD", {
79
+ label: "teamspeak 管理员密码 (建服时出现的,每个服务器都不一样)",
80
+ defaultValue: config().PASSWORD,
81
+ type: "password",
82
+ placeholder: "请输入管理员密码",
83
+ variant: "underlined",
84
+ }),
85
+ components.input.string("NICKNAME", {
86
+ label: "插件连接进服务器时使用的昵称 (默认为TSBOT,···客户端看不到该用户···) ",
87
+ placeholder: "请输入连接昵称",
88
+ defaultValue: config().NICKNAME,
89
+ variant: "underlined",
90
+ }),
91
+ components.input.group("NOTICE_GROUP_NO", {
92
+ label: "通知用户进出ts3的群号 可多个(如果是QQ官BOT,此处需要填写OPEN_GROUP_ID。请先在对应群内触发人数并在后台获取OPEN_GROUP_ID,请查看readme来获取详情)",
93
+ template: {
94
+ componentType: "input",
95
+ key: "NOTICE_GROUP_NO",
96
+ type: "text",
97
+ variant: "faded",
98
+ placeholder: "请输入群号",
99
+ },
100
+ data: [...config().NOTICE_GROUP_NO.map((i) => i + "")],
101
+ }),
102
+ components.input.group("DIS_NOTIFY_NAME_LIST", {
103
+ label: "不提醒的昵称列表 可多个 (不会提醒当前机器人,无需添加当前机器人昵称)",
104
+ template: {
105
+ componentType: "input",
106
+ key: "DIS_NOTIFY_NAME",
107
+ type: "text",
108
+ variant: "faded",
109
+ placeholder: "请输入昵称",
110
+ },
111
+ data: [...config().DIS_NOTIFY_NAME_LIST],
112
+ }),
113
+ components.radio.group("ENABLE_CHANNEL_MOVE_NOTIFY", {
114
+ defaultValue: config().ENABLE_CHANNEL_MOVE_NOTIFY ? "true" : "false",
115
+ label: "移动频道播报功能",
116
+ description: "当用户在Teamspeak中移动频道时自动播报",
117
+ size: "sm",
118
+ orientation: "horizontal",
119
+ radio: [
120
+ {
121
+ componentType: "radio",
122
+ key: "ENABLE_CHANNEL_MOVE_NOTIFY_TRUE",
123
+ value: "true",
124
+ label: "开启",
125
+ },
126
+ {
127
+ componentType: "radio",
128
+ key: "ENABLE_CHANNEL_MOVE_NOTIFY_FALSE",
129
+ value: "false",
130
+ label: "关闭",
131
+ },
132
+ ],
133
+ }),
134
+ ],
135
+ /** 前端点击保存之后调用的方法 */
136
+ save: (config) => {
137
+ logger.info("保存的配置:", config);
138
+ writeJsonSync(`${dirConfig}/config.json`, config);
139
+ return {
140
+ success: true,
141
+ message: "保存成功",
142
+ };
143
+ },
144
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karin-plugin-teamspeak",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "karin 的 teamspeak 插件",
5
5
  "homepage": "https://github.com/jacksixth/karin-plugin-teamspeak3",
6
6
  "bugs": {