karin-plugin-kkk 1.2.3 → 1.3.0

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,5 +1,23 @@
1
1
  # 变更日志
2
2
 
3
+ ## [1.3.0](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.2.3...v1.3.0) (2025-04-26)
4
+
5
+
6
+ ### Features
7
+
8
+ * **Config:** 添加扫码登录权限配置 close [#73](https://github.com/ikenxuan/karin-plugin-kkk/issues/73) ([0e22e6b](https://github.com/ikenxuan/karin-plugin-kkk/commit/0e22e6b7b128c663f9a6b81391aae528d93384ce))
9
+ * **config:** 默认关闭平台解析提示并添加表情回应功能(默认开启) ([ea301d7](https://github.com/ikenxuan/karin-plugin-kkk/commit/ea301d7ffaaa80d6b4f046b143703e29ee322c98))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **login:** 更新抖音和哔哩哔哩登录免责声明 close [#72](https://github.com/ikenxuan/karin-plugin-kkk/issues/72) ([6b91d8e](https://github.com/ikenxuan/karin-plugin-kkk/commit/6b91d8e4d479f86ac41315124350b07085e821e7))
15
+ * 修复视频上传和评论处理中的问题 ([8036d4d](https://github.com/ikenxuan/karin-plugin-kkk/commit/8036d4d0c4d568c30b9140c5e3a7c50c7fda90ca))
16
+ * 修改默认回复表情 ([4dc106e](https://github.com/ikenxuan/karin-plugin-kkk/commit/4dc106ef160361f5daf773c855ed3c98dbd2eebf))
17
+ * 修正评论数据长度检查逻辑 ([866de17](https://github.com/ikenxuan/karin-plugin-kkk/commit/866de17efb187f68c3df8871892f7b8d8c9926e8))
18
+ * 每个推送对象单独过滤。close [#69](https://github.com/ikenxuan/karin-plugin-kkk/issues/69) ([#70](https://github.com/ikenxuan/karin-plugin-kkk/issues/70)) ([38b0cab](https://github.com/ikenxuan/karin-plugin-kkk/commit/38b0cab43c05107a2b4d853a13cc23887cc4579b))
19
+ * 移除大部分命令设置功能,使用webui修改配置,仅保留推送相关的设置 ([883ff4c](https://github.com/ikenxuan/karin-plugin-kkk/commit/883ff4c1a1d34742c34b88da341d31e61332f8a9))
20
+
3
21
  ## [1.2.3](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.2.2...v1.2.3) (2025-04-13)
4
22
 
5
23
 
@@ -26,4 +26,14 @@ APIServerMount: true
26
26
  Theme: 0
27
27
 
28
28
  # 渲染的图片是否移除底部水印
29
- RemoveWatermark: false
29
+ RemoveWatermark: false
30
+
31
+ # 渲染图片的等待时间,单位:秒。传递 0 可禁用等待
32
+ RenderWaitTime: 60
33
+
34
+ # 表情回应
35
+ EmojiReply: true
36
+
37
+ # 表情 ID,详情查看:https://github.com/NapNeko/NapCatQQ/blob/main/src/core/external/face_config.json
38
+ EmojiReplyID: 128064
39
+
@@ -2,7 +2,7 @@
2
2
  switch: true
3
3
 
4
4
  # B站解析提示,发送提示信息:“检测到B站链接,开始解析”
5
- tip: true
5
+ tip: false
6
6
 
7
7
  # B站评论解析,发送哔哩哔哩作品评论图
8
8
  comment: true
@@ -16,29 +16,14 @@ videopriority: false
16
16
  # 根据「视频拦截阈值」自动选择合适的分辨率,关闭后默认选择最大分辨率进行下载
17
17
  autoResolution: true
18
18
 
19
+ # 谁可以触发扫码登录,all为所有人,admin为管理员,master为主人,group.owner为群主,group.admin为群管理员。修改后需重启
20
+ loginPerm: all
21
+
19
22
  # B站推送相关配置
20
23
  push:
21
24
  # 推送开关,开启后需重启;使用「#设置B站推送 + 用户UID」配置推送列表
22
25
  switch: true
23
- # 过滤模式:blacklist为黑名单模式,whitelist为白名单模式
24
- filterMode: blacklist
25
- # 黑名单模式:动态中有指定关键词时,不推送
26
- filterKeywords:
27
- - 黑名单关键词1
28
- - 黑名单关键词2
29
- # 黑名单模式:动态中有指定标签时,不推送
30
- filterTags:
31
- - 黑名单标签1
32
- - 黑名单标签2
33
- # 白名单模式:动态中有指定关键词时,才推送
34
- whitelistKeywords:
35
- - 白名单关键词1
36
- - 白名单关键词2
37
- # 白名单模式:动态中有指定标签时,才推送
38
- whitelistTags:
39
- - 白名单标签1
40
- - 白名单标签2
41
- # 谁可以设置推送,all为所有人,admin为管理员,master为主人,group.owner为群主,group.admin为群管理员
26
+ # 谁可以设置推送,all为所有人,admin为管理员,master为主人,group.owner为群主,group.admin为群管理员。修改后需重启
42
27
  permission: master
43
28
  # 推送定时任务的cron表达式,默认为每十分钟推送一次
44
29
  cron: '*/10 * * * *'
@@ -2,7 +2,7 @@
2
2
  switch: true
3
3
 
4
4
  # 抖音解析提示,发送提示信息:“检测到抖音链接,开始解析”
5
- tip: true
5
+ tip: false
6
6
 
7
7
  # 抖音评论解析
8
8
  comment: true
@@ -13,29 +13,14 @@ numcomment: 5
13
13
  # 根据「视频拦截阈值」自动选择合适的分辨率,关闭后默认选择最大分辨率进行下载
14
14
  autoResolution: true
15
15
 
16
+ # 谁可以触发扫码登录,all为所有人,admin为管理员,master为主人,group.owner为群主,group.admin为群管理员。修改后需重启
17
+ loginPerm: all
18
+
16
19
  # 抖音推送相关配置
17
20
  push:
18
21
  # 推送开关,开启后需重启;使用「#设置抖音推送 + 抖音号」配置推送列表
19
22
  switch: true
20
- # 过滤模式:blacklist为黑名单模式,whitelist为白名单模式
21
- filterMode: blacklist
22
- # 黑名单模式:作品中有指定关键词时,不推送
23
- filterKeywords:
24
- - 黑名单关键词1
25
- - 黑名单关键词2
26
- # 黑名单模式:作品中有指定标签时,不推送
27
- filterTags:
28
- - 黑名单标签1
29
- - 黑名单标签2
30
- # 白名单模式:作品中有指定关键词时,才推送
31
- whitelistKeywords:
32
- - 白名单关键词1
33
- - 白名单关键词2
34
- # 白名单模式:作品中有指定标签时,才推送
35
- whitelistTags:
36
- - 白名单标签1
37
- - 白名单标签2
38
- # 谁可以设置推送,all为所有人,admin为管理员,master为主人,group.owner为群主,group.admin为群管理员
23
+ # 谁可以设置推送,all为所有人,admin为管理员,master为主人,group.owner为群主,group.admin为群管理员。修改后需重启
39
24
  permission: master
40
25
  # 推送定时任务的cron表达式,默认为每十分钟推送一次
41
26
  cron: '*/10 * * * *'
@@ -2,7 +2,7 @@
2
2
  switch: true
3
3
 
4
4
  # 快手解析提示,发送提示信息:“检测到快手链接,开始解析”
5
- tip: true
5
+ tip: false
6
6
 
7
7
  # 快手评论解析,发送快手作品评论图
8
8
  comment: true
package/lib/apps/admin.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { createRequire } from 'module';
2
- import '../chunk-SLADWUI4.js';
3
- import { bilibiliLogin, douyinLogin } from '../chunk-VW4ZAQ3U.js';
4
- import { Config, Common, Render } from '../chunk-NDSCNB4K.js';
5
- import { init_esm_shims } from '../chunk-FOF5UXCN.js';
2
+ import '../chunk-KQITAYDY.js';
3
+ import { bilibiliLogin, douyinLogin } from '../chunk-5WIDO4V7.js';
4
+ import { Config, Common } from '../chunk-DSCWGW73.js';
5
+ import { init_esm_shims } from '../chunk-XHTHHTBA.js';
6
6
  import fs from 'node:fs';
7
- import karin, { logger, Plugin } from 'node-karin';
7
+ import karin, { logger } from 'node-karin';
8
8
  import path from 'path';
9
9
 
10
10
  createRequire(import.meta.url);
@@ -22,11 +22,11 @@ var task = Config.app.rmmp4 && karin.task("[kkk-\u89C6\u9891\u7F13\u5B58\u81EA\u
22
22
  var biLogin = karin.command(/^#?(kkk)?\s*B站\s*(扫码)?\s*登录$/i, async (e) => {
23
23
  await bilibiliLogin(e);
24
24
  return true;
25
- }, { perm: "group.admin", name: "kkk-ck\u7BA1\u7406" });
25
+ }, { perm: Config.bilibili.loginPerm, name: "kkk-ck\u7BA1\u7406" });
26
26
  var dylogin = karin.command(/^#?(kkk)?抖音(扫码)?登录$/, async (e) => {
27
27
  await douyinLogin(e);
28
28
  return true;
29
- }, { perm: "group.admin", name: "kkk-ck\u7BA1\u7406" });
29
+ }, { perm: Config.douyin.loginPerm, name: "kkk-ck\u7BA1\u7406" });
30
30
  var setdyck = karin.command(/^#?(kkk)?s*设置抖音ck$/i, async (e) => {
31
31
  const msg = await e.reply("\u8BF7\u53D1\u5728120\u79D2\u5185\u9001\u6296\u97F3ck\n\u6559\u7A0B\uFF1Ahttps://ikenxuan.github.io/kkkkkk-10086/docs/intro/other#%E9%85%8D%E7%BD%AE%E4%B8%8D%E5%90%8C%E5%B9%B3%E5%8F%B0%E7%9A%84-cookies\n");
32
32
  const context = await karin.ctx(e);
@@ -43,103 +43,6 @@ var setbilick = karin.command(/^#?(kkk)?s*设置s*(B站)ck$/i, async (e) => {
43
43
  await e.reply("\u8BBE\u7F6E\u6210\u529F\uFF01", { at: true });
44
44
  return true;
45
45
  }, { perm: "master", name: "kkk-ck\u7BA1\u7406", event: "message.friend" });
46
- var Admin = class extends Plugin {
47
- constructor() {
48
- super({
49
- name: "kkk-\u7BA1\u7406",
50
- rule: [
51
- { reg: createSwitchRegExp("app"), fnc: "ConfigSwitch", permission: "master" },
52
- { reg: createNumberRegExp("app"), fnc: "ConfigNumber", permission: "master" },
53
- { reg: createCustomRegExp("app"), fnc: "ConfigCustom", permission: "master" },
54
- { reg: createSwitchRegExp("douyin"), fnc: "ConfigSwitch", permission: "master" },
55
- { reg: createNumberRegExp("douyin"), fnc: "ConfigNumber", permission: "master" },
56
- { reg: createNumberRegExp("douyin"), fnc: "ConfigCustom", permission: "master" },
57
- { reg: createSwitchRegExp("bilibili"), fnc: "ConfigSwitch", permission: "master" },
58
- { reg: createNumberRegExp("bilibili"), fnc: "ConfigNumber", permission: "master" },
59
- { reg: createNumberRegExp("bilibili"), fnc: "ConfigCustom", permission: "master" },
60
- { reg: createSwitchRegExp("upload"), fnc: "ConfigSwitch", permission: "master" },
61
- { reg: createNumberRegExp("upload"), fnc: "ConfigNumber", permission: "master" },
62
- { reg: createNumberRegExp("upload"), fnc: "ConfigCustom", permission: "master" },
63
- { reg: createSwitchRegExp("kuaishou"), fnc: "ConfigSwitch", permission: "master" },
64
- { reg: createNumberRegExp("kuaishou"), fnc: "ConfigNumber", permission: "master" },
65
- { reg: createNumberRegExp("kuaishou"), fnc: "ConfigCustom", permission: "master" },
66
- { reg: /^#kkk设置$/, fnc: "index_Settings", permission: "master" },
67
- { reg: /^#?kkk删除缓存$/, fnc: "deleteCache", permission: "master" }
68
- ]
69
- });
70
- }
71
- async deleteCache(e) {
72
- await removeAllFiles(Common.tempDri.video);
73
- await e.reply(Common.tempDri.video + "\u76EE\u5F55\u4E0B\u6240\u6709\u6587\u4EF6\u5DF2\u5220\u9664");
74
- return true;
75
- }
76
- // 配置开关
77
- async ConfigSwitch(e) {
78
- logger.debug("\u5F00\u5173\u914D\u7F6E", e.msg);
79
- const platform = this.getPlatformFromMessage(e.msg);
80
- const regRet = createSwitchRegExp(platform).exec(e.msg);
81
- if (regRet) {
82
- const key = regRet[1];
83
- const isOn = regRet[2] === "\u5F00\u542F";
84
- Config.Modify(platform, PlatformTypeConfig[platform].types[key], isOn);
85
- await this.index_Settings(e);
86
- }
87
- return false;
88
- }
89
- // 修改数值配置
90
- async ConfigNumber(e) {
91
- logger.debug("\u6570\u503C\u914D\u7F6E", e.msg);
92
- const platform = this.getPlatformFromMessage(e.msg);
93
- const regRet = createNumberRegExp(platform).exec(e.msg);
94
- if (regRet) {
95
- const configType = PlatformTypeConfig[platform].numberConfig[regRet[1]];
96
- const number = this.checkNumberValue(Number(regRet[2]), configType.limit);
97
- Config.Modify(platform, configType.key, number);
98
- await this.index_Settings(e);
99
- }
100
- return false;
101
- }
102
- // 处理自定义内容
103
- async ConfigCustom(e) {
104
- logger.debug("\u81EA\u5B9A\u4E49\u5185\u5BB9", e.msg);
105
- const platform = this.getPlatformFromMessage(e.msg);
106
- const regRet = createCustomRegExp(platform).exec(e.msg);
107
- if (regRet) {
108
- const key = regRet[1];
109
- const customValue = regRet[2].trim();
110
- const customConfig = PlatformTypeConfig[platform]?.customConfig;
111
- if (!customConfig || !customConfig[key]) {
112
- logger.debug(logger.warn(`\u65E0\u6548\u7684\u8BBE\u7F6E\u9879\uFF1A${key}`));
113
- return false;
114
- }
115
- const configKey = customConfig[key].key;
116
- Config.Modify(platform, configKey, customValue);
117
- await this.index_Settings(e);
118
- }
119
- return false;
120
- }
121
- // 渲染设置图片
122
- async index_Settings(e) {
123
- const _cfg = Config.All();
124
- const statusData = getStatus(_cfg);
125
- const img = await Render("admin/index", { data: statusData });
126
- await e.reply(img);
127
- return true;
128
- }
129
- // 根据消息判断平台
130
- getPlatformFromMessage(msg) {
131
- if (msg.includes("\u6296\u97F3")) return "douyin";
132
- if (msg.includes("B\u7AD9")) return "bilibili";
133
- if (msg.includes("\u4E0A\u4F20")) return "upload";
134
- if (msg.includes("\u5FEB\u624B")) return "kuaishou";
135
- return "app";
136
- }
137
- // 检查数值范围
138
- checkNumberValue(value, limit) {
139
- const [min, max] = limit.split("-").map(Number);
140
- return Math.min(Math.max(value, min), max);
141
- }
142
- };
143
46
  async function removeAllFiles(dir) {
144
47
  const files = await fs.promises.readdir(dir);
145
48
  for (const file of files) {
@@ -153,134 +56,5 @@ async function removeAllFiles(dir) {
153
56
  }
154
57
  }
155
58
  }
156
- function getStatus(data) {
157
- const result = {};
158
- const processValue = (value) => {
159
- if (typeof value === "boolean") {
160
- return `<div class="cfg-status ${value ? "" : "status-off"}">${value ? "\u5DF2\u5F00\u542F" : "\u5DF2\u5173\u95ED"}</div>`;
161
- } else if (typeof value === "number") {
162
- return `<div class="cfg-status ${value === null ? "status-off" : ""}">${value ?? "\u672A\u914D\u7F6E"}</div>`;
163
- } else if (typeof value === "string") {
164
- return `<div class="cfg-status">${value.length > 12 ? `${value.slice(0, 12)}...` : value}</div>`;
165
- } else if (Array.isArray(value)) {
166
- return value.length === 0 ? '<div class="cfg-status status-off">\u672A\u914D\u7F6E</div>' : `<div class="cfg-status">\u5DF2\u914D\u7F6E ${value.length} \u9879</div>`;
167
- } else if (value === null) {
168
- return '<div class="cfg-status status-off">\u672A\u914D\u7F6E</div>';
169
- }
170
- return '<div class="cfg-status status-off">\u672A\u77E5\u7C7B\u578B</div>';
171
- };
172
- const processObject = (obj) => {
173
- const res = {};
174
- for (const key in obj) {
175
- const value = obj[key];
176
- if (value !== null && typeof value === "object" && !Array.isArray(value)) {
177
- res[key] = processObject(value);
178
- } else {
179
- res[key] = processValue(value);
180
- }
181
- }
182
- return res;
183
- };
184
- for (const key in data) {
185
- result[key] = processObject(data[key]);
186
- }
187
- return result;
188
- }
189
- var PlatformTypeConfig = {
190
- upload: {
191
- name: "\u4E0A\u4F20",
192
- types: {
193
- \u4E0A\u4F20\u62E6\u622A: "usefilelimit",
194
- \u4E0A\u4F20base64: "sendbase64",
195
- \u4E0A\u4F20\u538B\u7F29: "compress",
196
- \u4E0A\u4F20\u7FA4\u6587\u4EF6: "usegroupfile"
197
- },
198
- numberConfig: {
199
- \u4E0A\u4F20\u62E6\u622A\u9608\u503C: { key: "filelimit", limit: "0-1000000" },
200
- \u4E0A\u4F20\u538B\u7F29\u89E6\u53D1\u503C: { key: "compresstrigger", limit: "0-1000000" },
201
- \u4E0A\u4F20\u538B\u7F29\u540E\u7684\u503C: { key: "compressvalue", limit: "0-1000000" },
202
- \u4E0A\u4F20\u7FA4\u6587\u4EF6\u9608\u503C: { key: "groupfilevalue", limit: "0-1000000" }
203
- }
204
- },
205
- app: {
206
- name: "APP",
207
- types: {
208
- \u7F13\u5B58\u5220\u9664: "rmmp4",
209
- \u89C6\u9891\u89E3\u6790: "videotool",
210
- \u9ED8\u8BA4\u89E3\u6790: "defaulttool",
211
- \u4E0A\u4F20\u9650\u5236: "usefilelimit",
212
- API\u670D\u52A1: "APIServer",
213
- base64: "sendbase64"
214
- },
215
- numberConfig: {
216
- \u6E32\u67D3\u7CBE\u5EA6: { key: "renderScale", limit: "50-200" },
217
- \u4F18\u5148\u7EA7: { key: "priority", limit: "0-114514" },
218
- \u9650\u5236: { key: "filelimit", limit: "5-114514" },
219
- \u4E3B\u9898: { key: "Theme", limit: "0-2" }
220
- }
221
- },
222
- douyin: {
223
- name: "\u6296\u97F3",
224
- types: {
225
- \u6296\u97F3\u89E3\u6790: "switch",
226
- \u6296\u97F3\u8BC4\u8BBA: "comment",
227
- \u6296\u97F3\u63A8\u9001: "push.switch",
228
- \u6296\u97F3\u63A8\u9001\u65E5\u5FD7: "push.log",
229
- \u6296\u97F3\u89E3\u6790\u63D0\u793A: "tip",
230
- \u6296\u97F3\u9AD8\u6E05\u8BED\u97F3: "sendHDrecord",
231
- \u6296\u97F3\u52A8\u6001\u89E3\u6790: "push.parsedynamic",
232
- \u6296\u97F3\u81EA\u52A8\u6E05\u6670\u5EA6: "autoResolution"
233
- },
234
- numberConfig: {
235
- \u6296\u97F3\u8BC4\u8BBA\u6570\u91CF: { key: "numcomment", limit: "0-999999" }
236
- },
237
- customConfig: {
238
- \u6296\u97F3\u63A8\u9001\u8868\u8FBE\u5F0F: { key: "push.cron", type: "string" },
239
- \u6296\u97F3\u63A8\u9001\u8BBE\u7F6E\u6743\u9650: { key: "push.permission", type: "string" }
240
- }
241
- },
242
- bilibili: {
243
- name: "B\u7AD9",
244
- types: {
245
- B\u7AD9\u89E3\u6790: "switch",
246
- B\u7AD9\u8BC4\u8BBA: "comment",
247
- B\u7AD9\u63A8\u9001: "push.switch",
248
- B\u7AD9\u63A8\u9001\u65E5\u5FD7: "push.log",
249
- B\u7AD9\u89E3\u6790\u63D0\u793A: "tip",
250
- B\u7AD9\u52A8\u6001\u89E3\u6790: "push.parsedynamic",
251
- B\u7AD9\u5185\u5BB9\u4F18\u5148: "videopriority",
252
- B\u7AD9\u81EA\u52A8\u6E05\u6670\u5EA6: "autoResolution"
253
- },
254
- numberConfig: {
255
- B\u7AD9\u8BC4\u8BBA\u6570\u91CF: { key: "numcomment", limit: "0-999999" }
256
- },
257
- customConfig: {
258
- B\u7AD9\u63A8\u9001\u8868\u8FBE\u5F0F: { key: "push.cron", type: "string" },
259
- B\u7AD9\u63A8\u9001\u8BBE\u7F6E\u6743\u9650: { key: "push.permission", type: "string" }
260
- }
261
- },
262
- kuaishou: {
263
- name: "\u5FEB\u624B",
264
- types: {
265
- \u5FEB\u624B\u89E3\u6790: "switch",
266
- \u5FEB\u624B\u89E3\u6790\u63D0\u793A: "tip"
267
- },
268
- numberConfig: {
269
- \u5FEB\u624B\u8BC4\u8BBA\u6570\u91CF: { key: "numcomment", limit: "0-30" }
270
- }
271
- }
272
- };
273
- var createSwitchRegExp = (platform) => {
274
- const switchKeys = Object.keys(PlatformTypeConfig[platform].types);
275
- return new RegExp(`^#kkk\u8BBE\u7F6E(${switchKeys.join("|")})(\u5F00\u542F|\u5173\u95ED)$`);
276
- };
277
- var createNumberRegExp = (platform) => {
278
- const numberKeys = Object.keys(PlatformTypeConfig[platform].numberConfig);
279
- return new RegExp(`^#kkk\u8BBE\u7F6E(${numberKeys.join("|")})(\\d+)$`);
280
- };
281
- var createCustomRegExp = (platform) => {
282
- const customKeys = Object.keys(PlatformTypeConfig[platform].customConfig ?? {});
283
- return new RegExp(`^#kkk\u8BBE\u7F6E(${customKeys.join("|")})(.*)$`);
284
- };
285
59
 
286
- export { Admin, biLogin, dylogin, setbilick, setdyck, task };
60
+ export { biLogin, dylogin, setbilick, setdyck, task };
package/lib/apps/help.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from 'module';
2
- import { Render, Config, Version, Common } from '../chunk-NDSCNB4K.js';
3
- import { init_esm_shims } from '../chunk-FOF5UXCN.js';
2
+ import { Render, Config, Version, Common } from '../chunk-DSCWGW73.js';
3
+ import { init_esm_shims } from '../chunk-XHTHHTBA.js';
4
4
  import { execSync } from 'node:child_process';
5
5
  import fs from 'node:fs';
6
6
  import { markdown } from '@karinjs/md-html';
package/lib/apps/push.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { createRequire } from 'module';
2
- import '../chunk-SLADWUI4.js';
3
- import { DouYinpush, Bilibilipush } from '../chunk-VW4ZAQ3U.js';
4
- import { Config, getDouyinData, getBilibiliData } from '../chunk-NDSCNB4K.js';
5
- import { init_esm_shims } from '../chunk-FOF5UXCN.js';
2
+ import '../chunk-KQITAYDY.js';
3
+ import { DouYinpush, Bilibilipush } from '../chunk-5WIDO4V7.js';
4
+ import { Config, getDouyinData, getBilibiliData } from '../chunk-DSCWGW73.js';
5
+ import { init_esm_shims } from '../chunk-XHTHHTBA.js';
6
6
  import karin from 'node-karin';
7
7
 
8
8
  createRequire(import.meta.url);
package/lib/apps/tools.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { createRequire } from 'module';
2
- import { getDouyinID, DouYin, getBilibiliID, Bilibili, getKuaishouID, fetchKuaishouData, Kuaishou } from '../chunk-VW4ZAQ3U.js';
3
- import { Config, Common } from '../chunk-NDSCNB4K.js';
4
- import { init_esm_shims } from '../chunk-FOF5UXCN.js';
5
- import karin from 'node-karin';
2
+ import { getDouyinID, DouYin, getBilibiliID, Bilibili, getKuaishouID, fetchKuaishouData, Kuaishou } from '../chunk-5WIDO4V7.js';
3
+ import { Config, Common } from '../chunk-DSCWGW73.js';
4
+ import { init_esm_shims } from '../chunk-XHTHHTBA.js';
5
+ import karin, { logger } from 'node-karin';
6
6
 
7
7
  createRequire(import.meta.url);
8
8
 
@@ -21,18 +21,19 @@ var douyin = karin.command(reg.douyin, async (e) => {
21
21
  }, { name: "kkk-\u89C6\u9891\u529F\u80FD-\u6296\u97F3", priority: Config.app.defaulttool ? -Infinity : 800 });
22
22
  var bilibili = karin.command(reg.bilibili, async (e) => {
23
23
  e.msg = e.msg.replace(/\\/g, "");
24
- const urlRex = /(https?:\/\/)?(www\.bilibili\.com|m\.bilibili\.com|t\.bilibili\.com|bili2233\.cn)\/[a-zA-Z0-9._%&+=\-\/?]*[a-zA-Z0-9_\/?=&#%+]*$/g;
25
- const bShortRex = /https?:\/\/(b23\.tv|bili2233\.cn)\/([a-zA-Z0-9]+)/;
26
- let url = "";
27
- if (urlRex.test(e.msg)) {
28
- const matchResult = e.msg.match(urlRex);
29
- url = matchResult ? matchResult[0] : null;
30
- } else if (bShortRex.test(e.msg)) {
31
- const match = bShortRex.exec(e.msg);
32
- url = match && match[0];
33
- } else if (/^BV[1-9a-zA-Z]{10}$/.test(e.msg)) {
24
+ const urlRegex = /(https?:\/\/(?:www\.bilibili\.com|m\.bilibili\.com|t\.bilibili\.com|b23\.tv|bili2233\.cn)\/[^\s]+)/;
25
+ const bvRegex = /^BV[1-9a-zA-Z]{10}$/;
26
+ let url = null;
27
+ const urlMatch = e.msg.match(urlRegex);
28
+ if (urlMatch) {
29
+ url = urlMatch[0];
30
+ } else if (bvRegex.test(e.msg)) {
34
31
  url = `https://www.bilibili.com/video/${e.msg}`;
35
32
  }
33
+ if (!url) {
34
+ logger.warn(`\u672A\u80FD\u5728\u6D88\u606F\u4E2D\u627E\u5230\u6709\u6548\u7684B\u7AD9\u5206\u4EAB\u94FE\u63A5\u6216BV\u53F7: ${e.msg}`);
35
+ return true;
36
+ }
36
37
  const iddata = await getBilibiliID(url);
37
38
  await new Bilibili(e, iddata).RESOURCES(iddata);
38
39
  return true;