karin-plugin-teamspeak 1.5.6 → 1.5.7
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/README.md +8 -9
- package/lib/apps/ts3.js +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,20 +36,19 @@ karin 下的 [teamspeak](https://www.teamspeak.com/zh-CN/) 插件,使用 ts
|
|
|
36
36
|
```
|
|
37
37
|
3. 可以通过调用接口 `/api/teamspeak/getAllUserList` 来获取当前服务器内所有频道内人数和进入时长包括没人在的频道,返回的数据格式为:
|
|
38
38
|
|
|
39
|
-
```
|
|
39
|
+
```
|
|
40
40
|
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
{
|
|
41
|
+
name: "配置内的服务器名或host",
|
|
42
|
+
res: {
|
|
44
43
|
频道1:[{
|
|
45
|
-
nickName:
|
|
46
|
-
lastconnected:
|
|
47
|
-
connectTime:
|
|
44
|
+
nickName:"xxx", //昵称
|
|
45
|
+
lastconnected: "YYYY-MM-DD HH:mm:ss", //上次连接进来的时间
|
|
46
|
+
connectTime:"", //已经连接的时间 - 单位分:秒
|
|
48
47
|
},{},...],
|
|
49
48
|
频道2:[{}],
|
|
50
49
|
频道3:[{}],
|
|
51
50
|
...
|
|
52
|
-
}
|
|
53
|
-
|
|
51
|
+
},
|
|
52
|
+
count: "频道内总人数"
|
|
54
53
|
}
|
|
55
54
|
```
|
package/lib/apps/ts3.js
CHANGED
|
@@ -17,8 +17,7 @@ class ts3 {
|
|
|
17
17
|
disNotifyNameList = [TS.NICKNAME, ...TS.DIS_NOTIFY_NAME_LIST];
|
|
18
18
|
logger.info(loggerHex(" ===== ts3 ===== ") + "开始连接ts3服务器...");
|
|
19
19
|
if (this.teamspeak) {
|
|
20
|
-
await this.
|
|
21
|
-
this.teamspeak = undefined;
|
|
20
|
+
await this.quitTs();
|
|
22
21
|
}
|
|
23
22
|
const _teamspeak = new TeamSpeak({
|
|
24
23
|
host: TS.HOST,
|
|
@@ -124,7 +123,9 @@ class ts3 {
|
|
|
124
123
|
//关闭连接
|
|
125
124
|
quitTs = async () => {
|
|
126
125
|
if (this.teamspeak) {
|
|
126
|
+
this.teamspeak.removeAllListeners();
|
|
127
127
|
this.teamspeak.quit();
|
|
128
|
+
this.teamspeak = undefined;
|
|
128
129
|
}
|
|
129
130
|
};
|
|
130
131
|
//重新连接
|
|
@@ -132,6 +133,9 @@ class ts3 {
|
|
|
132
133
|
if (this.teamspeak) {
|
|
133
134
|
this.teamspeak.reconnect(config().RECONNECT_TIMER, 1000);
|
|
134
135
|
}
|
|
136
|
+
else {
|
|
137
|
+
this.init();
|
|
138
|
+
}
|
|
135
139
|
};
|
|
136
140
|
//重连逻辑
|
|
137
141
|
async handelReconnect() {
|