karin-plugin-kkk 2.6.6 → 2.7.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.
Files changed (61) hide show
  1. package/lib/apps/admin.js +4 -63
  2. package/lib/apps/help.js +4 -147
  3. package/lib/apps/push.js +4 -188
  4. package/lib/apps/tools.js +4 -111
  5. package/lib/apps/update.js +4 -159
  6. package/lib/core_chunk/main-B_bal4l2.js +8166 -0
  7. package/lib/core_chunk/rolldown-runtime-ClGB2zpx.js +34 -0
  8. package/lib/core_chunk/template-Bldz-pZ_.js +6113 -0
  9. package/lib/core_chunk/template.d.ts +16 -1
  10. package/lib/core_chunk/vendor-Bwol9bLK.js +116840 -0
  11. package/lib/index.js +4 -99
  12. package/lib/karin-plugin-kkk.css +431 -85
  13. package/lib/root.js +3 -17
  14. package/lib/template.js +3 -0
  15. package/lib/web.config.js +4 -1
  16. package/lib/web_chunk/assets/Combination-BCkmNKTY.js +41 -0
  17. package/lib/web_chunk/assets/avatar-t5b6agwl.js +1 -0
  18. package/lib/web_chunk/assets/core-Cm9vsqzO.js +1 -0
  19. package/lib/web_chunk/assets/eye-B2-lW550.js +1 -0
  20. package/lib/web_chunk/assets/index-BE6OgnN_.js +398 -0
  21. package/lib/web_chunk/assets/index-DICd1U-F.css +2 -0
  22. package/lib/web_chunk/assets/jszip.min-AQq-u3xo.js +12 -0
  23. package/lib/web_chunk/assets/page-CvPGDyGh.js +23 -0
  24. package/lib/web_chunk/assets/page-DEhH1C2M.js +2 -0
  25. package/lib/web_chunk/assets/page-DZxkWURv.js +1 -0
  26. package/lib/web_chunk/assets/page-DqB80kjU.js +5 -0
  27. package/lib/web_chunk/assets/page-PRaFYXm6.js +1 -0
  28. package/lib/web_chunk/assets/page-qIT1EIL9.css +1 -0
  29. package/lib/web_chunk/assets/parsers-DojiQ3AJ.js +1 -0
  30. package/lib/web_chunk/assets/request-V6B14WVo.js +19 -0
  31. package/lib/web_chunk/assets/select-ClVmNY4V.js +1 -0
  32. package/lib/web_chunk/assets/separator-_LFegBZj.js +1 -0
  33. package/lib/web_chunk/index.html +2 -2
  34. package/lib/web_chunk/sw.js +1 -1
  35. package/package.json +3 -7
  36. package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_BV.svg +1 -0
  37. package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_GOODS.svg +1 -0
  38. package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_LOTTERY.svg +1 -0
  39. package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_VIEW_PICTURE.svg +1 -0
  40. package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_VOTE.svg +1 -0
  41. package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_WEB.svg +1 -0
  42. package/lib/core_chunk/db-CT-12x9I.js +0 -1653
  43. package/lib/core_chunk/main-CFxN6OYP.js +0 -7384
  44. package/lib/core_chunk/template.js +0 -5383
  45. package/lib/core_chunk/vendor-DzjX4fzz.js +0 -95899
  46. package/lib/web_chunk/assets/Combination-yoToLQlo.js +0 -46
  47. package/lib/web_chunk/assets/avatar-Xdlbme7R.js +0 -9
  48. package/lib/web_chunk/assets/eye-DVKjYXZE.js +0 -6
  49. package/lib/web_chunk/assets/index-B1B6YwEy.css +0 -1
  50. package/lib/web_chunk/assets/index-CdYjkgIP.js +0 -487
  51. package/lib/web_chunk/assets/index-DBhsODHd.js +0 -6
  52. package/lib/web_chunk/assets/page-BD8MpcyB.css +0 -1
  53. package/lib/web_chunk/assets/page-CD1Pmopl.js +0 -45
  54. package/lib/web_chunk/assets/page-CzE6HpRk.js +0 -11
  55. package/lib/web_chunk/assets/page-DpNB1r-j.js +0 -114
  56. package/lib/web_chunk/assets/page-ESDYIsgi.js +0 -31
  57. package/lib/web_chunk/assets/page-FlcioBBs.js +0 -16
  58. package/lib/web_chunk/assets/request-CzTMlmdh.js +0 -19
  59. package/lib/web_chunk/assets/select-9eVGPY2C.js +0 -16
  60. package/lib/web_chunk/assets/separator-mK78s7fr.js +0 -1
  61. package/resources/font/font.css +0 -3458
package/lib/apps/admin.js CHANGED
@@ -1,63 +1,4 @@
1
- import fs from "node:fs";
2
- import karin, { logger } from "node-karin";
3
- import require$$1 from "path";
4
- import "../core_chunk/db-CT-12x9I.js";
5
- import "../root.js";
6
- import "../core_chunk/vendor-DzjX4fzz.js";
7
- import { C as Config, m as Common, n as bilibiliLogin } from "../core_chunk/main-CFxN6OYP.js";
8
- import "node-karin/axios";
9
- import "stream/promises";
10
- import "node:path";
11
- import "../core_chunk/template.js";
12
- const task = Config.app.removeCache && karin.task("[kkk-视频缓存自动删除]", "0 0 4 * * *", async () => {
13
- try {
14
- await removeAllFiles(Common.tempDri.video);
15
- logger.mark(Common.tempDri.video + "目录下所有文件已删除");
16
- } catch (err) {
17
- console.error("删除文件时出错:", err);
18
- }
19
- });
20
- const biLogin = karin.command(/^#?(kkk)?\s*B站\s*(扫码)?\s*登录$/i, async (e) => {
21
- await bilibiliLogin(e);
22
- return true;
23
- }, { perm: Config.bilibili.loginPerm, name: "kkk-ck管理" });
24
- const dylogin = karin.command(/^#?(kkk)?抖音(扫码)?登录$/, async (e) => {
25
- await e.reply("暂时不可用");
26
- return true;
27
- }, { perm: Config.douyin.loginPerm, name: "kkk-ck管理" });
28
- const setdyck = karin.command(/^#?(kkk)?s*设置抖音ck$/i, async (e) => {
29
- const msg = await e.reply("请发在120秒内送抖音ck\n教程:https://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");
30
- const context = await karin.ctx(e);
31
- Config.Modify("cookies", "douyin", context.msg);
32
- await e.bot.recallMsg(e.contact, msg.messageId);
33
- await e.reply("设置成功!", { at: true });
34
- return true;
35
- }, { perm: "master", name: "kkk-ck管理", event: "message.friend" });
36
- const setbilick = karin.command(/^#?(kkk)?s*设置s*(B站)ck$/i, async (e) => {
37
- const msg = await e.reply("请发在120秒内送B站ck\n教程:https://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");
38
- const context = await karin.ctx(e);
39
- Config.Modify("cookies", "bilibili", context.msg);
40
- await e.bot.recallMsg(e.contact, msg.messageId);
41
- await e.reply("设置成功!", { at: true });
42
- return true;
43
- }, { perm: "master", name: "kkk-ck管理", event: "message.friend" });
44
- async function removeAllFiles(dir) {
45
- const files = await fs.promises.readdir(dir);
46
- for (const file of files) {
47
- const filePath = require$$1.join(dir, file);
48
- const stats = await fs.promises.stat(filePath);
49
- if (stats.isDirectory()) {
50
- await removeAllFiles(filePath);
51
- await fs.promises.rmdir(filePath);
52
- } else {
53
- await fs.promises.unlink(filePath);
54
- }
55
- }
56
- }
57
- export {
58
- biLogin,
59
- dylogin,
60
- setbilick,
61
- setdyck,
62
- task
63
- };
1
+ import "../core_chunk/vendor-Bwol9bLK.js";
2
+ import { C as setdyck, S as setbilick, b as biLogin, w as task, x as dylogin } from "../core_chunk/main-B_bal4l2.js";
3
+ import "../core_chunk/template-Bldz-pZ_.js";
4
+ export { biLogin, dylogin, setbilick, setdyck, task };
package/lib/apps/help.js CHANGED
@@ -1,147 +1,4 @@
1
- import fs from "node:fs";
2
- import { markdown } from "@karinjs/md-html";
3
- import karin, { config, logs, mkdirSync, render } from "node-karin";
4
- import { karinPathTemp } from "node-karin/root";
5
- import "../core_chunk/db-CT-12x9I.js";
6
- import { Root } from "../root.js";
7
- import "../core_chunk/vendor-DzjX4fzz.js";
8
- import { C as Config, R as Render, m as Common } from "../core_chunk/main-CFxN6OYP.js";
9
- import "node-karin/axios";
10
- import "stream/promises";
11
- const HELP_MENU_CONFIG = [
12
- {
13
- title: "常用功能",
14
- items: [
15
- {
16
- title: "自动识别分享链接进行解析",
17
- description: (() => {
18
- const platforms = [];
19
- if (Config.douyin?.switch) platforms.push("抖音");
20
- if (Config.bilibili?.switch) platforms.push("哔哩哔哩");
21
- if (Config.kuaishou?.switch) platforms.push("快手");
22
- if (Config.xiaohongshu?.switch) platforms.push("小红书");
23
- return platforms.length > 0 ? `支持「${platforms.join("」「")}」` : "暂无可用平台";
24
- })(),
25
- icon: "Link",
26
- roles: ["member", "master"]
27
- },
28
- {
29
- title: "「#解析」「#kkk解析」",
30
- description: "在解析功能关闭的情况下,可对引用消息进行解析",
31
- icon: "Sparkles",
32
- roles: ["member", "master"]
33
- }
34
- ]
35
- },
36
- {
37
- title: "推送相关",
38
- items: [
39
- {
40
- title: "#抖音/B站推送列表",
41
- description: "查看当前群的订阅推送列表",
42
- icon: "List",
43
- roles: ["master"]
44
- },
45
- {
46
- title: "#抖音/B站全部?强制推送",
47
- description: "全部强制推送:手动模拟一次定时任务;\n强制推送:只在触发群模拟一次定时任务;\n已推送过的不会再推送",
48
- icon: "Send",
49
- roles: ["master"]
50
- }
51
- ],
52
- subGroups: [
53
- {
54
- title: "在群聊中再发送一次即可取消订阅",
55
- items: [
56
- {
57
- title: "#设置抖音推送 + 抖音号",
58
- description: "在群聊中发送以对该群订阅该blogger的作品更新",
59
- icon: "Bell",
60
- roles: Config.douyin.push.permission === "all" ? ["member", "master"] : ["master"]
61
- },
62
- {
63
- title: "#设置B站推送 + UP主UID",
64
- description: "在群聊中发送以对该群订阅该blogger的作品更新",
65
- icon: "Bell",
66
- roles: Config.bilibili.push.permission === "all" ? ["member", "master"] : ["master"]
67
- }
68
- ]
69
- }
70
- ]
71
- },
72
- {
73
- title: "设置相关",
74
- items: [
75
- {
76
- title: "#kkk设置推送机器人 + Bot ID",
77
- description: "一键更换推送机器人",
78
- icon: "Bot",
79
- roles: ["master"]
80
- },
81
- {
82
- title: "#B站登录",
83
- description: "使用哔哩哔哩APP扫码登录获取 Cookies",
84
- icon: "LogIn",
85
- roles: ["master"]
86
- }
87
- ]
88
- },
89
- {
90
- title: "其他",
91
- items: [
92
- {
93
- title: "「#kkk更新日志」「#kkk更新」",
94
- description: "字面意思~",
95
- icon: "RefreshCw",
96
- roles: ["master"]
97
- }
98
- ]
99
- }
100
- ];
101
- function buildMenuForRole(role) {
102
- const filterItems = (items = []) => items.filter((i) => !i.roles || i.roles.includes(role)).map(({ title, description, icon }) => ({ title, description, icon }));
103
- return HELP_MENU_CONFIG.map((group) => {
104
- const items = filterItems(group.items);
105
- const subGroups = group.subGroups?.map((sg) => ({ title: sg.title, items: filterItems(sg.items) })).filter((s) => s.items.length > 0);
106
- return { title: group.title, items, subGroups };
107
- }).filter((g) => g.items.length > 0 || g.subGroups && g.subGroups.length > 0);
108
- }
109
- const help = karin.command(/^#?kkk帮助$/, async (e) => {
110
- const masters = config.master().filter((id) => id !== "console");
111
- const isMaster = !!e.sender && masters.includes(e.sender.userId);
112
- const role = isMaster ? "master" : "member";
113
- const menu = buildMenuForRole(role);
114
- const img = await Render("other/help", {
115
- title: "KKK插件帮助页面",
116
- menu,
117
- role
118
- });
119
- await e.reply(img);
120
- return true;
121
- }, { name: "kkk-帮助" });
122
- const version = karin.command(/^#?kkk(版本|更新日志)$/, async (e) => {
123
- const changelogContent = fs.readFileSync(Root.pluginPath + "/CHANGELOG.md", "utf8");
124
- const forwardLogs = logs(Root.pluginVersion, changelogContent, 10, false);
125
- const html = markdown(forwardLogs, {
126
- gitcss: Common.useDarkTheme() ? "github-markdown-dark.css" : "github-markdown-light.css",
127
- scale: 5,
128
- customCSSFiles: [
129
- Root.pluginPath + "/resources/font/font.css"
130
- ],
131
- fontFamily: "HarmonyOSHans-Regular"
132
- });
133
- mkdirSync(`${karinPathTemp}/html/${Root.pluginName}/version`);
134
- const htmlPath = `${karinPathTemp}/html/${Root.pluginName}/version/version.html`;
135
- fs.writeFileSync(htmlPath, html);
136
- const base64 = await render.renderHtml(htmlPath);
137
- const img = await Render("other/changelog", {
138
- changeLogImg: `data:image/png;base64,${base64}`,
139
- Tip: false
140
- });
141
- await e.reply(img);
142
- return true;
143
- }, { name: "kkk-版本" });
144
- export {
145
- help,
146
- version
147
- };
1
+ import "../core_chunk/vendor-Bwol9bLK.js";
2
+ import { v as help, y as version } from "../core_chunk/main-B_bal4l2.js";
3
+ import "../core_chunk/template-Bldz-pZ_.js";
4
+ export { help, version };
package/lib/apps/push.js CHANGED
@@ -1,188 +1,4 @@
1
- import { a as getDouyinData, g as getBilibiliData, ad as amagi } from "../core_chunk/vendor-DzjX4fzz.js";
2
- import karin, { logger } from "node-karin";
3
- import { douyinDBInstance, bilibiliDBInstance } from "../core_chunk/db-CT-12x9I.js";
4
- import "../root.js";
5
- import "node:fs";
6
- import { C as Config, o as wrapWithErrorHandler, B as Bilibilipush, D as DouYinpush, p as getDouyinID, N as Networks, R as Render, m as Common } from "../core_chunk/main-CFxN6OYP.js";
7
- import "node-karin/axios";
8
- const handleDouyinPush = wrapWithErrorHandler(async () => {
9
- await new DouYinpush().action();
10
- return true;
11
- }, {
12
- businessName: "抖音推送任务"
13
- });
14
- const handleBilibiliPush = wrapWithErrorHandler(async () => {
15
- await new Bilibilipush().action();
16
- return true;
17
- }, {
18
- businessName: "B站推送任务"
19
- });
20
- const handleForcePush = wrapWithErrorHandler(async (e) => {
21
- if (e.msg.includes("抖音")) {
22
- await new DouYinpush().action();
23
- return true;
24
- } else if (e.msg.includes("B站")) {
25
- await new Bilibilipush().action();
26
- return true;
27
- }
28
- return true;
29
- }, {
30
- businessName: "强制推送"
31
- });
32
- const handleSetDouyinPush = wrapWithErrorHandler(async (e) => {
33
- const data = await getDouyinData("搜索数据", Config.cookies.douyin, {
34
- query: e.msg.replace(/^#设置抖音推送/, ""),
35
- typeMode: "strict"
36
- });
37
- await new DouYinpush(e).setting(data.data);
38
- return true;
39
- }, {
40
- businessName: "设置抖音推送"
41
- });
42
- const handleSetBilibiliPush = wrapWithErrorHandler(async (e) => {
43
- if (!Config.cookies.bilibili) {
44
- await e.reply("\n请先配置B站Cookie", { at: true });
45
- return true;
46
- }
47
- const match = /^#设置[bB]站推送(?:UID:)?(\d+)$/.exec(e.msg);
48
- if (match && match[1]) {
49
- const data = await getBilibiliData("用户主页数据", Config.cookies.bilibili, {
50
- host_mid: Number(match[1]),
51
- typeMode: "strict"
52
- });
53
- await new Bilibilipush(e).setting(data.data);
54
- }
55
- return true;
56
- }, {
57
- businessName: "设置B站推送"
58
- });
59
- const handleBilibiliPushList = wrapWithErrorHandler(async (e) => {
60
- await new Bilibilipush(e).renderPushList();
61
- }, {
62
- businessName: "B站推送列表"
63
- });
64
- const handleDouyinPushList = wrapWithErrorHandler(async (e) => {
65
- await new DouYinpush(e).renderPushList();
66
- }, {
67
- businessName: "抖音推送列表"
68
- });
69
- const handleChangeBotID = wrapWithErrorHandler(async (e) => {
70
- const newBotId = e.msg.replace(/^#kkk设置推送机器人/, "");
71
- const newDouyinlist = Config.pushlist.douyin.map((item) => {
72
- const modifiedGroupIds = item.group_id.map((groupId) => {
73
- const [group_id, oldBotId] = groupId.split(":");
74
- if (oldBotId && oldBotId !== newBotId) {
75
- douyinDBInstance.updateGroupBotId(group_id, oldBotId, newBotId).catch((err) => {
76
- logger.error(`Failed to update douyin group ${group_id}:`, err);
77
- });
78
- }
79
- return `${group_id}:${newBotId}`;
80
- });
81
- return {
82
- ...item,
83
- group_id: modifiedGroupIds
84
- };
85
- });
86
- const newBilibililist = Config.pushlist.bilibili.map((item) => {
87
- const modifiedGroupIds = item.group_id.map((groupId) => {
88
- const [group_id, oldBotId] = groupId.split(":");
89
- if (oldBotId && oldBotId !== newBotId) {
90
- bilibiliDBInstance.updateGroupBotId(group_id, oldBotId, newBotId).catch((err) => {
91
- logger.error(`Failed to update bilibili group ${group_id}:`, err);
92
- });
93
- }
94
- return `${group_id}:${newBotId}`;
95
- });
96
- return {
97
- ...item,
98
- group_id: modifiedGroupIds
99
- };
100
- });
101
- Config.Modify("pushlist", "douyin", newDouyinlist);
102
- Config.Modify("pushlist", "bilibili", newBilibililist);
103
- await e.reply("推送机器人已修改为" + newBotId);
104
- return true;
105
- }, {
106
- businessName: "设置推送机器人"
107
- });
108
- const handleTestDouyinPush = wrapWithErrorHandler(async (e) => {
109
- const url = String(e.msg.match(/(http|https):\/\/.*\.(douyin|iesdouyin)\.com\/[^ ]+/g));
110
- const iddata = await getDouyinID(e, url);
111
- const workInfo = await amagi.getDouyinData("聚合解析", { aweme_id: iddata.aweme_id, typeMode: "strict" }, Config.cookies.douyin);
112
- const userProfile = await amagi.getDouyinData("用户主页数据", { sec_uid: workInfo.data.aweme_detail.author.sec_uid, typeMode: "strict" }, Config.cookies.douyin);
113
- const realUrl = Config.douyin.push.shareType === "web" && await new Networks({
114
- url: workInfo.data.aweme_detail.share_url,
115
- headers: {
116
- "User-Agent": "Apifox/1.0.0 (https://apifox.com)",
117
- Accept: "*/*",
118
- "Accept-Encoding": "gzip, deflate, br",
119
- Connection: "keep-alive"
120
- }
121
- }).getLocation();
122
- const img = await Render("douyin/dynamic", {
123
- image_url: iddata.is_mp4 ? workInfo.data.aweme_detail.video.animated_cover?.url_list[0] ?? workInfo.data.aweme_detail.video.cover.url_list[0] : workInfo.data.aweme_detail.images[0].url_list[0],
124
- desc: workInfo.data.aweme_detail.desc,
125
- dianzan: Common.count(workInfo.data.aweme_detail.statistics.digg_count),
126
- pinglun: Common.count(workInfo.data.aweme_detail.statistics.comment_count),
127
- share: Common.count(workInfo.data.aweme_detail.statistics.share_count),
128
- shouchang: Common.count(workInfo.data.aweme_detail.statistics.collect_count),
129
- create_time: Common.convertTimestampToDateTime(workInfo.data.aweme_detail.create_time),
130
- avater_url: "https://p3-pc.douyinpic.com/aweme/1080x1080/" + userProfile.data.user.avatar_larger.uri,
131
- share_url: Config.douyin.push.shareType === "web" ? realUrl : `https://aweme.snssdk.com/aweme/v1/play/?video_id=${workInfo.data.aweme_detail.video.play_addr.uri}&ratio=1080p&line=0`,
132
- username: workInfo.data.aweme_detail.author.nickname,
133
- 抖音号: userProfile.data.user.unique_id === "" ? userProfile.data.user.short_id : userProfile.data.user.unique_id,
134
- 粉丝: Common.count(userProfile.data.user.follower_count),
135
- 获赞: Common.count(userProfile.data.user.total_favorited),
136
- 关注: Common.count(userProfile.data.user.following_count),
137
- cooperation_info: (() => {
138
- const raw = workInfo.data.aweme_detail.cooperation_info;
139
- if (!raw) return void 0;
140
- const rawCreators = Array.isArray(raw.co_creators) ? raw.co_creators : [];
141
- const author = workInfo.data.aweme_detail.author;
142
- const authorUid = author?.uid;
143
- const authorSecUid = author?.sec_uid;
144
- const authorNickname = author?.nickname;
145
- const authorInCreators = rawCreators.some(
146
- (c) => authorUid && c.uid && c.uid === authorUid || authorSecUid && c.sec_uid && c.sec_uid === authorSecUid || authorNickname && c.nickname && c.nickname === authorNickname
147
- );
148
- const co_creators = rawCreators.map((c) => {
149
- const firstUrl = c.avatar_thumb?.url_list?.[0] ?? (c.avatar_thumb?.uri ? `https://p3.douyinpic.com/${c.avatar_thumb.uri}` : void 0);
150
- return {
151
- avatar_thumb: firstUrl ? { url_list: [firstUrl] } : void 0,
152
- nickname: c.nickname,
153
- role_title: c.role_title
154
- };
155
- });
156
- const baseCount = Math.max(Number(raw.co_creator_nums || 0), co_creators.length);
157
- const teamCount = baseCount + (authorInCreators ? 0 : 1);
158
- return {
159
- co_creator_nums: teamCount,
160
- co_creators
161
- };
162
- })()
163
- });
164
- e.reply(img);
165
- return true;
166
- }, {
167
- businessName: "测试抖音推送"
168
- });
169
- const douyinPush = Config.douyin.push.switch && karin.task("抖音推送", Config.douyin.push.cron, handleDouyinPush, { log: Config.douyin.push.log });
170
- const bilibiliPush = Config.bilibili.push.switch && karin.task("B站推送", Config.bilibili.push.cron, handleBilibiliPush, { log: Config.bilibili.push.log });
171
- const forcePush = karin.command(/#(抖音|B站)(全部)?强制推送/, handleForcePush, { name: "𝑪𝒊𝒂𝒍𝒍𝒐~(∠・ω< )⌒★", perm: "master", event: "message.group" });
172
- const setdyPush = karin.command(/^#设置抖音推送/, handleSetDouyinPush, { name: "kkk-推送功能-设置", event: "message.group", perm: Config.douyin.push.permission, dsbAdapter: ["qqbot"] });
173
- const setbiliPush = karin.command(/^#设置[bB]站推送(?:[Uu][Ii][Dd]:)?(\d+)$/, handleSetBilibiliPush, { name: "kkk-推送功能-设置", event: "message.group", perm: Config.bilibili.push.permission, dsbAdapter: ["qqbot"] });
174
- const bilibiliPushList = karin.command(/^#?[bB]站推送列表$/, handleBilibiliPushList, { name: "kkk-推送功能-列表", event: "message.group" });
175
- const douyinPushList = karin.command(/^#?抖音推送列表$/, handleDouyinPushList, { name: "kkk-推送功能-列表", event: "message.group" });
176
- const changeBotID = karin.command(/^#kkk设置推送机器人/, handleChangeBotID, { name: "kkk-推送功能-设置", perm: "master" });
177
- const testDouyinPush = karin.command(/^#测试抖音推送\s*(https?:\/\/[^\s]+)?/, handleTestDouyinPush, { name: "kkk-推送功能-测试", event: "message.group", perm: Config.douyin.push.permission, dsbAdapter: ["qqbot"] });
178
- export {
179
- bilibiliPush,
180
- bilibiliPushList,
181
- changeBotID,
182
- douyinPush,
183
- douyinPushList,
184
- forcePush,
185
- setbiliPush,
186
- setdyPush,
187
- testDouyinPush
188
- };
1
+ import "../core_chunk/vendor-Bwol9bLK.js";
2
+ import { _ as testDouyinPush, d as changeBotID, f as douyinPush, g as setdyPush, h as setbiliPush, l as bilibiliPush, m as forcePush, p as douyinPushList, u as bilibiliPushList } from "../core_chunk/main-B_bal4l2.js";
3
+ import "../core_chunk/template-Bldz-pZ_.js";
4
+ export { bilibiliPush, bilibiliPushList, changeBotID, douyinPush, douyinPushList, forcePush, setbiliPush, setdyPush, testDouyinPush };
package/lib/apps/tools.js CHANGED
@@ -1,111 +1,4 @@
1
- import karin, { logger } from "node-karin";
2
- import "../core_chunk/db-CT-12x9I.js";
3
- import "../root.js";
4
- import "node:fs";
5
- import "../core_chunk/vendor-DzjX4fzz.js";
6
- import { o as wrapWithErrorHandler, C as Config, p as getDouyinID, q as DouYin, r as getBilibiliID, t as Bilibili, u as getKuaishouID, x as fetchKuaishouData, K as Kuaishou, y as getXiaohongshuID, X as Xiaohongshu, m as Common } from "../core_chunk/main-CFxN6OYP.js";
7
- import "node-karin/axios";
8
- import "stream/promises";
9
- import "node:path";
10
- import "../core_chunk/template.js";
11
- const reg = {
12
- douyin: /^.*((www|v|jx|m)\.(douyin|iesdouyin)\.com|douyin\.com\/(video|note)).*/,
13
- bilibili: /(bilibili.com|b23.tv|t.bilibili.com|bili2233.cn|BV[a-zA-Z0-9]{10,})/,
14
- kuaishou: /^((.*)快手(.*)快手(.*)|(.*)v\.kuaishou(.*)|(.*)kuaishou\.com\/f\/[a-zA-Z0-9]+.*)$/,
15
- xiaohongshu: /(xiaohongshu\.com|xhslink\.com)/
16
- };
17
- const handleDouyin = wrapWithErrorHandler(async (e) => {
18
- const url = String(e.msg.match(/(http|https):\/\/.*\.(douyin|iesdouyin)\.com\/[^ ]+/g));
19
- const iddata = await getDouyinID(e, url);
20
- await new DouYin(e, iddata).RESOURCES(iddata);
21
- return true;
22
- }, {
23
- businessName: "抖音视频解析"
24
- });
25
- const handleBilibili = wrapWithErrorHandler(async (e) => {
26
- e.msg = e.msg.replace(/\\/g, "");
27
- const urlRegex = /(https?:\/\/(?:www\.bilibili\.com|m\.bilibili\.com|t\.bilibili\.com|b23\.tv|bili2233\.cn)\/[a-zA-Z0-9_\-.~:\/?#[\]@!$&'()*+,;=]+)/;
28
- const bvRegex = /^BV[1-9a-zA-Z]{10}$/;
29
- let url = null;
30
- const urlMatch = e.msg.match(urlRegex);
31
- if (urlMatch) {
32
- url = urlMatch[0];
33
- } else if (bvRegex.test(e.msg)) {
34
- url = `https://www.bilibili.com/video/${e.msg}`;
35
- }
36
- if (!url) {
37
- logger.warn(`未能在消息中找到有效的B站分享链接或BV号: ${e.msg}`);
38
- return true;
39
- }
40
- const iddata = await getBilibiliID(url);
41
- await new Bilibili(e, iddata).RESOURCES(iddata);
42
- return true;
43
- }, {
44
- businessName: "B站视频解析"
45
- });
46
- const handleKuaishou = wrapWithErrorHandler(async (e) => {
47
- const kuaishouUrl = e.msg.replaceAll("\\", "").match(/(https:\/\/v\.kuaishou\.com\/\w+|https:\/\/www\.kuaishou\.com\/f\/[a-zA-Z0-9]+)/g);
48
- const iddata = await getKuaishouID(String(kuaishouUrl));
49
- const WorkData = await fetchKuaishouData(iddata.type, iddata);
50
- await new Kuaishou(e, iddata).RESOURCES(WorkData);
51
- }, {
52
- businessName: "快手视频解析"
53
- });
54
- const handleXiaohongshu = wrapWithErrorHandler(async (e) => {
55
- const cleaned = e.msg.replaceAll("\\", "");
56
- const m = cleaned.match(/https?:\/\/[^\s"'<>]+/);
57
- const url = m?.[0];
58
- if (!url) {
59
- logger.warn(`未能在消息中找到有效链接: ${e.msg}`);
60
- return true;
61
- }
62
- const iddata = await getXiaohongshuID(url);
63
- await new Xiaohongshu(e, iddata).RESOURCES(iddata);
64
- return true;
65
- }, {
66
- businessName: "小红书视频解析"
67
- });
68
- const handlePrefix = wrapWithErrorHandler(async (e) => {
69
- e.msg = await Common.getReplyMessage(e);
70
- if (reg.douyin.test(e.msg)) {
71
- return await handleDouyin(e);
72
- } else if (reg.bilibili.test(e.msg)) {
73
- return await handleBilibili(e);
74
- } else if (reg.kuaishou.test(e.msg)) {
75
- return await handleKuaishou(e);
76
- } else if (reg.xiaohongshu.test(e.msg)) {
77
- return await handleXiaohongshu(e);
78
- }
79
- }, {
80
- businessName: "引用解析"
81
- });
82
- const douyin = karin.command(reg.douyin, handleDouyin, {
83
- name: "kkk-视频功能-抖音",
84
- priority: Config.app.videoTool ? -Infinity : 800
85
- });
86
- const bilibili = karin.command(reg.bilibili, handleBilibili, {
87
- name: "kkk-视频功能-B站",
88
- priority: Config.app.videoTool ? -Infinity : 800
89
- });
90
- const kuaishou = karin.command(reg.kuaishou, handleKuaishou, {
91
- name: "kkk-视频功能-快手",
92
- priority: Config.app.videoTool ? -Infinity : 800
93
- });
94
- const xiaohongshu = karin.command(reg.xiaohongshu, handleXiaohongshu, {
95
- name: "kkk-视频功能-小红书",
96
- priority: Config.app.videoTool ? -Infinity : 800
97
- });
98
- const prefix = karin.command(/^#?(解析|kkk解析)/, handlePrefix, {
99
- name: "kkk-视频功能-引用解析"
100
- });
101
- const douyinAPP = Config.douyin.switch && douyin;
102
- const bilibiliAPP = Config.bilibili.switch && bilibili;
103
- const kuaishouAPP = Config.kuaishou.switch && kuaishou;
104
- const xiaohongshuAPP = Config.xiaohongshu.switch && xiaohongshu;
105
- export {
106
- bilibiliAPP,
107
- douyinAPP,
108
- kuaishouAPP,
109
- prefix,
110
- xiaohongshuAPP
111
- };
1
+ import "../core_chunk/vendor-Bwol9bLK.js";
2
+ import { a as douyinAPP, c as xiaohongshuAPP, i as bilibiliAPP, o as kuaishouAPP, s as prefix } from "../core_chunk/main-B_bal4l2.js";
3
+ import "../core_chunk/template-Bldz-pZ_.js";
4
+ export { bilibiliAPP, douyinAPP, kuaishouAPP, prefix, xiaohongshuAPP };