yz-yuki-plugin 2.0.4-0 → 2.0.4-2

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/CHANGELOG.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # 2.0.4
2
+ * 优化获取B站登录ck
2
3
  * 添加截图列队,优化配置文件注释
3
4
 
4
5
  # 2.0.3
package/README.md CHANGED
@@ -170,8 +170,8 @@ https://m.weibo.cn/u/7643376782 # 7643376782 为崩坏星穹铁道博主uid
170
170
  ||||
171
171
  | **微博功能** | ------------------------- | ---------- |
172
172
  | 添加微博推送 | 检测博主的微博动态进行推送,权限:Master,可选分类:视频、图文、文章,不加分类则默认全部 | `#订阅微博推送uid` `#订阅微博推送 图文 uid` |
173
- | 取消微博推送 | 删除对应博主的微博对应类型的动态推送,权限:Master,可选分类:视频、图文、文章,不加分类则默认全部 | `#取消微博推送uid` `#取消B站推送 图文 uid` |
174
- | 查看微博订阅列表 | 查看本Bot所有的B站订阅列表,权限:Bot的Master | `#微博全部订阅列表` |
173
+ | 取消微博推送 | 删除对应博主的微博对应类型的动态推送,权限:Master,可选分类:视频、图文、文章,不加分类则默认全部 | `#取消微博推送uid` `#取消微博推送 图文 uid` |
174
+ | 查看微博订阅列表 | 查看本Bot所有的微博订阅列表,权限:Bot的Master | `#微博全部订阅列表` |
175
175
  | 查看本群/私聊微博订阅列表 | 查看 本群/私聊 添加的微博订阅列表 | `#微博订阅列表` |
176
176
  | 手动推送微博订阅 | 手动触发定时推送任务,权限:Bot的Master | `#执行微博任务` |
177
177
  | 查看博主信息 | 通过uid查看博主信息 | `#微博博主 uid` |
@@ -192,7 +192,7 @@ https://m.weibo.cn/u/7643376782 # 7643376782 为崩坏星穹铁道博主uid
192
192
 
193
193
  # 🧩 五、支持与贡献
194
194
 
195
- 如果你喜欢这个项目,请不妨点个 Star🌟,这是对开发者最大的动力,呜咪~❤️
195
+ 如果你喜欢这个项目,请不妨点个 Star🌟,这是对开发者最大的动力,呜咪~❤️
196
196
 
197
197
  有意见或者建议也欢迎提交 [Issues](https://github.com/snowtafir/yuki-plugin/issues) 和 [Pull requests](https://github.com/snowtafir/yuki-plugin/pulls)。
198
198
 
@@ -5,7 +5,7 @@ import { EventType } from 'yunzai';
5
5
  * *******************************************************************
6
6
  */
7
7
  /**申请登陆二维码(web端) */
8
- export declare function applyLoginQRCode(e: EventType): Promise<any>;
8
+ export declare function applyLoginQRCode(e: EventType): Promise<string>;
9
9
  /**处理扫码结果 */
10
10
  export declare function pollLoginQRCode(e: EventType, qrcodeKey: string): Promise<string>;
11
11
  /**查看app扫码登陆获取的ck的有效状态*/
@@ -24,6 +24,9 @@ async function applyLoginQRCode(e) {
24
24
  headers: lodash.merge(BiliApi.BIlIBILI_LOGIN_HEADERS, { 'user-agent': BiliApi.BILIBILI_HEADERS['User-Agent'] }, { 'Host': 'passport.bilibili.com', }),
25
25
  redirect: "follow",
26
26
  });
27
+ if (!response.ok) {
28
+ throw new Error(`获取B站登录二维码URL网络请求失败,状态码: ${response.status}`);
29
+ }
27
30
  const res = await response.json();
28
31
  if (res?.code === 0) {
29
32
  const qrcodeKey = res.data.qrcode_key;
@@ -37,13 +40,18 @@ async function applyLoginQRCode(e) {
37
40
  modelName: "bili-login"
38
41
  };
39
42
  const qrCodeImage = await renderPage("bili-login", "LoginQrcodePage", LoginPropsData, ScreenshotOptionsData);
40
- let qrcodeImg;
43
+ let qrCodeBufferArray = [];
41
44
  if (qrCodeImage !== false) {
42
45
  const { img } = qrCodeImage;
43
- qrcodeImg = img;
46
+ qrCodeBufferArray = img;
44
47
  }
45
48
  let msg = [];
46
- msg.push(Segment.image(qrcodeImg[0]));
49
+ if (qrCodeBufferArray.length === 0) {
50
+ msg.push('渲染二维码图片失败,请查看终端输出的实时日志,\n复制哔哩登陆二维码URL,使用在线或本地二维码生成工具生成二维码并扫码。');
51
+ }
52
+ else {
53
+ msg.push(Segment.image(qrCodeBufferArray[0]));
54
+ }
47
55
  e.reply('请在3分钟内扫码以完成B站登陆绑定');
48
56
  e.reply(msg);
49
57
  logger.info(`优纪插件: 如果发送二维码图片消息失败可复制如下URL, 使用在线或本地二维码生成工具生成二维码并扫码`);
@@ -63,6 +71,9 @@ async function pollLoginQRCode(e, qrcodeKey) {
63
71
  headers: lodash.merge(BiliApi.BIlIBILI_LOGIN_HEADERS, { 'User-agent': BiliApi.BILIBILI_HEADERS['User-Agent'] }, { 'Host': 'passport.bilibili.com', }),
64
72
  redirect: "follow",
65
73
  });
74
+ if (!response.ok) {
75
+ throw new Error(`处理B站登录token网络请求失败,状态码: ${response.status}`);
76
+ }
66
77
  const data = await response.json();
67
78
  if (data.code === 0) {
68
79
  if (data.data.code === 0) {
@@ -152,7 +152,7 @@ class WeiboTask {
152
152
  if (!imgs)
153
153
  return;
154
154
  Redis.set(`${markKey}${chatId}:${id_str}`, "1", { EX: 3600 * 10 }); // 设置已发送标记
155
- (logger ?? Bot.logger)?.mark("优纪插件:B站动态执行推送");
155
+ (logger ?? Bot.logger)?.mark("优纪插件:微博动态执行推送");
156
156
  for (let i = 0; i < imgs.length; i++) {
157
157
  const image = imgs[i];
158
158
  await this.sendMessage(chatId, bot_id, chatType, Segment.image(image));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yz-yuki-plugin",
3
- "version": "2.0.4-0",
3
+ "version": "2.0.4-2",
4
4
  "description": "优纪插件,yunzaijs 关于 微博推送、B站推送 等功能的拓展插件",
5
5
  "author": "snowtafir",
6
6
  "type": "module",