koishi-plugin-bind-bot 2.0.3 → 2.0.4

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.
@@ -211,14 +211,6 @@ class McidCommandHandler extends base_handler_1.BaseHandler {
211
211
  buidInfo = targetId ? '该用户尚未绑定B站账号' : `您尚未绑定B站账号,使用 ${this.deps.formatCommand('buid bind <B站UID>')} 进行绑定`;
212
212
  }
213
213
  this.logger.info('查询', `QQ(${bind.qqId})的MC账号信息:用户名=${bind.mcUsername}, UUID=${bind.mcUuid}`);
214
- // 自动设置群昵称
215
- if (bind.buidUid && bind.buidUsername) {
216
- const mcName = bind.mcUsername && !bind.mcUsername.startsWith('_temp_') ? bind.mcUsername : null;
217
- await this.deps.autoSetGroupNickname(session, mcName, bind.buidUsername, targetId || undefined);
218
- }
219
- else {
220
- this.logger.info('查询', `QQ(${bind.qqId})未绑定B站账号,跳过群昵称设置`);
221
- }
222
214
  const displayUsername = bind.mcUsername && !bind.mcUsername.startsWith('_temp_') ? bind.mcUsername : '未绑定';
223
215
  const prefix = targetId ? `用户 ${targetId} 的` : '您的';
224
216
  const messageElements = [
@@ -227,7 +219,18 @@ class McidCommandHandler extends base_handler_1.BaseHandler {
227
219
  koishi_1.h.text(`\n${buidInfo}`),
228
220
  ...(buidAvatar ? [buidAvatar] : [])
229
221
  ];
230
- return this.deps.sendMessage(session, messageElements);
222
+ // 先发送响应,然后异步设置群昵称
223
+ const sendPromise = this.deps.sendMessage(session, messageElements);
224
+ // 异步设置群昵称
225
+ if (bind.buidUid && bind.buidUsername) {
226
+ const mcName = bind.mcUsername && !bind.mcUsername.startsWith('_temp_') ? bind.mcUsername : null;
227
+ this.deps.autoSetGroupNickname(session, mcName, bind.buidUsername, targetId || undefined)
228
+ .catch(err => this.logger.warn('查询', `群昵称设置失败: ${err.message}`));
229
+ }
230
+ else {
231
+ this.logger.info('查询', `QQ(${bind.qqId})未绑定B站账号,跳过群昵称设置`);
232
+ }
233
+ return sendPromise;
231
234
  }
232
235
  /**
233
236
  * 通过MC用户名查询QQ号
package/lib/index.js CHANGED
@@ -718,6 +718,14 @@ function apply(ctx, config) {
718
718
  type: 'integer',
719
719
  initial: 0,
720
720
  },
721
+ usernameLastChecked: {
722
+ type: 'timestamp',
723
+ initial: null,
724
+ },
725
+ usernameCheckFailCount: {
726
+ type: 'integer',
727
+ initial: 0,
728
+ },
721
729
  }, {
722
730
  // 设置主键为qqId
723
731
  primary: 'qqId',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-bind-bot",
3
3
  "description": "[WittF自用] BIND-BOT - 账号绑定管理机器人,支持Minecraft账号和B站账号绑定与管理。",
4
- "version": "2.0.3",
4
+ "version": "2.0.4",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [