karin-plugin-teamspeak 1.5.4 → 1.5.5

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/ts3.d.ts CHANGED
@@ -3,7 +3,6 @@ declare class ts3 {
3
3
  teamspeak: undefined | TeamSpeak;
4
4
  connectTimer: number;
5
5
  private isReConnecting;
6
- private reconnectAttempts;
7
6
  init: () => Promise<void>;
8
7
  getAllChannelList: () => Promise<string | undefined>;
9
8
  quitTs: () => Promise<void>;
@@ -12,6 +11,7 @@ declare class ts3 {
12
11
  }
13
12
  declare const teamspeak3: ts3;
14
13
  export declare const getAllUserList: () => Promise<{
14
+ name: string;
15
15
  res: {
16
16
  [name: string]: {
17
17
  nickName: string;
package/lib/apps/ts3.js CHANGED
@@ -10,11 +10,9 @@ class ts3 {
10
10
  teamspeak;
11
11
  connectTimer = 0;
12
12
  isReConnecting = false;
13
- reconnectAttempts = 0;
14
13
  //初始化 如果已经有连接了就关闭连接重新连接
15
14
  init = async () => {
16
15
  const TS = config();
17
- this.reconnectAttempts = 0;
18
16
  this.isReConnecting = false;
19
17
  disNotifyNameList = [TS.NICKNAME, ...TS.DIS_NOTIFY_NAME_LIST];
20
18
  logger.info(loggerHex(" ===== ts3 ===== ") + "开始连接ts3服务器...");
@@ -141,14 +139,10 @@ class ts3 {
141
139
  if (!this.teamspeak || this.isReConnecting)
142
140
  return;
143
141
  this.isReConnecting = true;
144
- logger.info(loggerHex(" ===== ts3 ===== ") +
145
- "重连中... 尝试次数: " +
146
- this.reconnectAttempts +
147
- "次");
142
+ logger.info(loggerHex(" ===== ts3 ===== ") + "重连中...");
148
143
  try {
149
144
  await this.teamspeak.reconnect(TS.RECONNECT_TIMER, 1000);
150
145
  logger.info(loggerHex(" ===== ts3 ===== ") + "重连成功");
151
- this.reconnectAttempts = 0; // 重连成功后重置重连次数
152
146
  }
153
147
  catch (e) {
154
148
  logger.error(loggerHex(" ===== ts3 ===== ") + "连接TS3失败", e);
@@ -168,7 +162,9 @@ export const getAllUserList = async () => {
168
162
  if (teamspeak3.teamspeak) {
169
163
  let count = 0;
170
164
  const res = {};
171
- const channelList = await teamspeak3.teamspeak.channelList(); //所有频道
165
+ const channelList = await teamspeak3.teamspeak.channelList().catch(() => {
166
+ return [];
167
+ }); //所有频道
172
168
  for (let index = 0; index < channelList.length; index++) {
173
169
  const channel = channelList[index]; //频道
174
170
  const allClient = await channel.getClients(); //在当前频道的人
@@ -188,6 +184,7 @@ export const getAllUserList = async () => {
188
184
  });
189
185
  }
190
186
  return {
187
+ name: config().SERVER_NAME || config().HOST,
191
188
  res,
192
189
  count,
193
190
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karin-plugin-teamspeak",
3
- "version": "1.5.4",
3
+ "version": "1.5.5",
4
4
  "description": "karin 的 teamspeak 插件",
5
5
  "homepage": "https://github.com/jacksixth/karin-plugin-teamspeak3",
6
6
  "bugs": {