koishi-plugin-rocom 1.0.18 → 1.0.24
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/announcement-service.d.ts +21 -0
- package/lib/announcement-service.js +63 -0
- package/lib/async-control.d.ts +3 -0
- package/lib/async-control.js +48 -0
- package/lib/atlas-service.js +1 -1
- package/lib/client.d.ts +58 -7
- package/lib/client.js +282 -127
- package/lib/commands/egg.js +66 -4
- package/lib/commands/merchant.d.ts +105 -0
- package/lib/commands/merchant.js +600 -182
- package/lib/commands/query.d.ts +18 -0
- package/lib/commands/query.js +585 -145
- package/lib/commands/ranking.d.ts +2 -0
- package/lib/commands/ranking.js +31 -0
- package/lib/commands/share-code.d.ts +2 -0
- package/lib/commands/share-code.js +111 -0
- package/lib/commands/tools.js +48 -60
- package/lib/commands/wiki.js +1 -1
- package/lib/egg-service.d.ts +82 -8
- package/lib/egg-service.js +235 -19
- package/lib/element-colors.d.ts +3 -0
- package/lib/element-colors.js +34 -0
- package/lib/icon-metrics.d.ts +32 -0
- package/lib/icon-metrics.js +255 -0
- package/lib/img//345/274/202/350/211/262.png +0 -0
- package/lib/img//347/202/253/345/275/251.png +0 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +11857 -175
- package/lib/merchant-catalog.d.ts +47 -0
- package/lib/merchant-catalog.js +193 -0
- package/lib/merchant-clock.d.ts +22 -0
- package/lib/merchant-clock.js +95 -0
- package/lib/merchant-price-log.d.ts +63 -0
- package/lib/merchant-price-log.js +187 -0
- package/lib/merchant-service.d.ts +38 -0
- package/lib/merchant-service.js +216 -0
- package/lib/permissions.d.ts +16 -0
- package/lib/permissions.js +66 -0
- package/lib/pet-data-service.d.ts +13 -0
- package/lib/pet-data-service.js +117 -10
- package/lib/pet-size.d.ts +13 -0
- package/lib/pet-size.js +54 -0
- package/lib/player-service.d.ts +37 -0
- package/lib/player-service.js +201 -0
- package/lib/ranking-service.d.ts +46 -0
- package/lib/ranking-service.js +137 -0
- package/lib/render-templates/announcement/detail.html +8 -0
- package/lib/render-templates/announcement/list.html +5 -0
- package/lib/render-templates/announcement/style.css +1 -0
- package/lib/render-templates/home/style.css +15 -14
- package/lib/render-templates/home-pets/index.html +80 -0
- package/lib/render-templates/home-pets/style.css +338 -0
- package/lib/render-templates/pet-detail-classic/index.html +151 -0
- package/lib/render-templates/pet-detail-classic/style.css +503 -0
- package/lib/render-templates/pet-detail-classic/texture2D/a_title.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/bg.jpg +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/footer.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/icon.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/img_head.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/jinhua_bg.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/level_icon.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/line.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/mask_bar.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/pet_bg.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/pet_rocom.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/pet_rocom_bg.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/poro_bar.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/right_jinhua.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/skill_bg.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/skill_mask.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/star.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/star_1.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/star_8.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/star_9.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/table.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/tags.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/title.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/top_bg.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/xuancai_overlay.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/yise_overlay.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/ys_bar.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/10.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/11.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/12.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/13.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/14.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/15.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/16.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/17.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/18.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/19.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/2.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/20.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/23.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/3.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/4.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/5.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/6.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/8.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/9.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//345/205/211.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//345/206/260.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//345/234/260.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//345/271/273.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//345/271/275.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//346/201/266.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//346/227/240.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//346/231/256/351/200/232.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//346/234/272/346/242/260.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//346/255/246.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//346/257/222.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//346/260/264.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//347/201/253.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//347/224/265.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//347/277/274.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//350/215/211.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//350/220/214.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//350/231/253.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//351/276/231.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/1.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/10.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/11.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/12.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/13.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/14.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/15.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/16.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/17.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/18.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/19.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/2.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/21.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/23.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/24.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/3.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/4.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/5.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/6.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/7.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/8.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/9.png +0 -0
- package/lib/render-templates/pet-ranking/index.html +99 -0
- package/lib/render-templates/pet-ranking/style.css +338 -0
- package/lib/render-templates/player-search/index.html +7 -0
- package/lib/render-templates/searcheggs/index.html +1 -1
- package/lib/render-templates/searcheggs/size.html +70 -68
- package/lib/render-templates/share-code-classic/assets/eit-logo.png +0 -0
- package/lib/render-templates/share-code-classic/assets/img_xingxingdi.png +0 -0
- package/lib/render-templates/share-code-classic/assets/roco_icon.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/255/227/344/275/223/Rocofontblack-Regular .ttf +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//345/205/211.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//345/206/260.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//345/234/260.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//345/271/273.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//345/271/275.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//346/201/266.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//346/227/240.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//346/231/256/351/200/232.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//346/234/272/346/242/260.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//346/255/246.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//346/257/222.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//346/260/264.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//347/201/253.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//347/224/265.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//347/277/274.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//350/215/211.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//350/220/214.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//350/231/253.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//351/276/231.png +0 -0
- package/lib/render-templates/share-code-classic/assets//347/201/253/346/274/206/345/215/260.png +0 -0
- package/lib/render-templates/share-code-classic/assets//347/253/213/347/273/230/350/203/214/346/231/257/346/241/206.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//345/205/211.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//345/206/260.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//345/234/260.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//345/245/207/345/274/202.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//345/271/273.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//345/271/275.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//346/201/266.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//346/231/256/351/200/232.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//346/234/272/346/242/260.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//346/255/246.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//346/257/222.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//346/260/264.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//346/261/241/346/237/223.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//347/201/253.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//347/224/265.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//347/277/274.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//350/215/211.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//350/220/214.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//350/231/253.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//351/246/226/351/242/206.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//351/276/231.png +0 -0
- package/lib/render-templates/share-code-classic/index.html +119 -0
- package/lib/render-templates/share-code-classic/style.css +646 -0
- package/lib/render-templates/share-code-team/index.html +105 -0
- package/lib/render-templates/share-code-team/style.css +345 -0
- package/lib/render-templates/yuanxing-shangren/merchant.html +479 -461
- package/lib/render-templates/yuanxing-shangren/today.html +407 -461
- package/lib/render.d.ts +18 -2
- package/lib/render.js +138 -39
- package/lib/send-image.d.ts +1 -1
- package/lib/send-image.js +22 -1
- package/lib/share-code-service.d.ts +68 -0
- package/lib/share-code-service.js +257 -0
- package/lib/subscription-runner.d.ts +6 -0
- package/lib/subscription-runner.js +21 -0
- package/lib/subscription-send.d.ts +4 -2
- package/lib/subscription-send.js +45 -20
- package/lib/ttf/rocom_origin.ttf +0 -0
- package/lib/types.d.ts +14 -1
- package/lib/user.d.ts +11 -0
- package/lib/wiki-catalog.js +1 -1
- package/lib/wiki-service.js +1 -1
- package/package.json +5 -1
- package/readme.md +125 -124
- package/lib/ttf/rocom_skill_origin.ttf +0 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SHARE_CODE_MAX_LENGTH = void 0;
|
|
4
|
+
exports.extractShareCode = extractShareCode;
|
|
5
|
+
exports.parsedRecord = parsedRecord;
|
|
6
|
+
exports.buildShareCodeView = buildShareCodeView;
|
|
7
|
+
exports.buildShareCodeText = buildShareCodeText;
|
|
8
|
+
exports.parseNaturePair = parseNaturePair;
|
|
9
|
+
exports.buildShareCodeClassicView = buildShareCodeClassicView;
|
|
10
|
+
const client_1 = require("./client");
|
|
11
|
+
const player_service_1 = require("./player-service");
|
|
12
|
+
const element_colors_1 = require("./element-colors");
|
|
13
|
+
exports.SHARE_CODE_MAX_LENGTH = 16 * 1024;
|
|
14
|
+
function extractShareCode(input) {
|
|
15
|
+
const raw = String(input ?? '').trim().replace(/^[`"']+|[`"']+$/g, '');
|
|
16
|
+
if (!raw)
|
|
17
|
+
return '';
|
|
18
|
+
if (raw.length > exports.SHARE_CODE_MAX_LENGTH)
|
|
19
|
+
throw new Error('分享码内容过长');
|
|
20
|
+
const match = /(?:[?&#]|^)share(?:Data|_data|_code)=([^&#\s]+)/i.exec(raw);
|
|
21
|
+
if (!match) {
|
|
22
|
+
if (/^https?:\/\//i.test(raw))
|
|
23
|
+
throw new Error('链接中没有分享码参数');
|
|
24
|
+
return raw;
|
|
25
|
+
}
|
|
26
|
+
let value = match[1];
|
|
27
|
+
for (let i = 0; i < 2; i++) {
|
|
28
|
+
let decoded;
|
|
29
|
+
try {
|
|
30
|
+
decoded = decodeURIComponent(value);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
throw new Error('分享码链接的编码不完整');
|
|
34
|
+
}
|
|
35
|
+
if (decoded === value)
|
|
36
|
+
break;
|
|
37
|
+
value = decoded;
|
|
38
|
+
}
|
|
39
|
+
return value.trim().replace(/^[`"']+|[`"']+$/g, '');
|
|
40
|
+
}
|
|
41
|
+
// 避免对已存解析对象重复发 POST。
|
|
42
|
+
function parsedRecord(record) {
|
|
43
|
+
for (const candidate of [record?.share_code, record?.parsed, record]) {
|
|
44
|
+
if (candidate && typeof candidate === 'object' && Array.isArray(candidate.teams)) {
|
|
45
|
+
return candidate;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
function toInt(value, fallback = 0) {
|
|
51
|
+
const n = Number(value);
|
|
52
|
+
return Number.isFinite(n) ? Math.trunc(n) : fallback;
|
|
53
|
+
}
|
|
54
|
+
function text(value, fallback = '') {
|
|
55
|
+
if (value === null || value === undefined)
|
|
56
|
+
return fallback;
|
|
57
|
+
const s = String(value).trim();
|
|
58
|
+
return s || fallback;
|
|
59
|
+
}
|
|
60
|
+
function formatTime(value) {
|
|
61
|
+
const raw = text(value);
|
|
62
|
+
if (!raw)
|
|
63
|
+
return '';
|
|
64
|
+
const normalized = /^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/.test(raw) && !/(Z|[+-]\d{2}:?\d{2})$/.test(raw)
|
|
65
|
+
? `${raw.replace(' ', 'T')}+08:00`
|
|
66
|
+
: raw.replace('Z', '+00:00');
|
|
67
|
+
const date = new Date(normalized);
|
|
68
|
+
if (Number.isNaN(date.getTime()))
|
|
69
|
+
return raw;
|
|
70
|
+
const shifted = new Date(date.getTime() + 8 * 3600_000);
|
|
71
|
+
const pad = (v) => String(v).padStart(2, '0');
|
|
72
|
+
return `${shifted.getUTCFullYear()}-${pad(shifted.getUTCMonth() + 1)}-${pad(shifted.getUTCDate())} ${pad(shifted.getUTCHours())}:${pad(shifted.getUTCMinutes())}`;
|
|
73
|
+
}
|
|
74
|
+
function normalizeUrl(value, baseUrl) {
|
|
75
|
+
return (0, player_service_1.resourceUrl)(value, baseUrl);
|
|
76
|
+
}
|
|
77
|
+
function wikiAssetUrl(baseUrl, path) {
|
|
78
|
+
if (!baseUrl)
|
|
79
|
+
return path;
|
|
80
|
+
return `${String(baseUrl).replace(/\/$/, '')}${path}`;
|
|
81
|
+
}
|
|
82
|
+
function normalizeNamedIcon(value, emptyName, baseUrl) {
|
|
83
|
+
const item = (0, client_1.isObject)(value) ? value : {};
|
|
84
|
+
const id = toInt(item.id);
|
|
85
|
+
return {
|
|
86
|
+
id,
|
|
87
|
+
name: text(item.name, emptyName),
|
|
88
|
+
icon: normalizeUrl(item.icon, baseUrl),
|
|
89
|
+
configured: Boolean(id || text(item.name) || text(item.icon)),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function normalizeTeam(value, index, baseUrl) {
|
|
93
|
+
const team = (0, client_1.isObject)(value) ? value : {};
|
|
94
|
+
const pet = normalizeNamedIcon(team.pet, '未配置精灵', baseUrl);
|
|
95
|
+
if (pet.id)
|
|
96
|
+
pet.icon = wikiAssetUrl(baseUrl, `/api/v1/resources/wiki/assets/pets/${pet.id}/icon.png`);
|
|
97
|
+
const bloodline = normalizeNamedIcon(team.bloodline, '未配置血脉', baseUrl);
|
|
98
|
+
const personality = normalizeNamedIcon(team.personality, '未配置性格', baseUrl);
|
|
99
|
+
const ivs = [];
|
|
100
|
+
for (const raw of Array.isArray(team.ivs_detail) ? team.ivs_detail : []) {
|
|
101
|
+
ivs.push(normalizeNamedIcon(raw, '未配置', baseUrl));
|
|
102
|
+
}
|
|
103
|
+
while (ivs.length < 3)
|
|
104
|
+
ivs.push(normalizeNamedIcon(null, '未配置', baseUrl));
|
|
105
|
+
const skills = [];
|
|
106
|
+
for (const raw of Array.isArray(team.skills) ? team.skills : []) {
|
|
107
|
+
const skill = normalizeNamedIcon(raw, '未配置技能', baseUrl);
|
|
108
|
+
if (skill.id)
|
|
109
|
+
skill.icon = wikiAssetUrl(baseUrl, `/api/v1/resources/wiki/assets/skills/${skill.id}.png`);
|
|
110
|
+
skills.push(skill);
|
|
111
|
+
}
|
|
112
|
+
while (skills.length < 4)
|
|
113
|
+
skills.push(normalizeNamedIcon(null, '未配置技能', baseUrl));
|
|
114
|
+
return {
|
|
115
|
+
slot: toInt(team.slot, index + 1),
|
|
116
|
+
pet,
|
|
117
|
+
// 精灵属性名列表,供信笺风模板显示属性图标。
|
|
118
|
+
typeNames: (Array.isArray(team.pet?.type_names) ? team.pet.type_names : [])
|
|
119
|
+
.map((item) => String(item ?? '').trim())
|
|
120
|
+
.filter(Boolean),
|
|
121
|
+
bloodline,
|
|
122
|
+
personality,
|
|
123
|
+
ivs: ivs.slice(0, 3),
|
|
124
|
+
skills: skills.slice(0, 4),
|
|
125
|
+
empty: !pet.configured,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function unwrapRecord(record) {
|
|
129
|
+
if (!(0, client_1.isObject)(record))
|
|
130
|
+
return { payload: {}, meta: {} };
|
|
131
|
+
if ((0, client_1.isObject)(record.share_code))
|
|
132
|
+
return { payload: record.share_code, meta: record };
|
|
133
|
+
if ((0, client_1.isObject)(record.parsed))
|
|
134
|
+
return { payload: record.parsed, meta: record };
|
|
135
|
+
return { payload: record, meta: {} };
|
|
136
|
+
}
|
|
137
|
+
function shareCodePreview(code) {
|
|
138
|
+
if (code.length <= 36)
|
|
139
|
+
return code;
|
|
140
|
+
return `${code.slice(0, 20)}...${code.slice(-12)}`;
|
|
141
|
+
}
|
|
142
|
+
function buildShareCodeView(payload, source, record, baseUrl = '') {
|
|
143
|
+
let data = (0, client_1.isObject)(payload) ? payload : {};
|
|
144
|
+
let recordMeta = {};
|
|
145
|
+
if (record) {
|
|
146
|
+
const unwrapped = unwrapRecord(record);
|
|
147
|
+
if (!data.teams)
|
|
148
|
+
data = unwrapped.payload;
|
|
149
|
+
recordMeta = unwrapped.meta;
|
|
150
|
+
}
|
|
151
|
+
const teams = (Array.isArray(data.teams) ? data.teams : [])
|
|
152
|
+
.map((item, index) => normalizeTeam(item, index, baseUrl))
|
|
153
|
+
.sort((a, b) => a.slot - b.slot);
|
|
154
|
+
const shareCode = text(data.share_code);
|
|
155
|
+
const mode = normalizeNamedIcon(data.mode, '未知编队模式', baseUrl);
|
|
156
|
+
const magic = normalizeNamedIcon(data.magic, '未配置魔法', baseUrl);
|
|
157
|
+
if (magic.configured && magic.name === '未配置魔法')
|
|
158
|
+
magic.name = `魔法 ${magic.id}`;
|
|
159
|
+
const spriteCount = toInt(data.sprite_count, teams.length);
|
|
160
|
+
return {
|
|
161
|
+
source,
|
|
162
|
+
sourceLabel: source === 'record' ? '历史记录' : '即时解析',
|
|
163
|
+
shareCode,
|
|
164
|
+
shareCodePreview: shareCodePreview(shareCode),
|
|
165
|
+
version: toInt(data.version, 1),
|
|
166
|
+
spriteCount,
|
|
167
|
+
mode,
|
|
168
|
+
magic,
|
|
169
|
+
teams,
|
|
170
|
+
parseCount: toInt(recordMeta.parse_count),
|
|
171
|
+
firstSeen: formatTime(recordMeta.first_seen_at),
|
|
172
|
+
lastSeen: formatTime(recordMeta.last_seen_at),
|
|
173
|
+
shareCodeHash: text(recordMeta.share_code_hash),
|
|
174
|
+
commandHint: '阵容码 解析 <分享码或链接> · 阵容码 查询 <分享码>',
|
|
175
|
+
copyright: 'Koishi & WeGame 洛克王国插件',
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function buildShareCodeText(data) {
|
|
179
|
+
const lines = [
|
|
180
|
+
`阵容码${data.sourceLabel || '解析'}:${data.mode?.name || '未知模式'},共 ${data.spriteCount || 0} 只精灵`,
|
|
181
|
+
];
|
|
182
|
+
for (const team of data.teams || []) {
|
|
183
|
+
const talents = (team.ivs || []).filter((item) => item.configured).map((item) => item.name);
|
|
184
|
+
const skillNames = (team.skills || []).filter((item) => item.configured).map((item) => item.name);
|
|
185
|
+
lines.push(`${team.slot}. ${team.pet.name} | ${team.bloodline.name} | ${team.personality.name} | 天赋:${talents.join('、') || '未配置'} | 技能:${skillNames.join('、') || '未配置'}`);
|
|
186
|
+
}
|
|
187
|
+
if (data.parseCount) {
|
|
188
|
+
lines.push(`解析次数:${data.parseCount},最近记录:${data.lastSeen || '未知'}`);
|
|
189
|
+
}
|
|
190
|
+
return lines.join('\n');
|
|
191
|
+
}
|
|
192
|
+
// 性格摘要解析:兼容「+攻击 -特攻」「攻击↑ 特攻↓」「加攻击/减特攻」等写法。
|
|
193
|
+
function parseNaturePair(summary) {
|
|
194
|
+
const text = String(summary ?? '');
|
|
195
|
+
const upMatch = text.match(/([一-龥A-Za-z]{1,4})\s*(?:↑|▲)|(?:\+|加|▲)\s*([一-龥A-Za-z]{1,4})/);
|
|
196
|
+
const downMatch = text.match(/([一-龥A-Za-z]{1,4})\s*(?:↓|▼)|(?:-|-|减|▼)\s*([一-龥A-Za-z]{1,4})/);
|
|
197
|
+
return {
|
|
198
|
+
up: (upMatch && (upMatch[1] || upMatch[2])) || '',
|
|
199
|
+
down: (downMatch && (downMatch[1] || downMatch[2])) || '',
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function buildShareCodeClassicView(view, assets, natureLookup = () => ({})) {
|
|
203
|
+
const teams = (view?.teams || []).map((team) => {
|
|
204
|
+
const element = (0, element_colors_1.bloodlineElement)(team?.bloodline?.name || '');
|
|
205
|
+
const nature = natureLookup(String(team?.personality?.id ?? '')) || {};
|
|
206
|
+
const naturePair = { up: String(nature.up || '').trim(), down: String(nature.down || '').trim() };
|
|
207
|
+
if (!naturePair.up && !naturePair.down) {
|
|
208
|
+
const parsed = parseNaturePair(nature.summary);
|
|
209
|
+
naturePair.up = parsed.up;
|
|
210
|
+
naturePair.down = parsed.down;
|
|
211
|
+
}
|
|
212
|
+
const typeNames = Array.isArray(team?.typeNames) ? team.typeNames : [];
|
|
213
|
+
return {
|
|
214
|
+
slotText: String(team?.slot ?? 0).padStart(2, '0'),
|
|
215
|
+
color: (0, element_colors_1.elementColor)(element),
|
|
216
|
+
pet: {
|
|
217
|
+
name: team?.pet?.name || '未配置精灵',
|
|
218
|
+
icon: team?.pet?.icon || '',
|
|
219
|
+
},
|
|
220
|
+
typeIcons: typeNames.map((name) => ({ name, icon: assets.typeIcon(name) })),
|
|
221
|
+
bloodline: {
|
|
222
|
+
name: team?.bloodline?.name || `${element}系血脉`,
|
|
223
|
+
icon: team?.bloodline?.icon || assets.bloodIcon(element),
|
|
224
|
+
},
|
|
225
|
+
personality: {
|
|
226
|
+
name: team?.personality?.name || nature.name || '未知',
|
|
227
|
+
up: naturePair.up,
|
|
228
|
+
down: naturePair.down,
|
|
229
|
+
},
|
|
230
|
+
ivs_detail: (team?.ivs || [])
|
|
231
|
+
.filter((item) => item?.configured)
|
|
232
|
+
.map((item) => ({ name: item.name })),
|
|
233
|
+
skills: (team?.skills || []).map((skill) => ({
|
|
234
|
+
name: skill?.name || '未配置技能',
|
|
235
|
+
icon: skill?.icon || '',
|
|
236
|
+
})),
|
|
237
|
+
};
|
|
238
|
+
});
|
|
239
|
+
const spriteCount = view?.spriteCount || teams.length;
|
|
240
|
+
return {
|
|
241
|
+
team: {
|
|
242
|
+
mode_name: view?.mode?.name || '未知编队模式',
|
|
243
|
+
share_code: view?.shareCodePreview || view?.shareCode || '',
|
|
244
|
+
sprite_count: spriteCount,
|
|
245
|
+
count_label: `/ ${spriteCount} 精灵`,
|
|
246
|
+
magic_icon: view?.magic?.icon || assets.rocoIcon,
|
|
247
|
+
teams,
|
|
248
|
+
},
|
|
249
|
+
shareAssets: {
|
|
250
|
+
frame: assets.frame,
|
|
251
|
+
logo: assets.logo,
|
|
252
|
+
rocoIcon: assets.rocoIcon,
|
|
253
|
+
star: assets.star,
|
|
254
|
+
wax: assets.wax,
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRunner = createRunner;
|
|
4
|
+
// 每个插件实例的互斥与停止标记:取消在途任务、阻止重叠检查。
|
|
5
|
+
function createRunner(ctx) {
|
|
6
|
+
const controller = new AbortController();
|
|
7
|
+
let running = false;
|
|
8
|
+
ctx.on('dispose', () => controller.abort());
|
|
9
|
+
const runner = Object.assign(async (job) => {
|
|
10
|
+
if (running || controller.signal.aborted)
|
|
11
|
+
return;
|
|
12
|
+
running = true;
|
|
13
|
+
try {
|
|
14
|
+
return await job(controller.signal);
|
|
15
|
+
}
|
|
16
|
+
finally {
|
|
17
|
+
running = false;
|
|
18
|
+
}
|
|
19
|
+
}, { aborted: () => controller.signal.aborted });
|
|
20
|
+
return runner;
|
|
21
|
+
}
|
|
@@ -4,6 +4,8 @@ export interface SubscriptionTarget {
|
|
|
4
4
|
channelId?: string;
|
|
5
5
|
guildId?: string;
|
|
6
6
|
userId?: string;
|
|
7
|
+
selfId?: string;
|
|
7
8
|
}
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function sentMessageIds(value: unknown): boolean;
|
|
10
|
+
export declare function sendScheduledMessage(ctx: Context, target: SubscriptionTarget, message: any, signal?: AbortSignal): Promise<boolean>;
|
|
11
|
+
export declare function sendScheduledImageWithFallback(ctx: Context, target: SubscriptionTarget, image: Buffer | Buffer[] | null, fallbackText: string, mentionAll?: boolean, signal?: AbortSignal): Promise<boolean>;
|
package/lib/subscription-send.js
CHANGED
|
@@ -1,22 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sentMessageIds = sentMessageIds;
|
|
3
4
|
exports.sendScheduledMessage = sendScheduledMessage;
|
|
4
5
|
exports.sendScheduledImageWithFallback = sendScheduledImageWithFallback;
|
|
5
6
|
const koishi_1 = require("koishi");
|
|
6
7
|
const send_image_1 = require("./send-image");
|
|
7
8
|
const logger = new koishi_1.Logger('rocom-subscription-send');
|
|
8
|
-
function findBot(ctx, platform = '') {
|
|
9
|
+
function findBot(ctx, platform = '', selfId = '') {
|
|
9
10
|
if (!ctx.bots?.length)
|
|
10
11
|
return null;
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
if (selfId) {
|
|
13
|
+
const exact = ctx.bots.find((bot) => String(bot.selfId) === String(selfId)
|
|
14
|
+
&& (!platform || bot.platform === platform));
|
|
15
|
+
return exact || null;
|
|
16
|
+
}
|
|
17
|
+
const candidates = platform ? ctx.bots.filter((bot) => bot.platform === platform) : ctx.bots;
|
|
18
|
+
if (!candidates.length)
|
|
19
|
+
return null;
|
|
20
|
+
// 缺少 self_id 的旧订阅只在对应平台恰有一个 Bot 时兼容,避免误发其他 Bot。
|
|
21
|
+
if (candidates.length > 1) {
|
|
22
|
+
logger.warn(`平台 ${platform || '(unknown)'} 存在多个 Bot 且订阅缺少 self_id,跳过发送`);
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return candidates[0];
|
|
26
|
+
}
|
|
27
|
+
function sentMessageIds(value) {
|
|
28
|
+
return Array.isArray(value) && value.some(id => typeof id === 'string' && id.trim().length > 0);
|
|
14
29
|
}
|
|
15
|
-
async function sendScheduledMessage(ctx, target, message) {
|
|
30
|
+
async function sendScheduledMessage(ctx, target, message, signal) {
|
|
31
|
+
if (signal?.aborted)
|
|
32
|
+
return false;
|
|
16
33
|
const platform = target.platform || '';
|
|
17
34
|
const channelId = target.channelId || target.guildId || '';
|
|
18
35
|
const userId = target.userId || '';
|
|
19
|
-
const bot = findBot(ctx, platform);
|
|
36
|
+
const bot = findBot(ctx, platform, target.selfId);
|
|
20
37
|
if (!bot) {
|
|
21
38
|
logger.warn('no available bot, skip scheduled push');
|
|
22
39
|
return false;
|
|
@@ -24,21 +41,14 @@ async function sendScheduledMessage(ctx, target, message) {
|
|
|
24
41
|
try {
|
|
25
42
|
if (userId && !target.guildId) {
|
|
26
43
|
if (typeof bot.sendPrivateMessage === 'function') {
|
|
27
|
-
await bot.sendPrivateMessage(userId, message);
|
|
28
|
-
return true;
|
|
44
|
+
return sentMessageIds(await bot.sendPrivateMessage(userId, message)) && !signal?.aborted;
|
|
29
45
|
}
|
|
30
46
|
if (typeof bot.sendMessage === 'function') {
|
|
31
|
-
await bot.sendMessage(userId, message);
|
|
32
|
-
return true;
|
|
47
|
+
return sentMessageIds(await bot.sendMessage(userId, message)) && !signal?.aborted;
|
|
33
48
|
}
|
|
34
49
|
}
|
|
35
|
-
if (platform && channelId) {
|
|
36
|
-
await ctx.broadcast([`${platform}:${channelId}`], message);
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
50
|
if (channelId && typeof bot.sendMessage === 'function') {
|
|
40
|
-
await bot.sendMessage(channelId, message, target.guildId);
|
|
41
|
-
return true;
|
|
51
|
+
return sentMessageIds(await bot.sendMessage(channelId, message, target.guildId || undefined)) && !signal?.aborted;
|
|
42
52
|
}
|
|
43
53
|
}
|
|
44
54
|
catch (err) {
|
|
@@ -48,14 +58,29 @@ async function sendScheduledMessage(ctx, target, message) {
|
|
|
48
58
|
logger.warn(`scheduled push target is incomplete: ${JSON.stringify(target)}`);
|
|
49
59
|
return false;
|
|
50
60
|
}
|
|
51
|
-
async function sendScheduledImageWithFallback(ctx, target, image, fallbackText, mentionAll = false) {
|
|
61
|
+
async function sendScheduledImageWithFallback(ctx, target, image, fallbackText, mentionAll = false, signal) {
|
|
62
|
+
if (signal?.aborted)
|
|
63
|
+
return false;
|
|
64
|
+
if (Array.isArray(image)) {
|
|
65
|
+
if (!image.length)
|
|
66
|
+
return sendScheduledImageWithFallback(ctx, target, null, fallbackText, mentionAll, signal);
|
|
67
|
+
for (let i = 0; i < image.length; i++) {
|
|
68
|
+
const segment = koishi_1.h.image(image[i], (0, send_image_1.detectImageMime)(image[i]));
|
|
69
|
+
const content = mentionAll && i === 0 ? (0, koishi_1.h)('message', {}, (0, koishi_1.h)('at', { type: 'all' }), segment) : segment;
|
|
70
|
+
if (!await sendScheduledMessage(ctx, target, content, signal)) {
|
|
71
|
+
// One complete text fallback replaces the remaining image pages.
|
|
72
|
+
return sendScheduledMessage(ctx, target, koishi_1.h.text(fallbackText), signal);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
52
77
|
const buildContent = (body) => mentionAll ? (0, koishi_1.h)('message', {}, (0, koishi_1.h)('at', { type: 'all' }), koishi_1.h.text('\n'), body) : body;
|
|
53
78
|
if (!image) {
|
|
54
|
-
return sendScheduledMessage(ctx, target, buildContent(koishi_1.h.text(fallbackText)));
|
|
79
|
+
return sendScheduledMessage(ctx, target, buildContent(koishi_1.h.text(fallbackText)), signal);
|
|
55
80
|
}
|
|
56
81
|
const imageSegment = koishi_1.h.image(image, (0, send_image_1.detectImageMime)(image));
|
|
57
|
-
const sent = await sendScheduledMessage(ctx, target, buildContent(imageSegment));
|
|
82
|
+
const sent = await sendScheduledMessage(ctx, target, buildContent(imageSegment), signal);
|
|
58
83
|
if (sent)
|
|
59
84
|
return true;
|
|
60
|
-
return sendScheduledMessage(ctx, target, buildContent(koishi_1.h.text(fallbackText)));
|
|
85
|
+
return sendScheduledMessage(ctx, target, buildContent(koishi_1.h.text(fallbackText)), signal);
|
|
61
86
|
}
|
|
Binary file
|
package/lib/types.d.ts
CHANGED
|
@@ -2,9 +2,11 @@ import { Context } from 'koishi';
|
|
|
2
2
|
import { RocomClient } from './client';
|
|
3
3
|
import { UserManager, MerchantSubscriptionManager, HomeSubscriptionManager, AnnouncementSubscriptionManager } from './user';
|
|
4
4
|
import { EggService } from './egg-service';
|
|
5
|
-
import { Renderer } from './render';
|
|
5
|
+
import { Renderer, ImageFormat } from './render';
|
|
6
6
|
import { WikiService } from './wiki-service';
|
|
7
7
|
import { AtlasService } from './atlas-service';
|
|
8
|
+
import { MerchantCatalogService } from './merchant-catalog';
|
|
9
|
+
import { MerchantPriceLog } from './merchant-price-log';
|
|
8
10
|
export interface PluginConfig {
|
|
9
11
|
apiBaseUrl: string;
|
|
10
12
|
wegameApiKey: string;
|
|
@@ -15,10 +17,17 @@ export interface PluginConfig {
|
|
|
15
17
|
merchantSubscriptionEnabled: boolean;
|
|
16
18
|
merchantSubscriptionItems: string[];
|
|
17
19
|
merchantUiStyle: 'new' | 'old';
|
|
20
|
+
shareCodeUiStyle: 'panel' | 'classic';
|
|
21
|
+
homeDetailUiStyle: 'panel' | 'classic';
|
|
18
22
|
merchantPrivateSubscriptionEnabled: boolean;
|
|
19
23
|
merchantCheckMode: 'interval' | 'times';
|
|
20
24
|
merchantCheckInterval: number;
|
|
21
25
|
merchantCheckTimes: string[];
|
|
26
|
+
merchantTimezone: string;
|
|
27
|
+
merchantAllDayOnceEnabled: boolean;
|
|
28
|
+
subscriptionGroupAdminEnabled: boolean;
|
|
29
|
+
subscriptionBotAdminEnabled: boolean;
|
|
30
|
+
subscriptionBotAdminAuthority: number;
|
|
22
31
|
homeSubscriptionEnabled: boolean;
|
|
23
32
|
homeSubscriptionIntervalMinutes: number;
|
|
24
33
|
announcementSubscriptionEnabled: boolean;
|
|
@@ -27,6 +36,8 @@ export interface PluginConfig {
|
|
|
27
36
|
homeQueryPollIntervalMs: number;
|
|
28
37
|
homeQueryTimeoutMs: number;
|
|
29
38
|
lowBandwidthMode: boolean;
|
|
39
|
+
renderTimeout: number;
|
|
40
|
+
imageFormat: ImageFormat;
|
|
30
41
|
imageCompressionEnabled: boolean;
|
|
31
42
|
imageCompressionMinBytes: number;
|
|
32
43
|
imageCompressionLevel: number;
|
|
@@ -43,4 +54,6 @@ export interface PluginDeps {
|
|
|
43
54
|
renderer: Renderer;
|
|
44
55
|
wikiService: WikiService;
|
|
45
56
|
atlasService: AtlasService;
|
|
57
|
+
merchantCatalog: MerchantCatalogService;
|
|
58
|
+
merchantPriceLog: MerchantPriceLog;
|
|
46
59
|
}
|
package/lib/user.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface MerchantSubscription {
|
|
|
10
10
|
group_id: string;
|
|
11
11
|
channel_id?: string;
|
|
12
12
|
platform?: string;
|
|
13
|
+
self_id?: string;
|
|
13
14
|
user_id?: string;
|
|
14
15
|
type?: string;
|
|
15
16
|
mention_all: boolean;
|
|
@@ -17,6 +18,10 @@ export interface MerchantSubscription {
|
|
|
17
18
|
items: string[];
|
|
18
19
|
last_push_round: string | null;
|
|
19
20
|
last_matched_items: string[];
|
|
21
|
+
allday_pushed?: {
|
|
22
|
+
date: string;
|
|
23
|
+
names: string[];
|
|
24
|
+
};
|
|
20
25
|
updated_by: string;
|
|
21
26
|
}
|
|
22
27
|
export interface HomeSubscription {
|
|
@@ -25,15 +30,20 @@ export interface HomeSubscription {
|
|
|
25
30
|
uid: string;
|
|
26
31
|
channel_id?: string;
|
|
27
32
|
platform?: string;
|
|
33
|
+
self_id?: string;
|
|
34
|
+
notify_user_id?: string;
|
|
35
|
+
nickname?: string;
|
|
28
36
|
guild_id?: string;
|
|
29
37
|
user_id?: string;
|
|
30
38
|
updated_by: string;
|
|
39
|
+
mention_all?: boolean;
|
|
31
40
|
notify_state: {
|
|
32
41
|
first?: boolean;
|
|
33
42
|
all?: boolean;
|
|
34
43
|
};
|
|
35
44
|
updated_at: number;
|
|
36
45
|
last_push_time?: number;
|
|
46
|
+
last_check_time?: number;
|
|
37
47
|
}
|
|
38
48
|
export declare class UserManager {
|
|
39
49
|
private store;
|
|
@@ -69,6 +79,7 @@ export declare class HomeSubscriptionManager {
|
|
|
69
79
|
export interface AnnouncementSubscription {
|
|
70
80
|
key: string;
|
|
71
81
|
platform?: string;
|
|
82
|
+
self_id?: string;
|
|
72
83
|
channel_id?: string;
|
|
73
84
|
guild_id?: string;
|
|
74
85
|
user_id?: string;
|
package/lib/wiki-catalog.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// 新版 RoCom Wiki
|
|
2
|
+
// 新版 RoCom Wiki 目录路由表。
|
|
3
3
|
// list_path 由后端 /wiki/catalogs 实时下发;这里只维护详情路径、ID 字段与别名。
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.WIKI_CATALOG_ROUTES_BY_ALIAS = exports.WIKI_CATALOG_ROUTES_BY_KEY = exports.WIKI_CATALOG_ROUTES = void 0;
|
package/lib/wiki-service.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-rocom",
|
|
3
3
|
"description": "洛克王国查询与订阅插件",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.24",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"homepage": "https://github.com/staytomorrow/koishi-plugin-rocom",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"build": "tsc -p tsconfig.json --emitDeclarationOnly false --module commonjs --moduleResolution node",
|
|
20
20
|
"postbuild": "node -e \"const fs=require('fs');for (const dir of ['render-templates','img','ttf']) { fs.rmSync('lib/'+dir,{recursive:true,force:true}); fs.cpSync('src/'+dir,'lib/'+dir,{recursive:true}); }\"",
|
|
21
21
|
"check": "tsc -p tsconfig.json --noEmit --pretty false",
|
|
22
|
+
"test:alignment": "node tests/alignment-review.cjs",
|
|
23
|
+
"test:player-response": "node tests/player-response-review.cjs",
|
|
24
|
+
"test:render": "node tests/render-smoke.cjs",
|
|
25
|
+
"test:commands": "node tests/command-review.cjs",
|
|
22
26
|
"pack:dry": "npm pack --dry-run",
|
|
23
27
|
"prepack": "npm run build"
|
|
24
28
|
},
|