koishi-plugin-bilibili-notify 2.0.0-alpha.8 → 2.0.0-alpha.9

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 CHANGED
@@ -190,6 +190,7 @@
190
190
  - ver 2.0.0-alpha.6 修复:直播推送发送失败的bug
191
191
  - ver 2.0.0-alpha.7 重构:现已支持同一UP多平台推送
192
192
  - ver 2.0.0-alpha.8 新增:重新订阅提示
193
+ - ver 2.0.0-alpha.9 修复:订阅反复提示未加入群组的bug,实际已加入
193
194
 
194
195
  ## 交流群
195
196
 
@@ -338,25 +338,31 @@ class ComRegister {
338
338
  const targetArr = [];
339
339
  // 获取机器人加入的群组
340
340
  const guildList = await bot.getGuildList();
341
- // 遍历群组
342
- for (const guild of guildList.data) {
343
- // 获取频道
344
- const channelList = await bot.getChannelList(guild.id);
345
- // 判断群号是否符合条件
346
- for (const id of idArr) {
347
- // 判断是否机器人加入了该群
348
- if (channelList.data.some(channel => channel.id === id)) { // 机器人加入了该群
349
- // 保存到数组
341
+ // 遍历target数组
342
+ for (const id of idArr) {
343
+ // 定义是否加入群组标志
344
+ let flag = false;
345
+ // 遍历群组
346
+ for (const guild of guildList.data) {
347
+ // 获取频道列表
348
+ const channelList = await bot.getChannelList(guild.id);
349
+ // 判断机器人是否加入群聊或频道
350
+ if (channelList.data.some(channel => channel.id === id)) {
351
+ // 加入群聊或频道
350
352
  targetArr.push(id);
351
- // 继续下一个循环
352
- continue;
353
+ // 设置标志位为true
354
+ flag = true;
355
+ // 结束循环
356
+ break;
353
357
  }
358
+ }
359
+ if (!flag) {
354
360
  // 不满足条件发送错误提示
355
361
  await session.send(`您的机器未加入${id},无法对该群或频道进行推送`);
356
362
  }
357
363
  }
358
364
  // 判断targetArr是否为空
359
- if (targetArr.length === 0) {
365
+ if (target.length === 0) {
360
366
  // 为空则默认为当前环境
361
367
  target = [{ idArr: [session.event.channel.id], platform: session.event.platform }];
362
368
  // 没有满足条件的群组或频道
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-bilibili-notify",
3
3
  "description": "Koishi bilibili notify plugin",
4
- "version": "2.0.0-alpha.8",
4
+ "version": "2.0.0-alpha.9",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],