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 +1 -0
- package/lib/comRegister.js +18 -12
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/comRegister.js
CHANGED
|
@@ -338,25 +338,31 @@ class ComRegister {
|
|
|
338
338
|
const targetArr = [];
|
|
339
339
|
// 获取机器人加入的群组
|
|
340
340
|
const guildList = await bot.getGuildList();
|
|
341
|
-
//
|
|
342
|
-
for (const
|
|
343
|
-
//
|
|
344
|
-
|
|
345
|
-
//
|
|
346
|
-
for (const
|
|
347
|
-
//
|
|
348
|
-
|
|
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
|
-
|
|
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 (
|
|
365
|
+
if (target.length === 0) {
|
|
360
366
|
// 为空则默认为当前环境
|
|
361
367
|
target = [{ idArr: [session.event.channel.id], platform: session.event.platform }];
|
|
362
368
|
// 没有满足条件的群组或频道
|