yz-yuki-plugin 2.0.4-6 → 2.0.4-8
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 +1 -0
- package/README.md +4 -0
- package/defaultConfig/bilibili/config.yaml +7 -1
- package/defaultConfig/weibo/config.yaml +7 -1
- package/lib/components/dynamic/Account.js +5 -5
- package/lib/components/dynamic/Content.js +5 -5
- package/lib/components/dynamic/Footer.js +5 -4
- package/lib/components/dynamic/ForwardContent.js +3 -3
- package/lib/components/dynamic/LogoText.js +3 -3
- package/lib/components/dynamic/MainPage.js +3 -3
- package/lib/components/help/Help.js +4 -3
- package/lib/components/loginQrcode/Page.js +3 -3
- package/lib/components/version/Version.js +3 -2
- package/lib/models/bilibili/bilibili.task.js +18 -6
- package/lib/models/weibo/weibo.task.js +18 -6
- package/lib/utils/paths.d.ts +12 -0
- package/lib/utils/paths.js +22 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -196,6 +196,10 @@ https://m.weibo.cn/u/7643376782 # 7643376782 为崩坏星穹铁道博主uid
|
|
|
196
196
|
|
|
197
197
|
有意见或者建议也欢迎提交 [Issues](https://github.com/snowtafir/yuki-plugin/issues) 和 [Pull requests](https://github.com/snowtafir/yuki-plugin/pulls)。
|
|
198
198
|
|
|
199
|
+
> [!TIP]
|
|
200
|
+
> 1. main、main3分支为编译分支,请勿直接在该分支上进行开发,请使用dev、dev3、npm分支进行同步开发,并提交Pull requests。
|
|
201
|
+
> 2. 提交PR后由管理员审核,审核成功并合并后会自动进行github actions编译,最终提交编译好的代码到main、main3分支以及发布到npm。
|
|
202
|
+
|
|
199
203
|
# 🌟 六、license/声明
|
|
200
204
|
- this project is inspired by [trss-xianxin-plugin](https://github.com/snowtafir/xianxin-plugin)
|
|
201
205
|
- 基于 `MIT` 协议开源,但有如下额外限制:
|
|
@@ -37,5 +37,11 @@ pushMsgMode: 1
|
|
|
37
37
|
# 是否启用九宫格样式:默认 1 启用,0 不启用。此为最高优先级,九宫格为动态模式,特定大小/长宽比的图片资源将会动态启用九宫格/四宫格/无宫格样式。
|
|
38
38
|
boxGrid: 1
|
|
39
39
|
|
|
40
|
-
# B
|
|
40
|
+
# B站动态卡片分片截图模式:默认 1 启用 0 不启用。启用,将会推送每条动态的全部内容;不启用,动态内容过长时候将只推送noSplitHeight长度的动态卡片,需关闭宫格模式。
|
|
41
41
|
isSplit: 1
|
|
42
|
+
|
|
43
|
+
# 动态卡片非分片模式下的截图高度,默认7500px(仅填数字,无需填入单位),请勿设置过大或过小。关闭分片截图时生效。
|
|
44
|
+
noSplitHeight: 7500
|
|
45
|
+
|
|
46
|
+
# 动态卡片分页截图高度,默认8000px(仅填数字,无需填入单位),请勿设置过大或过小。启用分片截图时生效。
|
|
47
|
+
splitHeight: 8000
|
|
@@ -37,5 +37,11 @@ pushMsgMode: 1
|
|
|
37
37
|
# 是否启用九宫格样式:默认 1 启用,0 不启用。此为最高优先级,九宫格为动态模式,特定大小/长宽比的图片资源将会动态启用九宫格/四宫格/无宫格样式。
|
|
38
38
|
boxGrid: 1
|
|
39
39
|
|
|
40
|
-
#
|
|
40
|
+
# 微博动态卡片分片截图模式:默认 1 启用 0 不启用。启用,将会推送每条动态的全部内容;不启用,动态内容过长时候将只推送noSplitHeight长度的动态卡片,需关闭宫格模式。
|
|
41
41
|
isSplit: 1
|
|
42
|
+
|
|
43
|
+
# 动态卡片非分片模式下的截图高度,默认7500px(仅填数字,无需填入单位),请勿设置过大或过小。关闭分片截图时生效。
|
|
44
|
+
noSplitHeight: 7500
|
|
45
|
+
|
|
46
|
+
# 动态卡片分页截图高度,默认8000px(仅填数字,无需填入单位),请勿设置过大或过小。启用分片截图时生效。
|
|
47
|
+
splitHeight: 8000
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import LogoText from './LogoText.js';
|
|
3
|
-
import {
|
|
4
|
-
import path from 'path';
|
|
3
|
+
import { createRequire } from '../../utils/paths.js';
|
|
5
4
|
|
|
6
5
|
// Account
|
|
7
6
|
// up账户组件
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
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 AccountCss = require('./../../../resources/css/dynamic/Account.css');
|
|
11
11
|
const Account = ({ data }) => {
|
|
12
12
|
const renderLogo = (logoSrc, className) => (React.createElement("img", { src: logoSrc, className: className, alt: "logo" }));
|
|
13
13
|
return (React.createElement(React.Fragment, null,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import path from 'path';
|
|
2
|
+
import { createRequire } from '../../utils/paths.js';
|
|
4
3
|
|
|
5
4
|
// DynamicContent.tsx
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const ContentBoxGrid4Css = require('./../../resources/css/dynamic/Content.box.grid.4.css');
|
|
7
|
+
const ContentBoxGrid9Css = require('./../../resources/css/dynamic/Content.box.grid.9.css');
|
|
8
|
+
const ContentCss = require('./../../resources/css/dynamic/Content.css');
|
|
9
9
|
const Content = ({ data }) => {
|
|
10
10
|
const picItems = data.pics && (React.createElement("div", { className: 'pic-content' }, data.pics.map((item, index) => {
|
|
11
11
|
if (item) {
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ConfigController, BOT_NAME } from 'yunzai';
|
|
3
3
|
import Config from '../../utils/config.js';
|
|
4
|
-
import { _paths } from '../../utils/paths.js';
|
|
5
4
|
import path from 'path';
|
|
5
|
+
import { _paths, createRequire } from '../../utils/paths.js';
|
|
6
6
|
|
|
7
7
|
// Footer.tsx
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
8
9
|
const botVersion = ConfigController.package?.version;
|
|
9
10
|
const yukiPluginVersion = Config.getPackageJsonKey('version', path.join(_paths.pluginPath, 'package.json'));
|
|
10
|
-
const bilibililogo =
|
|
11
|
-
const weibilogo =
|
|
12
|
-
const FooterCss =
|
|
11
|
+
const bilibililogo = require('./../../../resources/img/icon/dynamic/bilibili.svg');
|
|
12
|
+
const weibilogo = require('./../../../resources/img/icon/dynamic/weibo.svg');
|
|
13
|
+
const FooterCss = require('./../../../resources/css/dynamic/Footer.css');
|
|
13
14
|
const Footer = ({ data }) => {
|
|
14
15
|
return (React.createElement(React.Fragment, null,
|
|
15
16
|
React.createElement("link", { rel: "stylesheet", href: FooterCss }),
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Account from './Account.js';
|
|
3
3
|
import Content from './Content.js';
|
|
4
|
-
import {
|
|
5
|
-
import path from 'path';
|
|
4
|
+
import { createRequire } from '../../utils/paths.js';
|
|
6
5
|
|
|
7
6
|
// ForwardContent
|
|
8
7
|
// 转发动态内容组件
|
|
9
|
-
const
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
const ForwardContentCss = require('./../../../resources/css/dynamic/ForwardContent.css');
|
|
10
10
|
const ForwardContent = ({ data }) => (React.createElement(React.Fragment, null,
|
|
11
11
|
React.createElement("link", { rel: "stylesheet", href: ForwardContentCss }),
|
|
12
12
|
React.createElement("div", { className: "orig" },
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import path from 'path';
|
|
2
|
+
import { createRequire } from '../../utils/paths.js';
|
|
4
3
|
|
|
5
4
|
// LogoText
|
|
6
5
|
// Logo 文本组件
|
|
7
|
-
const
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
const LogoTextCss = require('./../../../resources/css/dynamic/LogoText.css');
|
|
8
8
|
const LogoText = ({ data }) => (React.createElement(React.Fragment, null,
|
|
9
9
|
React.createElement("link", { rel: "stylesheet", href: LogoTextCss }),
|
|
10
10
|
data.appName === 'bilibili' && (React.createElement("div", { className: "bilibili-logo-text" }, data.category)),
|
|
@@ -3,11 +3,11 @@ import Account from './Account.js';
|
|
|
3
3
|
import Content from './Content.js';
|
|
4
4
|
import ForwardContent from './ForwardContent.js';
|
|
5
5
|
import Footer from './Footer.js';
|
|
6
|
-
import {
|
|
7
|
-
import path from 'path';
|
|
6
|
+
import { createRequire } from '../../utils/paths.js';
|
|
8
7
|
|
|
9
8
|
// MainPage.tsx
|
|
10
|
-
const
|
|
9
|
+
const require = createRequire(import.meta.url);
|
|
10
|
+
const MainPageCss = require('./../../resources/css/dynamic/MainPage.css');
|
|
11
11
|
function App({ data }) {
|
|
12
12
|
return (React.createElement(React.Fragment, null,
|
|
13
13
|
React.createElement("link", { rel: "stylesheet", href: MainPageCss }),
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BOT_NAME, ConfigController } from 'yunzai';
|
|
3
3
|
import Config from '../../utils/config.js';
|
|
4
|
-
import { _paths } from '../../utils/paths.js';
|
|
5
4
|
import path from 'path';
|
|
5
|
+
import { _paths, createRequire } from '../../utils/paths.js';
|
|
6
6
|
|
|
7
7
|
//help.tsx
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
8
9
|
const botVersion = ConfigController.package?.version;
|
|
9
10
|
const yukiPluginVersion = Config.getPackageJsonKey('version', path.join(_paths.pluginPath, 'package.json'));
|
|
10
|
-
const HelpCss =
|
|
11
|
-
const iconPath = (iconName) =>
|
|
11
|
+
const HelpCss = require('./../../../resources/css/help/help.css');
|
|
12
|
+
const iconPath = (iconName) => require(`./../../../resources/img/icon/puplic/${iconName}.png`);
|
|
12
13
|
function App({ data }) {
|
|
13
14
|
return (React.createElement(React.Fragment, null,
|
|
14
15
|
React.createElement("link", { rel: "stylesheet", href: HelpCss }),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import path from 'path';
|
|
2
|
+
import { createRequire } from '../../utils/paths.js';
|
|
4
3
|
|
|
5
4
|
// QrcodeLoginPage.tsx
|
|
6
|
-
const
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const LoginQrcodeCss = require('./../../../resources/css/loginQrcode/Page.css');
|
|
7
7
|
function App({ data }) {
|
|
8
8
|
return (React.createElement(React.Fragment, null,
|
|
9
9
|
React.createElement("link", { rel: "stylesheet", href: LoginQrcodeCss }),
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BOT_NAME, ConfigController } from 'yunzai';
|
|
3
3
|
import Config from '../../utils/config.js';
|
|
4
|
-
import { _paths } from '../../utils/paths.js';
|
|
5
4
|
import path from 'path';
|
|
5
|
+
import { _paths, createRequire } from '../../utils/paths.js';
|
|
6
6
|
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
7
8
|
const botVersion = ConfigController.package?.version;
|
|
8
9
|
const yukiPluginVersion = Config.getPackageJsonKey('version', path.join(_paths.pluginPath, 'package.json'));
|
|
9
|
-
const VersionCss =
|
|
10
|
+
const VersionCss = require('./../../../resources/css/version/version.css');
|
|
10
11
|
function App({ data }) {
|
|
11
12
|
return (React.createElement(React.Fragment, null,
|
|
12
13
|
React.createElement("link", { rel: "stylesheet", href: VersionCss }),
|
|
@@ -26,7 +26,7 @@ class BiliTask {
|
|
|
26
26
|
else if (resjson.code === -352) {
|
|
27
27
|
await postGateway(cookie);
|
|
28
28
|
if (count < 3) {
|
|
29
|
-
await
|
|
29
|
+
await this.randomDelay(2000, 8000); // 随机延时2-8秒
|
|
30
30
|
await this.hendleEventDynamicData(uid, count + 1);
|
|
31
31
|
logger.error(`获取 ${uid} 动态,Gateway count:${String(count)}`);
|
|
32
32
|
}
|
|
@@ -58,6 +58,7 @@ class BiliTask {
|
|
|
58
58
|
* @param lastLiveStatus 最后直播状态
|
|
59
59
|
*/
|
|
60
60
|
async processBiliData(biliPushData, uidMap, dynamicList, lastLiveStatus) {
|
|
61
|
+
const requestedDataOfUids = new Map(); // 存放已请求的 uid 映射
|
|
61
62
|
for (let chatType in biliPushData) { // 遍历 group 和 private
|
|
62
63
|
if (!uidMap.has(chatType)) {
|
|
63
64
|
uidMap.set(chatType, new Map());
|
|
@@ -69,7 +70,15 @@ class BiliTask {
|
|
|
69
70
|
if (!lastLiveStatus[subInfoOfup.uid]) {
|
|
70
71
|
lastLiveStatus[subInfoOfup.uid] = 0;
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
let resp;
|
|
74
|
+
// 检查是否已经请求过该 uid
|
|
75
|
+
if (requestedDataOfUids.has(subInfoOfup.uid)) {
|
|
76
|
+
resp = requestedDataOfUids.get(subInfoOfup.uid); // 从已请求的映射中获取响应数据
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
resp = await this.hendleEventDynamicData(subInfoOfup.uid);
|
|
80
|
+
requestedDataOfUids.set(subInfoOfup.uid, resp); // 将响应数据存储到映射中
|
|
81
|
+
}
|
|
73
82
|
if (resp) {
|
|
74
83
|
if (resp.code === 0) {
|
|
75
84
|
const dynamicData = resp.data?.items || [];
|
|
@@ -92,10 +101,11 @@ class BiliTask {
|
|
|
92
101
|
const bot_id = subInfoOfup.bot_id || [];
|
|
93
102
|
const { name, type } = subInfoOfup;
|
|
94
103
|
chatTypeMap.set(subInfoOfup.uid, { chatIds, bot_id, upName: name, type });
|
|
95
|
-
await
|
|
104
|
+
await this.randomDelay(1000, 4000); // 随机延时1-4秒
|
|
96
105
|
}
|
|
97
106
|
}
|
|
98
107
|
}
|
|
108
|
+
requestedDataOfUids.clear(); // 清空已请求的映射
|
|
99
109
|
}
|
|
100
110
|
/**
|
|
101
111
|
* 推送动态消息
|
|
@@ -137,7 +147,7 @@ class BiliTask {
|
|
|
137
147
|
if (type && type.length && !type.includes(pushDynamicData.type))
|
|
138
148
|
continue; // 如果禁用了某类型的动态推送,跳过当前循环
|
|
139
149
|
await this.sendDynamic(chatId, bot_id, upName, pushDynamicData, biliConfigData, chatType); // 发送动态消息
|
|
140
|
-
await
|
|
150
|
+
await this.randomDelay(1000, 2000); // 随机延时1-2秒
|
|
141
151
|
}
|
|
142
152
|
}
|
|
143
153
|
}
|
|
@@ -168,7 +178,8 @@ class BiliTask {
|
|
|
168
178
|
}
|
|
169
179
|
let boxGrid = !!biliConfigData.boxGrid === false ? false : true; // 是否启用九宫格样式,默认为 true
|
|
170
180
|
let isSplit = !!biliConfigData.isSplit === false ? false : true; // 是否启用分片截图,默认为 true
|
|
171
|
-
let style = isSplit ? '' :
|
|
181
|
+
let style = isSplit ? '' : `.unfold { max-height: ${biliConfigData?.noSplitHeight ?? 7500}px; }`; // 不启用分片截图模式的样式
|
|
182
|
+
let splitHeight = biliConfigData?.splitHeight ?? 8000; // 分片截图高度,默认 8000, 单位 px,启用分片截图时生效
|
|
172
183
|
const urlQrcodeData = await QRCode.toDataURL(extentData?.url);
|
|
173
184
|
let renderData = this.buildRenderData(extentData, urlQrcodeData, boxGrid);
|
|
174
185
|
const ScreenshotOptionsData = {
|
|
@@ -181,6 +192,7 @@ class BiliTask {
|
|
|
181
192
|
quality: 98,
|
|
182
193
|
},
|
|
183
194
|
saveHtmlfile: false,
|
|
195
|
+
pageSplitHeight: splitHeight,
|
|
184
196
|
};
|
|
185
197
|
let imgs = await this.renderDynamicCard(uid, renderData, ScreenshotOptionsData);
|
|
186
198
|
if (!imgs)
|
|
@@ -190,7 +202,7 @@ class BiliTask {
|
|
|
190
202
|
for (let i = 0; i < imgs.length; i++) {
|
|
191
203
|
const image = imgs[i];
|
|
192
204
|
await this.sendMessage(chatId, bot_id, chatType, Segment.image(image));
|
|
193
|
-
await
|
|
205
|
+
await this.randomDelay(1000, 2000); // 随机延时1-2秒
|
|
194
206
|
}
|
|
195
207
|
await new Promise((resolve) => setTimeout(resolve, 1000)); // 休眠1秒
|
|
196
208
|
}
|
|
@@ -32,6 +32,7 @@ class WeiboTask {
|
|
|
32
32
|
* @param dynamicList 动态列表
|
|
33
33
|
*/
|
|
34
34
|
async processWeiboData(weiboPushData, uidMap, dynamicList) {
|
|
35
|
+
const requestedDataOfUids = new Map(); // 存放已请求的 uid 映射
|
|
35
36
|
for (let chatType in weiboPushData) { // 遍历 group 和 private
|
|
36
37
|
if (!uidMap.has(chatType)) {
|
|
37
38
|
uidMap.set(chatType, new Map());
|
|
@@ -40,7 +41,15 @@ class WeiboTask {
|
|
|
40
41
|
for (let chatId in weiboPushData[chatType]) {
|
|
41
42
|
const subUpsOfChat = Array.prototype.slice.call(weiboPushData[chatType][chatId] || []);
|
|
42
43
|
for (let subInfoOfup of subUpsOfChat) {
|
|
43
|
-
|
|
44
|
+
let resp;
|
|
45
|
+
// 检查是否已经请求过该 uid
|
|
46
|
+
if (requestedDataOfUids.has(subInfoOfup.uid)) {
|
|
47
|
+
resp = requestedDataOfUids.get(subInfoOfup.uid); // 从已请求的映射中获取响应数据
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
resp = await await new WeiboGetWebData().getBloggerDynamicList(subInfoOfup.uid); // 获取指定 uid 的动态列表
|
|
51
|
+
requestedDataOfUids.set(subInfoOfup.uid, resp); // 将响应数据存储到映射中
|
|
52
|
+
}
|
|
44
53
|
if (resp) {
|
|
45
54
|
const dynamicData = resp || [];
|
|
46
55
|
dynamicList[subInfoOfup.uid] = dynamicData;
|
|
@@ -53,6 +62,7 @@ class WeiboTask {
|
|
|
53
62
|
}
|
|
54
63
|
}
|
|
55
64
|
}
|
|
65
|
+
requestedDataOfUids.clear(); // 清空已请求的映射
|
|
56
66
|
}
|
|
57
67
|
/**
|
|
58
68
|
* 推送动态消息
|
|
@@ -95,7 +105,7 @@ class WeiboTask {
|
|
|
95
105
|
if (type && type.length && !type.includes(pushDynamicData.type))
|
|
96
106
|
continue; // 如果禁用了某类型的动态推送,跳过当前循环
|
|
97
107
|
await this.sendDynamic(chatId, bot_id, upName, pushDynamicData, weiboConfigData, chatType); // 发送动态消息
|
|
98
|
-
await this.randomDelay(
|
|
108
|
+
await this.randomDelay(1000, 2000); // 随机延时1-2秒
|
|
99
109
|
}
|
|
100
110
|
}
|
|
101
111
|
}
|
|
@@ -133,7 +143,8 @@ class WeiboTask {
|
|
|
133
143
|
}
|
|
134
144
|
let boxGrid = !!weiboConfigData.boxGrid === false ? false : true; // 是否启用九宫格样式,默认为 true
|
|
135
145
|
let isSplit = !!weiboConfigData.isSplit === false ? false : true; // 是否启用分片截图,默认为 true
|
|
136
|
-
let style = isSplit ? '' :
|
|
146
|
+
let style = isSplit ? '' : `.unfold { max-height: ${weiboConfigData?.noSplitHeight ?? 7500}px; }`; // 不启用分片截图模式的样式
|
|
147
|
+
let splitHeight = weiboConfigData?.splitHeight ?? 8000; // 分片截图高度,默认 8000, 单位 px,启用分片截图时生效
|
|
137
148
|
const extentData = { ...data };
|
|
138
149
|
const urlQrcodeData = await QRCode.toDataURL(extentData?.url);
|
|
139
150
|
let renderData = this.buildRenderData(extentData, urlQrcodeData, boxGrid);
|
|
@@ -147,6 +158,7 @@ class WeiboTask {
|
|
|
147
158
|
quality: 98,
|
|
148
159
|
},
|
|
149
160
|
saveHtmlfile: false,
|
|
161
|
+
pageSplitHeight: splitHeight,
|
|
150
162
|
};
|
|
151
163
|
let imgs = await this.renderDynamicCard(uid, renderData, ScreenshotOptionsData);
|
|
152
164
|
if (!imgs)
|
|
@@ -156,9 +168,9 @@ class WeiboTask {
|
|
|
156
168
|
for (let i = 0; i < imgs.length; i++) {
|
|
157
169
|
const image = imgs[i];
|
|
158
170
|
await this.sendMessage(chatId, bot_id, chatType, Segment.image(image));
|
|
159
|
-
await this.randomDelay(
|
|
171
|
+
await this.randomDelay(1000, 2000); // 随机延时1-2秒
|
|
160
172
|
}
|
|
161
|
-
await
|
|
173
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
162
174
|
}
|
|
163
175
|
else {
|
|
164
176
|
const dynamicMsg = await WeiboQuery.formatTextDynamicData(upName, pushDynamicData, false, weiboConfigData); //构建文字动态消息
|
|
@@ -173,7 +185,7 @@ class WeiboTask {
|
|
|
173
185
|
}
|
|
174
186
|
}
|
|
175
187
|
await this.sendMessage(chatId, bot_id, chatType, dynamicMsg);
|
|
176
|
-
await
|
|
188
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
177
189
|
}
|
|
178
190
|
}
|
|
179
191
|
/**
|
package/lib/utils/paths.d.ts
CHANGED
|
@@ -8,3 +8,15 @@ export declare const _paths: {
|
|
|
8
8
|
pluginResources: string;
|
|
9
9
|
pluginName: string;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* 使用import.meta.url得到require
|
|
13
|
+
* @param basePath
|
|
14
|
+
* @returns
|
|
15
|
+
* 这并不是
|
|
16
|
+
* ***
|
|
17
|
+
* import { createRequire } from "module"
|
|
18
|
+
* ***
|
|
19
|
+
* 原型为
|
|
20
|
+
* new URL(path, import.meta.url).href
|
|
21
|
+
*/
|
|
22
|
+
export declare const createRequire: (basePath: string) => (path: string) => string;
|
package/lib/utils/paths.js
CHANGED
|
@@ -14,5 +14,26 @@ const _paths = {
|
|
|
14
14
|
pluginResources: join(pluginPath, 'resources'), // yuki-plugin资源目录
|
|
15
15
|
pluginName, // 插件所在文件夹名称
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* 使用import.meta.url得到require
|
|
19
|
+
* @param basePath
|
|
20
|
+
* @returns
|
|
21
|
+
* 这并不是
|
|
22
|
+
* ***
|
|
23
|
+
* import { createRequire } from "module"
|
|
24
|
+
* ***
|
|
25
|
+
* 原型为
|
|
26
|
+
* new URL(path, import.meta.url).href
|
|
27
|
+
*/
|
|
28
|
+
const createRequire = (basePath) => {
|
|
29
|
+
return (path) => {
|
|
30
|
+
if (process.platform === 'linux' || process.platform === 'android' || process.platform === 'darwin') {
|
|
31
|
+
return new URL(path, basePath).href.replace(/^file:\/\//, '');
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return new URL(path, basePath).href.replace(/^file:\/\/\//, ''); // windows
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
};
|
|
17
38
|
|
|
18
|
-
export { _paths, pluginName };
|
|
39
|
+
export { _paths, createRequire, pluginName };
|