yz-yuki-plugin 1.0.1-rc.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/.puppeteerrc.cjs +4 -0
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +195 -0
- package/defaultConfig/bilibili/config.yaml +41 -0
- package/defaultConfig/bilibili/push.yaml +0 -0
- package/defaultConfig/help/help.yaml +86 -0
- package/defaultConfig/weibo/config.yaml +41 -0
- package/defaultConfig/weibo/push.yaml +0 -0
- package/lib/apps/bilibili.js +402 -0
- package/lib/apps/help.js +37 -0
- package/lib/apps/index.js +4 -0
- package/lib/apps/version.js +34 -0
- package/lib/apps/weibo.js +252 -0
- package/lib/components/dynamic/Account.js +26 -0
- package/lib/components/dynamic/Content.js +118 -0
- package/lib/components/dynamic/Footer.js +36 -0
- package/lib/components/dynamic/ForwardContent.js +15 -0
- package/lib/components/dynamic/LogoText.js +10 -0
- package/lib/components/dynamic/MainPage.js +22 -0
- package/lib/components/help/Help.js +33 -0
- package/lib/components/index.js +6 -0
- package/lib/components/loginQrcode/Page.js +21 -0
- package/lib/components/version/Version.js +27 -0
- package/lib/index.js +29 -0
- package/lib/models/bilibili/bilibili.api.js +49 -0
- package/lib/models/bilibili/bilibili.get.web.data.js +80 -0
- package/lib/models/bilibili/bilibili.models.js +484 -0
- package/lib/models/bilibili/bilibili.query.js +393 -0
- package/lib/models/bilibili/bilibili.task.js +256 -0
- package/lib/models/bilibili/bilibili.wbi.js +49 -0
- package/lib/models/help/help.js +20 -0
- package/lib/models/version/version.js +62 -0
- package/lib/models/weibo/weibo.api.js +19 -0
- package/lib/models/weibo/weibo.get.web.data.js +55 -0
- package/lib/models/weibo/weibo.query.js +323 -0
- package/lib/models/weibo/weibo.task.js +215 -0
- package/lib/types/apps/bilibili.d.ts +6 -0
- package/lib/types/apps/help.d.ts +6 -0
- package/lib/types/apps/index.d.ts +4 -0
- package/lib/types/apps/version.d.ts +6 -0
- package/lib/types/apps/weibo.d.ts +6 -0
- package/lib/types/components/dynamic/Account.d.ts +13 -0
- package/lib/types/components/dynamic/Content.d.ts +12 -0
- package/lib/types/components/dynamic/Footer.d.ts +11 -0
- package/lib/types/components/dynamic/ForwardContent.d.ts +6 -0
- package/lib/types/components/dynamic/LogoText.d.ts +9 -0
- package/lib/types/components/dynamic/MainPage.d.ts +34 -0
- package/lib/types/components/help/Help.d.ts +12 -0
- package/lib/types/components/index.d.ts +5 -0
- package/lib/types/components/loginQrcode/Page.d.ts +7 -0
- package/lib/types/components/version/Version.d.ts +8 -0
- package/lib/types/index.d.ts +5 -0
- package/lib/types/models/bilibili/bilibili.api.d.ts +47 -0
- package/lib/types/models/bilibili/bilibili.buid.fp.d.ts +2 -0
- package/lib/types/models/bilibili/bilibili.get.web.data.d.ts +6 -0
- package/lib/types/models/bilibili/bilibili.models.d.ts +20 -0
- package/lib/types/models/bilibili/bilibili.query.d.ts +13 -0
- package/lib/types/models/bilibili/bilibili.task.d.ts +18 -0
- package/lib/types/models/bilibili/bilibili.wbi.d.ts +5 -0
- package/lib/types/models/help/help.d.ts +8 -0
- package/lib/types/models/version/version.d.ts +7 -0
- package/lib/types/models/weibo/weibo.api.d.ts +17 -0
- package/lib/types/models/weibo/weibo.get.web.data.d.ts +8 -0
- package/lib/types/models/weibo/weibo.query.d.ts +18 -0
- package/lib/types/models/weibo/weibo.task.d.ts +17 -0
- package/lib/types/utils/config.d.ts +21 -0
- package/lib/types/utils/image.d.ts +10 -0
- package/lib/types/utils/paths.d.ts +10 -0
- package/lib/types/utils/puppeteer.render.d.ts +23 -0
- package/lib/utils/config.js +108 -0
- package/lib/utils/image.js +26 -0
- package/lib/utils/paths.js +18 -0
- package/lib/utils/puppeteer.render.js +102 -0
- package/package.json +110 -0
- package/public/output.css +1 -0
- package/resources/css/dynamic/Account.css +68 -0
- package/resources/css/dynamic/Content.box.grid.4.css +4 -0
- package/resources/css/dynamic/Content.box.grid.9.css +4 -0
- package/resources/css/dynamic/Content.css +87 -0
- package/resources/css/dynamic/Footer.css +44 -0
- package/resources/css/dynamic/ForwardContent.css +11 -0
- package/resources/css/dynamic/LogoText.css +15 -0
- package/resources/css/dynamic/MainPage.css +93 -0
- package/resources/css/help/help.css +182 -0
- package/resources/css/loginQrcode/Page.css +55 -0
- package/resources/css/version/version.css +116 -0
- package/resources/fonts/iconfont.16acc2.ttf +0 -0
- package/resources/img/background/Girl.png +0 -0
- package/resources/img/icon/dynamic/bili-rich-text-module-goods-taobao.svg +1 -0
- package/resources/img/icon/dynamic/bili-rich-text-module-lottery.svg +1 -0
- package/resources/img/icon/dynamic/bilibili.svg +6 -0
- package/resources/img/icon/dynamic/weibo.svg +43 -0
- package/resources/img/icon/puplic/archaic_stone.png +0 -0
- package/resources/img/icon/puplic/condessence_crystal.png +0 -0
- package/resources/img/icon/puplic/delightful_encounter.png +0 -0
- package/resources/img/icon/puplic/diagram.png +0 -0
- package/resources/img/icon/puplic/essence_of_pure_sacred_dewdrop.png +0 -0
- package/resources/img/icon/puplic/everamber.png +0 -0
- package/resources/img/icon/puplic/flower_1.png +0 -0
- package/resources/img/icon/puplic/flower_2.png +0 -0
- package/resources/img/icon/puplic/kamera.png +0 -0
- package/resources/img/icon/puplic/lumidouce_bell.png +0 -0
- package/resources/img/icon/puplic/mora.png +0 -0
- package/resources/img/icon/puplic/pluie_lotus.png +0 -0
- package/resources/img/icon/puplic/restaurant_smoothie.png +0 -0
- package/resources/img/icon/puplic/romaritime_flower.png +0 -0
- package/resources/img/icon/puplic/shell.png +0 -0
- package/resources/img/icon/puplic/spring_of_pure_sacred_dewdrop.png +0 -0
- package/resources/img/icon/puplic/surging_sacred_chalice.png +0 -0
- package/resources/img/icon/puplic/tourbillon_device.png +0 -0
- package/resources/img/icon/puplic/unfading_silky_grace.png +0 -0
- package/resources/img/icon/puplic/wisdom.png +0 -0
- package/resources/img/icon/puplic/wondrous_lovely_flower.png +0 -0
- package/resources/img/icon/puplic//345/262/251/347/245/236/347/236/263/345/205/261/351/270/243/347/237/263.png +0 -0
- package/resources/img/icon/puplic//346/260/264/347/245/236/347/236/263/345/205/261/351/270/243/347/237/263.png +0 -0
- package/resources/img/icon/puplic//350/215/211/347/245/236/347/236/263/345/205/261/351/270/243/347/237/263.png +0 -0
- package/resources/img/icon/puplic//351/222/223/351/261/274.png +0 -0
- package/resources/img/icon/puplic//351/233/267/347/245/236/347/236/263/345/205/261/351/270/243/347/237/263.png +0 -0
- package/resources/img/icon/puplic//351/243/216/347/245/236/347/236/263/345/205/261/351/270/243/347/237/263.png +0 -0
- package/resources/img/icon/puplic//351/243/216/350/275/246.png +0 -0
- package/resources/img/readme/girl.png +0 -0
- package/resources/img/readme/min-Girl.png +0 -0
- package/resources/img/readme/mini-help.jpg +0 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { Messages, setBotTask } from 'yunzai';
|
|
2
|
+
import { WeiboQuery } from '../models/weibo/weibo.query.js';
|
|
3
|
+
import { WeiboTask } from '../models/weibo/weibo.task.js';
|
|
4
|
+
import Config from '../utils/config.js';
|
|
5
|
+
import { WeiboGetWebData } from '../models/weibo/weibo.get.web.data.js';
|
|
6
|
+
|
|
7
|
+
const message = new Messages('message');
|
|
8
|
+
let weiboConfigData = Config.getConfigData("config", "weibo", "config");
|
|
9
|
+
let weiboPushData = Config.getConfigData("config", "weibo", "push");
|
|
10
|
+
setBotTask(async (Bot) => {
|
|
11
|
+
try {
|
|
12
|
+
await newPushTask();
|
|
13
|
+
if (weiboConfigData.pushTaskLog) {
|
|
14
|
+
Bot.logger.mark("yuki插件---微博动态推送定时任务");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
console.error('微博动态推送定时任务', err);
|
|
19
|
+
}
|
|
20
|
+
}, weiboConfigData.pushStatus ? weiboConfigData.pushTime : "");
|
|
21
|
+
async function newPushTask(e) {
|
|
22
|
+
await new WeiboTask(e).runTask();
|
|
23
|
+
}
|
|
24
|
+
message.use(async (e) => {
|
|
25
|
+
await newPushTask(e);
|
|
26
|
+
}, [/^(#|\/)(yuki|优纪)?执行(微博|weibo|WEIBO)任务$/]);
|
|
27
|
+
message.use(async (e) => {
|
|
28
|
+
if (!e.isMaster) {
|
|
29
|
+
e.reply("未取得bot主人身份,无权限添加微博动态订阅");
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const uid = e.msg.replace(/^(#|\/)(yuki|优纪)?(订阅|添加|add|ADD)(微博|weibo|WEIBO)推送\s*(视频\s*|图文\s*|文章\s*|转发\s*)*/g, "").trim();
|
|
33
|
+
if (!uid) {
|
|
34
|
+
e.reply(`请在指令末尾指定订阅的微博博主的UID!`);
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
let subData = weiboPushData || { group: {}, private: {} };
|
|
38
|
+
let chatType = e.isGroup ? "group" : "private";
|
|
39
|
+
let chatId = e.isGroup ? e.group_id : e.user_id;
|
|
40
|
+
if (!subData[chatType][chatId]) {
|
|
41
|
+
subData[chatType][chatId] = [];
|
|
42
|
+
}
|
|
43
|
+
const upData = subData[chatType][chatId].find((item) => item.uid === uid);
|
|
44
|
+
if (upData) {
|
|
45
|
+
upData.type = WeiboQuery.typeHandle(upData, e.msg, "add");
|
|
46
|
+
weiboPushData = subData;
|
|
47
|
+
Config.saveConfig("config", "weibo", "push", subData);
|
|
48
|
+
e.reply(`修改微博推送动态类型成功~\n${upData.name}:${uid}`);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const res = await new WeiboGetWebData(e).getBloggerInfo(uid);
|
|
52
|
+
if (res.statusText !== "OK") {
|
|
53
|
+
e.reply("出了点网络问题,等会再试试吧~");
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
const { ok, data } = res.data || {};
|
|
57
|
+
if (ok !== 1) {
|
|
58
|
+
e.reply(`订阅校验失败~\n博主uid:${uid} 可能是无效的,请检查后再试~`);
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
const userInfo = data.userInfo || {};
|
|
62
|
+
let name = uid;
|
|
63
|
+
if (userInfo && (userInfo.length !== 0)) {
|
|
64
|
+
name = userInfo.screen_name || uid;
|
|
65
|
+
}
|
|
66
|
+
subData[chatType][chatId].push({
|
|
67
|
+
bot_id: e?.self_id,
|
|
68
|
+
uid,
|
|
69
|
+
name: name,
|
|
70
|
+
type: WeiboQuery.typeHandle({ uid, name }, e.msg, "add"),
|
|
71
|
+
});
|
|
72
|
+
weiboPushData = subData;
|
|
73
|
+
Config.saveConfig("config", "weibo", "push", subData);
|
|
74
|
+
e.reply(`添加微博推送成功~\n${name}:${uid}`);
|
|
75
|
+
}
|
|
76
|
+
}, [/^(#|\/)(yuki|优纪)?(订阅|添加|add|ADD)(微博|weibo|WEIBO)推送\s*(视频\s*|图文\s*|文章\s*|转发\s*)*.*$/]);
|
|
77
|
+
message.use(async (e) => {
|
|
78
|
+
if (!e.isMaster) {
|
|
79
|
+
e.reply("未取得bot主人身份,无权限删除微博动态订阅");
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
const uid = e.msg.replace(/^(#|\/)(yuki|优纪)?(取消|删除|del|DEL)(微博|weibo|WEIBO)推送\s*(视频\s*|图文\s*|文章\s*|转发\s*)*/g, "").trim();
|
|
83
|
+
if (!uid) {
|
|
84
|
+
e.reply(`请在指令末尾指定订阅的微博博主的UID!`);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
let data = weiboPushData || { group: {}, private: {} };
|
|
88
|
+
let chatType = e.isGroup ? "group" : "private";
|
|
89
|
+
let chatId = e.isGroup ? e.group_id : e.user_id;
|
|
90
|
+
if (!data[chatType][chatId]) {
|
|
91
|
+
data[chatType][chatId] = [];
|
|
92
|
+
}
|
|
93
|
+
const upData = data[chatType][chatId].find((item) => item.uid == uid);
|
|
94
|
+
if (!upData) {
|
|
95
|
+
e.reply(`订阅列表中没有找到该UID~\n${uid}可能是无效的`);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const newType = WeiboQuery.typeHandle(upData, e.msg, "del");
|
|
99
|
+
let isDel = false;
|
|
100
|
+
if (newType.length) {
|
|
101
|
+
data[chatType][chatId] = data[chatType][chatId].map((item) => {
|
|
102
|
+
if (item.uid == uid) {
|
|
103
|
+
item.type = newType;
|
|
104
|
+
}
|
|
105
|
+
return item;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
isDel = true;
|
|
110
|
+
data[chatType][chatId] = data[chatType][chatId].filter((item) => item.uid !== uid);
|
|
111
|
+
}
|
|
112
|
+
Config.saveConfig("config", "weibo", "push", data);
|
|
113
|
+
e.reply(`${isDel ? "删除" : "修改"}微博推送成功~\n${uid}`);
|
|
114
|
+
}
|
|
115
|
+
}, [/^(#|\/)(yuki|优纪)?(取消|删除|del|DEL)(微博|weibo|WEIBO)推送\s*(视频\s*|图文\s*|文章\s*|转发\s*)*.*$/]);
|
|
116
|
+
message.use(async (e) => {
|
|
117
|
+
if (!e.isMaster) {
|
|
118
|
+
e.reply("未取得bot主人身份,无权限查看Bot的全部微博推送列表");
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
let subData = weiboPushData || { group: {}, private: {} };
|
|
122
|
+
const messages = [];
|
|
123
|
+
const typeMap = {
|
|
124
|
+
DYNAMIC_TYPE_AV: "视频",
|
|
125
|
+
DYNAMIC_TYPE_WORD: "图文",
|
|
126
|
+
DYNAMIC_TYPE_DRAW: "图文",
|
|
127
|
+
DYNAMIC_TYPE_ARTICLE: "文章",
|
|
128
|
+
DYNAMIC_TYPE_FORWARD: "转发",
|
|
129
|
+
};
|
|
130
|
+
if (subData.group && Object.keys(subData.group).length > 0) {
|
|
131
|
+
messages.push("------群组微博订阅------");
|
|
132
|
+
Object.keys(subData.group).forEach((groupId) => {
|
|
133
|
+
messages.push(`群组ID:${groupId}:`);
|
|
134
|
+
subData.group[groupId].forEach((item) => {
|
|
135
|
+
const types = new Set();
|
|
136
|
+
if (item.type && item.type.length) {
|
|
137
|
+
item.type.forEach((typeItem) => {
|
|
138
|
+
if (typeMap[typeItem]) {
|
|
139
|
+
types.add(typeMap[typeItem]);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
messages.push(`${item.name}:${item.uid} ${types.size ? `[${Array.from(types).join("、")}]` : " [全部动态]"}`);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
if (subData.private && Object.keys(subData.private).length > 0) {
|
|
148
|
+
messages.push("------私聊微博订阅------");
|
|
149
|
+
Object.keys(subData.private).forEach((userId) => {
|
|
150
|
+
messages.push(`用户ID:${userId}:`);
|
|
151
|
+
subData.private[userId].forEach((item) => {
|
|
152
|
+
const types = new Set();
|
|
153
|
+
if (item.type && item.type.length) {
|
|
154
|
+
item.type.forEach((typeItem) => {
|
|
155
|
+
if (typeMap[typeItem]) {
|
|
156
|
+
types.add(typeMap[typeItem]);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
messages.push(`${item.name}:${item.uid} ${types.size ? `[${Array.from(types).join("、")}]` : " [全部动态]"}`);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
e.reply(`推送列表如下:\n${messages.join("\n")}`);
|
|
165
|
+
}
|
|
166
|
+
}, [/^(#|\/)(yuki|优纪)?(微博|weibo|WEIBO)全部(推送|动态|订阅)列表$/]);
|
|
167
|
+
message.use(async (e) => {
|
|
168
|
+
let subData = weiboPushData || { group: {}, private: {} };
|
|
169
|
+
const messages = [];
|
|
170
|
+
const typeMap = {
|
|
171
|
+
DYNAMIC_TYPE_AV: "视频",
|
|
172
|
+
DYNAMIC_TYPE_WORD: "图文",
|
|
173
|
+
DYNAMIC_TYPE_DRAW: "图文",
|
|
174
|
+
DYNAMIC_TYPE_ARTICLE: "文章",
|
|
175
|
+
DYNAMIC_TYPE_FORWARD: "转发",
|
|
176
|
+
};
|
|
177
|
+
let chatType = e.isGroup ? "group" : "private";
|
|
178
|
+
let chatId = e.isGroup ? e.group_id : e.user_id;
|
|
179
|
+
if (!subData[chatType][chatId]) {
|
|
180
|
+
subData[chatType][chatId] = [];
|
|
181
|
+
}
|
|
182
|
+
subData[chatType][chatId].forEach((item) => {
|
|
183
|
+
const types = new Set();
|
|
184
|
+
if (item.type && item.type.length) {
|
|
185
|
+
item.type.forEach((typeItem) => {
|
|
186
|
+
if (typeMap[typeItem]) {
|
|
187
|
+
types.add(typeMap[typeItem]);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
messages.push(`${item.name}:${item.uid} ${types.size ? `[${Array.from(types).join("、")}]` : " [全部动态]"}`);
|
|
192
|
+
});
|
|
193
|
+
e.reply(`推送列表如下:\n${messages.join("\n")}`);
|
|
194
|
+
}, [/^(#|\/)(yuki|优纪)?(微博|weibo|WEIBO)(推送|动态|订阅)列表$/]);
|
|
195
|
+
message.use(async (e) => {
|
|
196
|
+
let uid = e.msg.replace(/^(#|\/)(yuki|优纪)?(微博|weibo|WEIBO)(博|bo|BO)主/g, "").trim();
|
|
197
|
+
const res = await new WeiboGetWebData(e).getBloggerInfo(uid);
|
|
198
|
+
if (res.statusText !== 'OK') {
|
|
199
|
+
e.reply("诶嘿,出了点网络问题,等会再试试吧~");
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const { ok, data } = res.data || {};
|
|
203
|
+
if (ok !== 1) {
|
|
204
|
+
e.reply(`订阅校验失败~\n博主uid:${uid} 可能是无效的,请检查后再试~`);
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
const userInfo = data.userInfo || {};
|
|
208
|
+
let sex = userInfo.gender === 'f' ? '女' : userInfo.gender === 'm' ? '男' : '未知';
|
|
209
|
+
const message = [
|
|
210
|
+
`-------微博-------`,
|
|
211
|
+
`\n博主昵称:${userInfo.screen_name || ''}`,
|
|
212
|
+
`\nUID:${userInfo.id || uid}`,
|
|
213
|
+
`\n性别:${sex}`,
|
|
214
|
+
`\n微博认证:${userInfo.verified_reason || '未认证'}`,
|
|
215
|
+
`\n描述:${userInfo.description || ''}`,
|
|
216
|
+
`\nsvip等级:${userInfo.svip || ''}`,
|
|
217
|
+
`\nvip等级:${userInfo.mbrank || ''}`,
|
|
218
|
+
`\n关注:${userInfo.follow_count || ''}`,
|
|
219
|
+
`\n粉丝人数:${userInfo.followers_count_str || ''}`,
|
|
220
|
+
];
|
|
221
|
+
e.reply(message);
|
|
222
|
+
}, [/^(#|\/)(yuki|优纪)?(微博|weibo|WEIBO)(博|bo|BO)主.*$/]);
|
|
223
|
+
message.use(async (e) => {
|
|
224
|
+
let keyword = e.msg.replace(/^(#|\/)(yuki|优纪)?搜索(微博|weibo|WEIBO)(博|bo|BO)主/g, "").trim();
|
|
225
|
+
const res = await new WeiboGetWebData(e).searchBloggerInfo(keyword);
|
|
226
|
+
if (res.statusText !== 'OK') {
|
|
227
|
+
e.reply("诶嘿,出了点网络问题,等会再试试吧~");
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const { ok, data } = res.data || {};
|
|
231
|
+
const { user, users } = data;
|
|
232
|
+
let info = user[0];
|
|
233
|
+
let infos = users[0];
|
|
234
|
+
let uid = info?.uid;
|
|
235
|
+
let id = infos?.id;
|
|
236
|
+
let nick = info?.nick;
|
|
237
|
+
let screen_name = infos?.screen_name;
|
|
238
|
+
let followers_count_str = infos?.followers_count_str;
|
|
239
|
+
if (ok !== 1 && !info && !infos) {
|
|
240
|
+
e.reply("惹~没有搜索到该用户捏,\n请换个关键词试试吧~ \nPS:该方法只能搜索到大V");
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const messages = [];
|
|
244
|
+
messages.push(`-----微博-----
|
|
245
|
+
\n博主昵称:${nick || screen_name}
|
|
246
|
+
\nUID:${uid || id}
|
|
247
|
+
\n粉丝人数:${followers_count_str || ''}`);
|
|
248
|
+
e.reply(messages.join("\n"));
|
|
249
|
+
}, [/^(#|\/)(yuki|优纪)?搜索(微博|weibo|WEIBO)(博|bo|BO)主.*$/]);
|
|
250
|
+
const YukiWeibo = message.ok;
|
|
251
|
+
|
|
252
|
+
export { YukiWeibo };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import LogoText from './LogoText.js';
|
|
3
|
+
import { createRequire } from 'module';
|
|
4
|
+
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const bilibililogo = require('./../../../resources/img/icon/dynamic/bilibili.svg');
|
|
7
|
+
const weibilogo = require('./../../../resources/img/icon/dynamic/weibo.svg');
|
|
8
|
+
const Account = ({ data }) => {
|
|
9
|
+
const renderLogo = (logoSrc, className) => (React.createElement("img", { src: logoSrc, className: className, alt: "logo" }));
|
|
10
|
+
return (React.createElement(React.Fragment, null,
|
|
11
|
+
React.createElement("link", { rel: "stylesheet", href: require("./../../../resources/css/dynamic/Account.css") }),
|
|
12
|
+
React.createElement("div", { className: "account" },
|
|
13
|
+
React.createElement("div", { className: "avatar-container" },
|
|
14
|
+
React.createElement("img", { src: data.face, alt: "\u5934\u50CF", className: "avatar" }),
|
|
15
|
+
data.pendant && React.createElement("img", { className: "pendant", src: data.pendant, alt: "pendant" }),
|
|
16
|
+
React.createElement("div", { className: "account-info" },
|
|
17
|
+
React.createElement("div", { className: "nickname" }, data.name || ""),
|
|
18
|
+
React.createElement("div", { className: "timestamp" }, data.pubTs || ""))),
|
|
19
|
+
React.createElement("div", { className: "logo-container" },
|
|
20
|
+
data.appName === 'bilibili' && renderLogo(bilibililogo, 'bilibili-logo'),
|
|
21
|
+
data.appName === 'weibo' && renderLogo(weibilogo, 'weibo-logo'),
|
|
22
|
+
React.createElement(LogoText, { data: data })))));
|
|
23
|
+
};
|
|
24
|
+
var Account$1 = Account;
|
|
25
|
+
|
|
26
|
+
export { Account$1 as default };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
const Content = ({ data }) => {
|
|
6
|
+
const picItems = data.pics && (React.createElement("div", { className: 'pic-content' }, data.pics.map((item, index) => {
|
|
7
|
+
if (item) {
|
|
8
|
+
return (React.createElement("div", { className: "pic-item", key: `${index}_0` },
|
|
9
|
+
React.createElement("img", { key: `${index}_1`, src: item?.url, alt: " " })));
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
12
|
+
})));
|
|
13
|
+
function getBoxGridStyle(pics) {
|
|
14
|
+
if (!Array.isArray(pics) || pics.length === 0) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
if (pics.length <= 1) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
if (pics.length === 2) {
|
|
21
|
+
for (const item of pics) {
|
|
22
|
+
if (item.width === undefined || item.height === undefined) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (item.width / item.height <= 0.5) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
for (const item of pics) {
|
|
30
|
+
if (item.width === undefined) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (item.width > 1240) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return boxGrid_4;
|
|
38
|
+
}
|
|
39
|
+
if (pics.length >= 3) {
|
|
40
|
+
for (const item of pics) {
|
|
41
|
+
if (item.width === undefined || item.height === undefined) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (item.width / item.height <= 0.5) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
for (const item of pics) {
|
|
49
|
+
if (item.width === undefined) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (item.width > 1240) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const maxWidth = Math.max(...pics.map(item => item.width));
|
|
57
|
+
if (maxWidth > 550 && maxWidth <= 1240) {
|
|
58
|
+
return boxGrid_4;
|
|
59
|
+
}
|
|
60
|
+
return boxGrid_9;
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const boxGrid = data.boxGrid && (data.pics && getBoxGridStyle(data.pics));
|
|
65
|
+
const boxGrid_4 = React.createElement("link", { key: "0", rel: "stylesheet", href: require('./../../../resources/css/dynamic/Content.box.grid.4.css') });
|
|
66
|
+
const boxGrid_9 = React.createElement("link", { key: "0", rel: "stylesheet", href: require('./../../../resources/css/dynamic/Content.box.grid.9.css') });
|
|
67
|
+
const contentCss = React.createElement("link", { rel: "stylesheet", href: require('./../../../resources/css/dynamic/Content.css') });
|
|
68
|
+
switch (data.type) {
|
|
69
|
+
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
|
70
|
+
return (React.createElement(React.Fragment, null,
|
|
71
|
+
contentCss,
|
|
72
|
+
boxGrid,
|
|
73
|
+
React.createElement("div", { className: "content" },
|
|
74
|
+
picItems,
|
|
75
|
+
data.title && React.createElement("h1", null, data.title))));
|
|
76
|
+
case 'DYNAMIC_TYPE_AV':
|
|
77
|
+
return (React.createElement(React.Fragment, null,
|
|
78
|
+
contentCss,
|
|
79
|
+
boxGrid,
|
|
80
|
+
React.createElement("div", { className: "content" },
|
|
81
|
+
picItems,
|
|
82
|
+
React.createElement("div", { className: "content-text-title", style: { marginBottom: '10px' } }, data.title && React.createElement("h1", null, data.title)),
|
|
83
|
+
React.createElement("div", { className: "content-text", dangerouslySetInnerHTML: { __html: data.content || '' } }))));
|
|
84
|
+
case 'DYNAMIC_TYPE_WORD':
|
|
85
|
+
return (React.createElement(React.Fragment, null,
|
|
86
|
+
contentCss,
|
|
87
|
+
boxGrid,
|
|
88
|
+
React.createElement("div", { className: "content" },
|
|
89
|
+
React.createElement("div", { className: "content-text", dangerouslySetInnerHTML: { __html: data.content || '' } }),
|
|
90
|
+
picItems)));
|
|
91
|
+
case 'DYNAMIC_TYPE_DRAW':
|
|
92
|
+
return (React.createElement(React.Fragment, null,
|
|
93
|
+
contentCss,
|
|
94
|
+
boxGrid,
|
|
95
|
+
React.createElement("div", { className: "content" },
|
|
96
|
+
React.createElement("div", { className: "content-text", dangerouslySetInnerHTML: { __html: data.content || '' } }),
|
|
97
|
+
picItems)));
|
|
98
|
+
case 'DYNAMIC_TYPE_ARTICLE':
|
|
99
|
+
return (React.createElement(React.Fragment, null,
|
|
100
|
+
contentCss,
|
|
101
|
+
boxGrid,
|
|
102
|
+
React.createElement("div", { className: "content" },
|
|
103
|
+
React.createElement("div", { className: "content-text-title", style: { marginBottom: '10px' } }, data.title && React.createElement("h1", null, data.title)),
|
|
104
|
+
React.createElement("div", { className: "content-text", dangerouslySetInnerHTML: { __html: data.content || '' } }),
|
|
105
|
+
picItems)));
|
|
106
|
+
default:
|
|
107
|
+
return (React.createElement(React.Fragment, null,
|
|
108
|
+
contentCss,
|
|
109
|
+
boxGrid,
|
|
110
|
+
React.createElement("div", { className: "content" },
|
|
111
|
+
data.title && React.createElement("h1", null, data.title),
|
|
112
|
+
React.createElement("div", { className: "content-text", dangerouslySetInnerHTML: { __html: data.content || '' } }),
|
|
113
|
+
picItems)));
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
var Content$1 = Content;
|
|
117
|
+
|
|
118
|
+
export { Content$1 as default };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ConfigController, BOT_NAME } from 'yunzai';
|
|
3
|
+
import Config from '../../utils/config.js';
|
|
4
|
+
import { createRequire } from 'module';
|
|
5
|
+
|
|
6
|
+
const botVersion = ConfigController.package?.version;
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
const bilibililogo = require('./../../../resources/img/icon/dynamic/bilibili.svg');
|
|
9
|
+
const weibilogo = require('./../../../resources/img/icon/dynamic/weibo.svg');
|
|
10
|
+
const Footer = ({ data }) => {
|
|
11
|
+
return (React.createElement(React.Fragment, null,
|
|
12
|
+
React.createElement("link", { rel: "stylesheet", href: require('./../../../resources/css/dynamic/Footer.css') }),
|
|
13
|
+
React.createElement("div", { className: "footer" },
|
|
14
|
+
React.createElement("div", { className: "footer-text-container" },
|
|
15
|
+
data.appName === 'bilibili' && (React.createElement("svg", { className: 'w-32 h-10 bili-logo-0', style: { width: '8rem', height: '2.5rem' } },
|
|
16
|
+
React.createElement("image", { href: bilibililogo }))),
|
|
17
|
+
data.appName === 'weibo' && (React.createElement("svg", { className: 'h-12 weibo-logo-0', style: { height: '3rem' } },
|
|
18
|
+
React.createElement("image", { href: weibilogo, width: "55", height: "55" }))),
|
|
19
|
+
React.createElement("div", { className: "qr-code-massage", style: { marginTop: '-4px' } },
|
|
20
|
+
"\u8BC6\u522B\u4E8C\u7EF4\u7801\uFF0C\u67E5\u770B\u5B8C\u6574",
|
|
21
|
+
data.category),
|
|
22
|
+
React.createElement("div", { className: "creatde-time", style: { marginTop: '6px', color: '#a46e8a' } },
|
|
23
|
+
"\u56FE\u7247\u751F\u6210\u4E8E\uFF1A",
|
|
24
|
+
data.created || ""),
|
|
25
|
+
React.createElement("div", { className: "bot-plugin-info", style: { marginTop: '6px' } },
|
|
26
|
+
"Created By ",
|
|
27
|
+
`${BOT_NAME}-v` + `${botVersion}`,
|
|
28
|
+
" & ",
|
|
29
|
+
React.createElement("span", { className: "yuki-plugin-text-title" }, "yuki-plugin"),
|
|
30
|
+
"-v",
|
|
31
|
+
React.createElement("span", { className: "italic" }, `${Config.getLatestVersion()}`))),
|
|
32
|
+
React.createElement("img", { src: data.urlImgData, alt: "\u4E8C\u7EF4\u7801", className: "qr-code" }))));
|
|
33
|
+
};
|
|
34
|
+
var Footer$1 = Footer;
|
|
35
|
+
|
|
36
|
+
export { Footer$1 as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Account from './Account.js';
|
|
3
|
+
import Content from './Content.js';
|
|
4
|
+
import { createRequire } from 'module';
|
|
5
|
+
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
const ForwardContent = ({ data }) => (React.createElement(React.Fragment, null,
|
|
8
|
+
React.createElement("link", { rel: "stylesheet", href: require("./../../../resources/css/dynamic/ForwardContent.css") }),
|
|
9
|
+
React.createElement("div", { className: "orig" },
|
|
10
|
+
React.createElement("div", { className: "orig-container", id: "orig-container" },
|
|
11
|
+
React.createElement(Account, { data: data }),
|
|
12
|
+
React.createElement(Content, { data: data })))));
|
|
13
|
+
var ForwardContent$1 = ForwardContent;
|
|
14
|
+
|
|
15
|
+
export { ForwardContent$1 as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
const LogoText = ({ data }) => (React.createElement(React.Fragment, null,
|
|
6
|
+
React.createElement("link", { rel: "stylesheet", href: require('./../../../resources/css/dynamic/LogoText.css') }),
|
|
7
|
+
data.appName === 'bilibili' && (React.createElement("div", { className: "bilibili-logo-text" }, data.category)),
|
|
8
|
+
data.appName === 'weibo' && (React.createElement("div", { className: "weibo-logo-text" }, data.category))));
|
|
9
|
+
|
|
10
|
+
export { LogoText as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Account from './Account.js';
|
|
3
|
+
import Content from './Content.js';
|
|
4
|
+
import ForwardContent from './ForwardContent.js';
|
|
5
|
+
import Footer from './Footer.js';
|
|
6
|
+
import { createRequire } from 'module';
|
|
7
|
+
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
function App({ data }) {
|
|
10
|
+
return (React.createElement(React.Fragment, null,
|
|
11
|
+
React.createElement("link", { rel: "stylesheet", href: `${require('./../../../resources/css/dynamic/MainPage.css')}` }),
|
|
12
|
+
React.createElement("div", { className: "outside-border" },
|
|
13
|
+
React.createElement("div", { className: "container" },
|
|
14
|
+
React.createElement(Account, { data: data }),
|
|
15
|
+
React.createElement("div", { className: "dynamic-article-page-main unfold" },
|
|
16
|
+
React.createElement(Content, { data: data }),
|
|
17
|
+
data.orig && React.createElement(React.Fragment, null,
|
|
18
|
+
React.createElement(ForwardContent, { data: data.orig.data }))),
|
|
19
|
+
React.createElement(Footer, { data: data })))));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { App as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BOT_NAME, ConfigController } from 'yunzai';
|
|
3
|
+
import Config from '../../utils/config.js';
|
|
4
|
+
import { createRequire } from 'module';
|
|
5
|
+
|
|
6
|
+
const botVersion = ConfigController.package?.version;
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
function App({ data }) {
|
|
9
|
+
return (React.createElement(React.Fragment, null,
|
|
10
|
+
React.createElement("link", { rel: "stylesheet", href: require('./../../../resources/css/help/help.css') }),
|
|
11
|
+
React.createElement("div", { className: "container", id: "container" },
|
|
12
|
+
React.createElement("div", { className: "head_box" },
|
|
13
|
+
React.createElement("div", { className: "id_text" }, "Yuki-Plugin"),
|
|
14
|
+
React.createElement("h2", { className: "day_text" },
|
|
15
|
+
"\u4F7F\u7528\u8BF4\u660E-v",
|
|
16
|
+
Config.getLatestVersion())),
|
|
17
|
+
data.map((val, index) => (React.createElement("div", { className: "data_box", key: index },
|
|
18
|
+
React.createElement("div", { className: "tab_lable" }, val.group),
|
|
19
|
+
React.createElement("div", { className: "list" }, val.list.map((item, itemIndex) => (React.createElement("div", { className: "item", key: itemIndex },
|
|
20
|
+
React.createElement("img", { className: "icon", src: require(`./../../../resources/img/icon/puplic/${item.icon}.png`), alt: item.title }),
|
|
21
|
+
React.createElement("div", { className: "title" },
|
|
22
|
+
React.createElement("div", { className: "text" }, item.title),
|
|
23
|
+
React.createElement("div", { className: "dec" }, item.desc))))))))),
|
|
24
|
+
React.createElement("div", { className: "logo", style: { marginTop: '6px' } },
|
|
25
|
+
"Created By ",
|
|
26
|
+
`${BOT_NAME}-v` + `${botVersion}`,
|
|
27
|
+
" & ",
|
|
28
|
+
React.createElement("span", { className: "yuki-plugin-text-title" }, "yuki-plugin"),
|
|
29
|
+
"-v",
|
|
30
|
+
React.createElement("span", { className: "italic" }, `${Config.getLatestVersion()}`)))));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { App as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const MainPage = (await import('./dynamic/MainPage.js')).default;
|
|
2
|
+
const Help = (await import('./help/Help.js')).default;
|
|
3
|
+
const LoginQrcodePage = (await import('./loginQrcode/Page.js')).default;
|
|
4
|
+
const Version = (await import('./version/Version.js')).default;
|
|
5
|
+
|
|
6
|
+
export { Help, LoginQrcodePage, MainPage, Version };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
function App({ data }) {
|
|
6
|
+
return (React.createElement(React.Fragment, null,
|
|
7
|
+
React.createElement("link", { rel: "stylesheet", href: require("./../../../resources/css/loginQrcode/Page.css") }),
|
|
8
|
+
React.createElement("div", { className: 'container w-96 max-h-96 m-auto text-lg p-5' },
|
|
9
|
+
React.createElement("div", { className: "txt-0 text-center mt-3 mb-3 p-1 text-blue-500" },
|
|
10
|
+
"Created By yuki-plugin",
|
|
11
|
+
React.createElement("br", null),
|
|
12
|
+
"\u626B\u7801\u767B\u5F55B\u7AD9\u83B7\u53D6CK"),
|
|
13
|
+
React.createElement("div", { className: "QrCode m-auto" },
|
|
14
|
+
React.createElement("img", { className: "qr-code w-72 h-72 ml-7", src: data.url, alt: "\u4E8C\u7EF4\u7801" })),
|
|
15
|
+
React.createElement("div", { className: "txt-1 text-center mt-3 mb-3 p-1 text-red-600" },
|
|
16
|
+
"\u514D\u8D23\u58F0\u660E\uFF1Abot\u4EC5\u63D0\u4F9B\u529F\u80FD\u3002",
|
|
17
|
+
React.createElement("br", null),
|
|
18
|
+
"\u5982\u679C\u4E0D\u826F\u4F7F\u7528\u884C\u4E3A\u5BFC\u81F4\u8D26\u53F7\u51FA\u95EE\u9898\u7684\u8BF7\u81EA\u884C\u627F\u62C5\u540E\u679C\u3002"))));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { App as default };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BOT_NAME, ConfigController } from 'yunzai';
|
|
3
|
+
import Config from '../../utils/config.js';
|
|
4
|
+
import { createRequire } from 'module';
|
|
5
|
+
|
|
6
|
+
const botVersion = ConfigController.package?.version;
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
function App({ data }) {
|
|
9
|
+
return (React.createElement(React.Fragment, null,
|
|
10
|
+
React.createElement("link", { rel: "stylesheet", href: require("./../../../resources/css/version/version.css") }),
|
|
11
|
+
React.createElement("div", { className: "container", id: "container" },
|
|
12
|
+
data.map((item, idx) => (React.createElement("div", { key: idx, className: "version-card" },
|
|
13
|
+
React.createElement("div", { className: "title" },
|
|
14
|
+
item.version,
|
|
15
|
+
idx ? '' : ' - 当前版本'),
|
|
16
|
+
React.createElement("div", { className: "content" },
|
|
17
|
+
React.createElement("ul", null, item.data.map((sub, subIdx) => (React.createElement("li", { key: subIdx, dangerouslySetInnerHTML: { __html: sub } })))))))),
|
|
18
|
+
React.createElement("div", { className: "logo", style: { marginTop: '6px' } },
|
|
19
|
+
"Created By ",
|
|
20
|
+
`${BOT_NAME}-v` + `${botVersion}`,
|
|
21
|
+
" & ",
|
|
22
|
+
React.createElement("span", { className: "yuki-plugin-text-title" }, "yuki-plugin"),
|
|
23
|
+
"-v",
|
|
24
|
+
React.createElement("span", { className: "italic" }, `${Config.getLatestVersion()}`)))));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { App as default };
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { useAppStorage, applicationOptions } from 'yunzai';
|
|
3
|
+
import Config from './utils/config.js';
|
|
4
|
+
import * as index$1 from './apps/index.js';
|
|
5
|
+
|
|
6
|
+
const Data = useAppStorage();
|
|
7
|
+
var index = () => {
|
|
8
|
+
return applicationOptions({
|
|
9
|
+
create() {
|
|
10
|
+
let count = 0;
|
|
11
|
+
for (const key in index$1) {
|
|
12
|
+
Data.push(new index$1[key]());
|
|
13
|
+
count++;
|
|
14
|
+
}
|
|
15
|
+
logger.info(chalk.rgb(0, 190, 255)(`-----------------------------------------`));
|
|
16
|
+
logger.info(chalk.rgb(255, 225, 255)(`|优纪插件 ${Config.getLatestVersion()} 初始化~`));
|
|
17
|
+
logger.info(chalk.rgb(255, 245, 255)(`|作者:snowtafir`));
|
|
18
|
+
logger.info(chalk.rgb(255, 225, 255)(`|仓库地址:`));
|
|
19
|
+
logger.info(chalk.rgb(255, 245, 255)(`|https://github.com/snowtafir/yuki-plugin`));
|
|
20
|
+
logger.info(chalk.rgb(0, 190, 255)(`-----------------------------------------`));
|
|
21
|
+
logger.info(chalk.rgb(0, 190, 255)(`★ 优纪插件加载完成,共计加载${count}个app`));
|
|
22
|
+
},
|
|
23
|
+
mounted() {
|
|
24
|
+
return Data;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { index as default };
|