karin-plugin-teamspeak 1.12.1 → 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.
- package/lib/apps/command.js +6 -1
- package/lib/apps/ts3.js +18 -6
- package/package.json +1 -1
package/lib/apps/command.js
CHANGED
|
@@ -9,7 +9,12 @@ export const image = karin.command(/^#?人数$/, async (e) => {
|
|
|
9
9
|
try {
|
|
10
10
|
const list = await teamspeak3.getAllChannelList();
|
|
11
11
|
if (list) {
|
|
12
|
-
|
|
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
|
+
}
|
|
13
18
|
}
|
|
14
19
|
else {
|
|
15
20
|
await e.reply(segment.text("获取频道列表失败,可能是连接ts3服务器失败"));
|
package/lib/apps/ts3.js
CHANGED
|
@@ -48,11 +48,15 @@ class ts3 {
|
|
|
48
48
|
_teamspeak.on("clientconnect", (e) => {
|
|
49
49
|
if (!disNotifyNameList.includes(e.client.nickname)) {
|
|
50
50
|
logger.info(loggerPluginName + e.client.nickname + "进入ts");
|
|
51
|
-
const msg = segment.markdown(`**${e.client.nickname}** 进入了 TS 服务器`);
|
|
52
51
|
const bots = karin.getBotAll().filter(bot => bot.account.selfId !== "console");
|
|
53
52
|
TS.NOTICE_GROUP_NO.forEach((groupNo) => {
|
|
54
53
|
const contact = karin.contact("group", groupNo + "");
|
|
55
|
-
bots.forEach(bot =>
|
|
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
|
+
});
|
|
56
60
|
});
|
|
57
61
|
}
|
|
58
62
|
});
|
|
@@ -60,11 +64,15 @@ class ts3 {
|
|
|
60
64
|
if (e.client) {
|
|
61
65
|
if (!disNotifyNameList.includes(e.client.nickname)) {
|
|
62
66
|
logger.info(loggerPluginName + e.client.nickname + "离开ts");
|
|
63
|
-
const msg = segment.markdown(`**${e.client.nickname}** 离开了 TS 服务器`);
|
|
64
67
|
const bots = karin.getBotAll().filter(bot => bot.account.selfId !== "console");
|
|
65
68
|
TS.NOTICE_GROUP_NO.forEach((groupNo) => {
|
|
66
69
|
const contact = karin.contact("group", groupNo + "");
|
|
67
|
-
bots.forEach(bot =>
|
|
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
|
+
});
|
|
68
76
|
});
|
|
69
77
|
}
|
|
70
78
|
}
|
|
@@ -78,11 +86,15 @@ class ts3 {
|
|
|
78
86
|
e.client.nickname +
|
|
79
87
|
"移动到频道: " +
|
|
80
88
|
e.channel.name);
|
|
81
|
-
const msg = segment.markdown(`**${e.client.nickname}** 移动到了频道 **${e.channel.name}**`);
|
|
82
89
|
const bots = karin.getBotAll().filter(bot => bot.account.selfId !== "console");
|
|
83
90
|
TS.NOTICE_GROUP_NO.forEach((groupNo) => {
|
|
84
91
|
const contact = karin.contact("group", groupNo + "");
|
|
85
|
-
bots.forEach(bot =>
|
|
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
|
+
});
|
|
86
98
|
});
|
|
87
99
|
}
|
|
88
100
|
});
|