koishi-plugin-bilibili-notify 2.0.0-alpha.7 → 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
@@ -5,6 +5,7 @@
5
5
  ---
6
6
 
7
7
  - koishi-plugin-bilibili-notify [![npm](https://img.shields.io/npm/v/koishi-plugin-bilibili-notify?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-bilibili-notify)
8
+ - [重新订阅](#重新订阅)
8
9
  - [功能](#功能)
9
10
  - [注意事项](#注意事项)
10
11
  - [安装](#安装)
@@ -14,6 +15,10 @@
14
15
  - [感谢](#感谢)
15
16
  - [License](#License)
16
17
 
18
+ ## 重新订阅
19
+
20
+ 由于版本 `2.0.0-alpha.7` 重构了订阅功能,从 `2.0.0-alpha.7` 以前版本升级到以后版本的需重新订阅
21
+
17
22
  ## 功能
18
23
 
19
24
  订阅B站UP主动态
@@ -184,6 +189,8 @@
184
189
  - ver 2.0.0-alpha.5 移除:选项pushUrl,选项platform 新增:选项customLive,主人账号中platform选项。支持多平台,且可同时推送不同平台,单个UP主只能推送一个平台
185
190
  - ver 2.0.0-alpha.6 修复:直播推送发送失败的bug
186
191
  - ver 2.0.0-alpha.7 重构:现已支持同一UP多平台推送
192
+ - ver 2.0.0-alpha.8 新增:重新订阅提示
193
+ - ver 2.0.0-alpha.9 修复:订阅反复提示未加入群组的bug,实际已加入
187
194
 
188
195
  ## 交流群
189
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/lib/index.js CHANGED
@@ -358,6 +358,9 @@ function apply(ctx, config) {
358
358
  // 设置config
359
359
  globalConfig = config;
360
360
  // 设置提示
361
+ ctx.notifier.create({
362
+ content: '从2.0.0-alpha.7以前版本更新需重新订阅'
363
+ });
361
364
  ctx.notifier.create({
362
365
  content: '请使用Auth插件创建超级管理员账号,没有权限将无法使用该插件提供的指令。'
363
366
  });
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.7",
4
+ "version": "2.0.0-alpha.9",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],