koishi-plugin-bilibili-notify 3.0.0-alpha.14 → 3.0.0-alpha.15
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/lib/biliAPI.d.ts +0 -1
- package/lib/biliAPI.js +0 -4
- package/lib/comRegister.js +4 -3
- package/lib/generateImg.js +34 -16
- package/package.json +1 -1
- package/readme.md +1 -0
package/lib/biliAPI.d.ts
CHANGED
package/lib/biliAPI.js
CHANGED
|
@@ -16,7 +16,6 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
16
16
|
const tough_cookie_1 = require("tough-cookie");
|
|
17
17
|
const axios_cookiejar_support_1 = require("axios-cookiejar-support");
|
|
18
18
|
const jsdom_1 = require("jsdom");
|
|
19
|
-
const luxon_1 = require("luxon");
|
|
20
19
|
const retry_1 = __importDefault(require("./utils/retry"));
|
|
21
20
|
const mixinKeyEncTab = [
|
|
22
21
|
46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49,
|
|
@@ -297,9 +296,6 @@ class BiliAPI extends koishi_1.Service {
|
|
|
297
296
|
},
|
|
298
297
|
}));
|
|
299
298
|
}
|
|
300
|
-
getTimeOfUTC8() {
|
|
301
|
-
return Math.floor(luxon_1.DateTime.now().setZone("UTC+8").toSeconds());
|
|
302
|
-
}
|
|
303
299
|
getCookies() {
|
|
304
300
|
const cookies = JSON.stringify(this.jar.serializeSync().cookies);
|
|
305
301
|
return cookies;
|
package/lib/comRegister.js
CHANGED
|
@@ -695,8 +695,8 @@ class ComRegister {
|
|
|
695
695
|
this.checkIfDynamicDetectIsNeeded();
|
|
696
696
|
// 在控制台中显示订阅对象
|
|
697
697
|
this.updateSubNotifier();
|
|
698
|
-
// Test
|
|
699
|
-
const testTarget = [
|
|
698
|
+
/* // Test
|
|
699
|
+
const testTarget: Target = [
|
|
700
700
|
{
|
|
701
701
|
channelIdArr: [
|
|
702
702
|
{
|
|
@@ -710,8 +710,9 @@ class ComRegister {
|
|
|
710
710
|
platform: "qqguild",
|
|
711
711
|
},
|
|
712
712
|
];
|
|
713
|
+
|
|
713
714
|
const buffer = await this.ctx.gi.generateWordCloudImg();
|
|
714
|
-
this.sendMsg(testTarget,
|
|
715
|
+
this.sendMsg(testTarget, h.image(buffer, "image/png")); */
|
|
715
716
|
}
|
|
716
717
|
splitMultiPlatformStr(str) {
|
|
717
718
|
return str
|
package/lib/generateImg.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const koishi_1 = require("koishi");
|
|
4
|
+
const luxon_1 = require("luxon");
|
|
4
5
|
const node_path_1 = require("node:path");
|
|
5
6
|
const node_url_1 = require("node:url");
|
|
6
7
|
// 动态类型
|
|
@@ -1487,22 +1488,39 @@ class GenerateImg extends koishi_1.Service {
|
|
|
1487
1488
|
}
|
|
1488
1489
|
async getTimeDifference(dateString) {
|
|
1489
1490
|
// 将日期字符串转换为Date对象
|
|
1490
|
-
const
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
//
|
|
1494
|
-
const
|
|
1495
|
-
//
|
|
1496
|
-
const
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1491
|
+
const apiDateTime = luxon_1.DateTime.fromFormat(dateString, "yyyy-MM-dd HH:mm:ss", {
|
|
1492
|
+
zone: "UTC+8",
|
|
1493
|
+
});
|
|
1494
|
+
// 获取当前时间
|
|
1495
|
+
const currentDateTime = luxon_1.DateTime.now();
|
|
1496
|
+
// 计算时间差
|
|
1497
|
+
const diff = currentDateTime.diff(apiDateTime, [
|
|
1498
|
+
"years",
|
|
1499
|
+
"months",
|
|
1500
|
+
"days",
|
|
1501
|
+
"hours",
|
|
1502
|
+
"minutes",
|
|
1503
|
+
"seconds",
|
|
1504
|
+
]);
|
|
1505
|
+
const { years, months, days, hours, minutes, seconds } = diff.toObject();
|
|
1506
|
+
// 按单位生成可读字符串(过滤零值)
|
|
1507
|
+
const parts = [];
|
|
1508
|
+
if (years !== 0)
|
|
1509
|
+
parts.push(`${Math.abs(years)}年`);
|
|
1510
|
+
if (months !== 0)
|
|
1511
|
+
parts.push(`${Math.abs(months)}个月`);
|
|
1512
|
+
if (days !== 0)
|
|
1513
|
+
parts.push(`${Math.abs(days)}天`);
|
|
1514
|
+
if (hours !== 0)
|
|
1515
|
+
parts.push(`${Math.abs(hours)}小时`);
|
|
1516
|
+
if (minutes !== 0)
|
|
1517
|
+
parts.push(`${Math.abs(minutes)}分`);
|
|
1518
|
+
if (seconds !== 0)
|
|
1519
|
+
parts.push(`${Math.abs(seconds)}秒`);
|
|
1520
|
+
// 处理负值
|
|
1521
|
+
const sign = diff.as("seconds") < 0 ? "" : "-";
|
|
1522
|
+
// 组合结果(如果无差值返回"0秒")
|
|
1523
|
+
return parts.length > 0 ? `${sign}${parts.join("")}` : "0秒";
|
|
1506
1524
|
}
|
|
1507
1525
|
unixTimestampToString(timestamp) {
|
|
1508
1526
|
const date = new Date(timestamp * 1000);
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -226,6 +226,7 @@
|
|
|
226
226
|
- ver 3.0.0-alpha.12 修复:上一版本无法安装
|
|
227
227
|
- ver 3.0.0-alpha.13 优化:将ESLint替换为Biome; 修复:增加弹幕词云功能产生的bug; 禁用:弹幕词云功能并不能正常运作,暂时将该功能禁用
|
|
228
228
|
- ver 3.0.0-alpha.14 优化:移除不需要的服务
|
|
229
|
+
- ver 3.0.0-alpha.15 修复:启动插件提示发送群组消息失败、直播推送时间显示为负数(不用再特别设置系统时区为UTC+8)
|
|
229
230
|
|
|
230
231
|
## 交流群
|
|
231
232
|
|