koishi-plugin-noah 1.4.1 → 1.4.2
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/core/utils/card.d.ts +34 -0
- package/lib/index.cjs +178 -73
- package/lib/types/config.d.ts +2 -0
- package/package.json +1 -1
package/lib/core/utils/card.d.ts
CHANGED
|
@@ -26,6 +26,34 @@ export declare function classifyCardId(ctx: Context, input: string): 'uid' | 'ko
|
|
|
26
26
|
* @returns 删去空格的全大写字符串,并转换特殊字符(I→1, O/Q→0, V→U)
|
|
27
27
|
*/
|
|
28
28
|
export declare function processInputCardCode(input: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* card.bsnk.me API 返回的卡片信息结构
|
|
31
|
+
*/
|
|
32
|
+
export interface CardLookupResponse {
|
|
33
|
+
type: string;
|
|
34
|
+
errors?: [string, string][];
|
|
35
|
+
ids?: {
|
|
36
|
+
e004?: string;
|
|
37
|
+
idm?: string;
|
|
38
|
+
idm_pmm?: string;
|
|
39
|
+
sega?: string;
|
|
40
|
+
bng?: string;
|
|
41
|
+
aicc?: string;
|
|
42
|
+
konami?: string;
|
|
43
|
+
[key: string]: string | undefined;
|
|
44
|
+
};
|
|
45
|
+
info?: {
|
|
46
|
+
[key: string]: Record<string, unknown>;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 通过 card.bsnk.me API 查询卡片详细信息
|
|
51
|
+
* @param ctx - Koishi Context 对象
|
|
52
|
+
* @param cardCode - 卡号(支持多种格式:Access Code, UID, Konami ID 等)
|
|
53
|
+
* @returns 卡片详细信息
|
|
54
|
+
* @throws 当 API 请求失败时抛出异常
|
|
55
|
+
*/
|
|
56
|
+
export declare function lookupCard(ctx: Context, cardCode: string): Promise<CardLookupResponse>;
|
|
29
57
|
/**
|
|
30
58
|
* 通过 card.bsnk.me API 将 Access Code 转换为 UID
|
|
31
59
|
* @param ctx - Koishi Context 对象
|
|
@@ -34,3 +62,9 @@ export declare function processInputCardCode(input: string): string;
|
|
|
34
62
|
* @throws 当 API 请求失败或无法转换时抛出异常
|
|
35
63
|
*/
|
|
36
64
|
export declare function accessToUid(ctx: Context, accessCode: string): Promise<string>;
|
|
65
|
+
/**
|
|
66
|
+
* 格式化卡片详细信息为人类可读的字符串
|
|
67
|
+
* @param data - 卡片查询结果
|
|
68
|
+
* @returns 格式化后的字符串
|
|
69
|
+
*/
|
|
70
|
+
export declare function formatCardInfo(data: CardLookupResponse): string;
|
package/lib/index.cjs
CHANGED
|
@@ -725,15 +725,28 @@ function processInputCardCode(input) {
|
|
|
725
725
|
});
|
|
726
726
|
}
|
|
727
727
|
__name(processInputCardCode, "processInputCardCode");
|
|
728
|
+
async function lookupCard(ctx, cardCode) {
|
|
729
|
+
const cleanCardCode = cardCode.replaceAll(" ", "");
|
|
730
|
+
try {
|
|
731
|
+
const data = await ctx.http.post("https://card.bsnk.me/lookup", {
|
|
732
|
+
card: cleanCardCode
|
|
733
|
+
});
|
|
734
|
+
return data;
|
|
735
|
+
} catch (error) {
|
|
736
|
+
if (error instanceof Error) {
|
|
737
|
+
throw new Error(`Failed to lookup card: ${error.message}`);
|
|
738
|
+
}
|
|
739
|
+
throw new Error("Failed to lookup card: unknown error");
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
__name(lookupCard, "lookupCard");
|
|
728
743
|
async function accessToUid(ctx, accessCode) {
|
|
729
744
|
const cleanAccessCode = accessCode.replaceAll(" ", "");
|
|
730
745
|
if (cleanAccessCode.length !== 20 || !/^\d{20}$/.test(cleanAccessCode)) {
|
|
731
746
|
throw new Error("Access Code must be 20 digits");
|
|
732
747
|
}
|
|
733
748
|
try {
|
|
734
|
-
const data = await ctx
|
|
735
|
-
card: cleanAccessCode
|
|
736
|
-
});
|
|
749
|
+
const data = await lookupCard(ctx, cleanAccessCode);
|
|
737
750
|
if (data.ids?.e004) {
|
|
738
751
|
return data.ids.e004.toUpperCase();
|
|
739
752
|
}
|
|
@@ -749,6 +762,30 @@ async function accessToUid(ctx, accessCode) {
|
|
|
749
762
|
}
|
|
750
763
|
}
|
|
751
764
|
__name(accessToUid, "accessToUid");
|
|
765
|
+
function formatCardInfo(data) {
|
|
766
|
+
let result = "";
|
|
767
|
+
if (data.ids) {
|
|
768
|
+
const idTypes = {
|
|
769
|
+
e004: "Konami Old Card ID",
|
|
770
|
+
idm: "FeliCa IDm",
|
|
771
|
+
idm_pmm: "FeliCa IDm+PMm",
|
|
772
|
+
"0008": "0008-style Access Code",
|
|
773
|
+
sega: "SEGA Aime Access Code",
|
|
774
|
+
bng: "Banapass Access Code",
|
|
775
|
+
aicc: "Amusement IC Access Code",
|
|
776
|
+
konami: "Konami User ID"
|
|
777
|
+
};
|
|
778
|
+
for (const [idType, value] of Object.entries(data.ids)) {
|
|
779
|
+
if (value) {
|
|
780
|
+
const typeName = idTypes[idType] || idType;
|
|
781
|
+
result += `${typeName}: ${value}
|
|
782
|
+
`;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
return result.trim();
|
|
787
|
+
}
|
|
788
|
+
__name(formatCardInfo, "formatCardInfo");
|
|
752
789
|
|
|
753
790
|
// src/core/commands/bind.ts
|
|
754
791
|
function bind(ctx, config) {
|
|
@@ -959,20 +996,19 @@ var ServerService = class {
|
|
|
959
996
|
|
|
960
997
|
// src/core/commands/card.ts
|
|
961
998
|
function card(ctx, config) {
|
|
962
|
-
ctx.command("card").alias("卡片管理").userFields(["id"]).channelFields(["id"]).option("
|
|
999
|
+
ctx.command("card").alias("卡片管理").userFields(["id"]).channelFields(["id"]).option("detail", "-d <cardCode:text>").action(async ({ session, options }) => {
|
|
963
1000
|
const cardService = new CardService(ctx);
|
|
964
1001
|
const atGuild = session.guildId != null;
|
|
965
|
-
if (options.
|
|
966
|
-
const cardCode = processInputCardCode(options.
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
return uidToKonamiId(cardCode);
|
|
1002
|
+
if (options.detail) {
|
|
1003
|
+
const cardCode = processInputCardCode(options.detail);
|
|
1004
|
+
try {
|
|
1005
|
+
const cardInfo = await lookupCard(ctx, cardCode);
|
|
1006
|
+
return formatCardInfo(cardInfo);
|
|
1007
|
+
} catch (error) {
|
|
1008
|
+
if (error instanceof Error) {
|
|
1009
|
+
return session.text(".lookup-error", { message: error.message });
|
|
1010
|
+
}
|
|
1011
|
+
return session.text(".lookup-error-unknown");
|
|
976
1012
|
}
|
|
977
1013
|
}
|
|
978
1014
|
const serverService = new ServerService(ctx);
|
|
@@ -1281,6 +1317,21 @@ var import_koishi3 = require("koishi");
|
|
|
1281
1317
|
var serverValues = ["asphyxia", "mao"];
|
|
1282
1318
|
|
|
1283
1319
|
// src/core/commands/server.ts
|
|
1320
|
+
function normalizeUrl(url) {
|
|
1321
|
+
try {
|
|
1322
|
+
if (!url.match(/^https?:\/\//i)) {
|
|
1323
|
+
url = "http://" + url;
|
|
1324
|
+
}
|
|
1325
|
+
const urlObj = new URL(url);
|
|
1326
|
+
if (urlObj.protocol === "http:" || urlObj.protocol === "https:") {
|
|
1327
|
+
return url;
|
|
1328
|
+
}
|
|
1329
|
+
return null;
|
|
1330
|
+
} catch {
|
|
1331
|
+
return null;
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
__name(normalizeUrl, "normalizeUrl");
|
|
1284
1335
|
function server(ctx, config) {
|
|
1285
1336
|
ctx.command("server").alias("服务器管理").option("channel", "-c").userFields(["id"]).channelFields(["id"]).action(async ({ session, options }) => {
|
|
1286
1337
|
const serverService = new ServerService(ctx);
|
|
@@ -1464,25 +1515,38 @@ async function showServerMenu(ctx, session, serverService, userService, server2,
|
|
|
1464
1515
|
return session.text(".menu-1-success");
|
|
1465
1516
|
}
|
|
1466
1517
|
if (selectNum === 2) {
|
|
1467
|
-
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1518
|
+
let attempts = 0;
|
|
1519
|
+
const maxAttempts = 3;
|
|
1520
|
+
while (attempts < maxAttempts) {
|
|
1521
|
+
await session.send(session.text(".menu-2-prompt", server2));
|
|
1522
|
+
const url = await session.prompt();
|
|
1523
|
+
if (!url) return session.text("commands.timeout");
|
|
1524
|
+
if (url === "0")
|
|
1525
|
+
return showServerMenu(
|
|
1526
|
+
ctx,
|
|
1527
|
+
session,
|
|
1528
|
+
serverService,
|
|
1529
|
+
userService,
|
|
1530
|
+
server2,
|
|
1531
|
+
from,
|
|
1532
|
+
uid,
|
|
1533
|
+
userDefaultServerId,
|
|
1534
|
+
cid,
|
|
1535
|
+
channelDefaultServerId
|
|
1536
|
+
);
|
|
1537
|
+
if (url === "q") return session.text(".quit");
|
|
1538
|
+
const normalizedUrl = normalizeUrl(url);
|
|
1539
|
+
if (!normalizedUrl) {
|
|
1540
|
+
attempts++;
|
|
1541
|
+
if (attempts >= maxAttempts) {
|
|
1542
|
+
return session.text(".menu-2-too-many-attempts");
|
|
1543
|
+
}
|
|
1544
|
+
await session.send(session.text(".menu-2-invalid-url"));
|
|
1545
|
+
continue;
|
|
1546
|
+
}
|
|
1547
|
+
await serverService.updateServer(server2.id, { baseUrl: normalizedUrl });
|
|
1548
|
+
return session.text(".menu-2-success");
|
|
1549
|
+
}
|
|
1486
1550
|
}
|
|
1487
1551
|
if (selectNum === 3) {
|
|
1488
1552
|
await serverService.removeServer(server2.id);
|
|
@@ -1546,10 +1610,30 @@ async function addServer(ctx, session, serverService, userService, from, uid, us
|
|
|
1546
1610
|
return session.text(".invalid-select");
|
|
1547
1611
|
}
|
|
1548
1612
|
const serverType = serverValues[selectNum - 1];
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1613
|
+
let url;
|
|
1614
|
+
if (serverType === "mao") {
|
|
1615
|
+
url = ctx.config.maoServerUrl;
|
|
1616
|
+
} else {
|
|
1617
|
+
let attempts = 0;
|
|
1618
|
+
const maxAttempts = 3;
|
|
1619
|
+
while (attempts < maxAttempts) {
|
|
1620
|
+
await session.send(session.text(".add-url"));
|
|
1621
|
+
const urlInput = await session.prompt();
|
|
1622
|
+
if (!urlInput) return session.text("commands.timeout");
|
|
1623
|
+
if (urlInput === "q") return session.text(".quit");
|
|
1624
|
+
const normalizedUrl = normalizeUrl(urlInput);
|
|
1625
|
+
if (!normalizedUrl) {
|
|
1626
|
+
attempts++;
|
|
1627
|
+
if (attempts >= maxAttempts) {
|
|
1628
|
+
return session.text(".add-too-many-attempts");
|
|
1629
|
+
}
|
|
1630
|
+
await session.send(session.text(".add-invalid-url"));
|
|
1631
|
+
continue;
|
|
1632
|
+
}
|
|
1633
|
+
url = normalizedUrl;
|
|
1634
|
+
break;
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1553
1637
|
await session.send(session.text(".add-name"));
|
|
1554
1638
|
const serverName = await session.prompt();
|
|
1555
1639
|
if (!serverName) return session.text("commands.timeout");
|
|
@@ -1747,7 +1831,6 @@ function guildRequest(ctx, config) {
|
|
|
1747
1831
|
}
|
|
1748
1832
|
__name(guildRequest, "guildRequest");
|
|
1749
1833
|
function guildNameCard(ctx, config) {
|
|
1750
|
-
let currentNameCardIndex = 0;
|
|
1751
1834
|
const timerDisposers = /* @__PURE__ */ new Map();
|
|
1752
1835
|
async function updateBotNameCards(bot) {
|
|
1753
1836
|
if (!config.guildNameCards || config.guildNameCards.length === 0) {
|
|
@@ -1756,22 +1839,30 @@ function guildNameCard(ctx, config) {
|
|
|
1756
1839
|
const guilds = bot.getGuildIter();
|
|
1757
1840
|
for await (const guild of guilds) {
|
|
1758
1841
|
try {
|
|
1759
|
-
const nameCard = config.guildNameCards[currentNameCardIndex];
|
|
1760
1842
|
const memberInfo = await bot.getGuildMember(guild.id, bot.selfId);
|
|
1761
|
-
|
|
1762
|
-
if (
|
|
1763
|
-
|
|
1843
|
+
const currentNameCard = memberInfo.nick;
|
|
1844
|
+
if (currentNameCard === "Noah | 🚧维护中") continue;
|
|
1845
|
+
const currentIndex = config.guildNameCards.findIndex(
|
|
1846
|
+
(card2) => card2 === currentNameCard
|
|
1847
|
+
);
|
|
1848
|
+
const nextIndex = (currentIndex + 1) % config.guildNameCards.length;
|
|
1849
|
+
const nextNameCard = config.guildNameCards[nextIndex];
|
|
1850
|
+
if (currentNameCard === nextNameCard) continue;
|
|
1851
|
+
await bot.internal.setGroupCard(
|
|
1852
|
+
guild.id,
|
|
1853
|
+
bot.selfId,
|
|
1854
|
+
nextNameCard
|
|
1855
|
+
);
|
|
1764
1856
|
ctx.logger("guild-namecard").info(
|
|
1765
|
-
`更新 ${bot.selfId} 在 ${guild.name}
|
|
1857
|
+
`更新 ${bot.selfId} 在 ${guild.name} 的群名片: ${currentNameCard} -> ${nextNameCard}`
|
|
1766
1858
|
);
|
|
1767
|
-
await ctx.sleep(
|
|
1859
|
+
await ctx.sleep(2e3);
|
|
1768
1860
|
} catch (error) {
|
|
1769
1861
|
ctx.logger("guild-namecard").warn(
|
|
1770
1862
|
`更新 ${bot.selfId} 在 ${guild.name} 的群名片失败: ${error}`
|
|
1771
1863
|
);
|
|
1772
1864
|
}
|
|
1773
1865
|
}
|
|
1774
|
-
currentNameCardIndex = (currentNameCardIndex + 1) % config.guildNameCards.length;
|
|
1775
1866
|
}
|
|
1776
1867
|
__name(updateBotNameCards, "updateBotNameCards");
|
|
1777
1868
|
async function setupTimersForBot(bot) {
|
|
@@ -1779,7 +1870,14 @@ function guildNameCard(ctx, config) {
|
|
|
1779
1870
|
if (disposer) {
|
|
1780
1871
|
disposer();
|
|
1781
1872
|
}
|
|
1782
|
-
|
|
1873
|
+
ctx.setTimeout(async () => {
|
|
1874
|
+
try {
|
|
1875
|
+
await updateBotNameCards(bot);
|
|
1876
|
+
ctx.logger("guild-namecard").info(`Bot ${bot.selfId} 更新群名片成功`);
|
|
1877
|
+
} catch (err) {
|
|
1878
|
+
ctx.logger("guild-namecard").warn(`Bot ${bot.selfId} 更新群名片失败: ${err}`);
|
|
1879
|
+
}
|
|
1880
|
+
}, 5e3);
|
|
1783
1881
|
const dispose = ctx.setInterval(
|
|
1784
1882
|
() => {
|
|
1785
1883
|
updateBotNameCards(bot).catch((err) => {
|
|
@@ -1825,10 +1923,10 @@ function apply4(ctx, config) {
|
|
|
1825
1923
|
__name(apply4, "apply");
|
|
1826
1924
|
|
|
1827
1925
|
// src/core/locales/en-US.yml
|
|
1828
|
-
var en_US_default2 = { _config: { $desc: "Core Module Settings", adminUsers: "**Plugin Admin** User ID (use inspect command to get)", guildNameCards: "**Group Card** Name List" }, commands: { maintain: { description: "Switch to maintenance mode", messages: { start: "<p>Entering maintenance mode</p>", "success-start": "<p>Successfully switched to maintenance mode</p>", stop: "<p>Exiting maintenance mode</p>", "success-stop": "<p>Successfully exited maintenance mode</p>" } }, timeout: "Noah didn't wait for your reply, please try again!", noah: { help: { description: "Show Noah help information", messages: { content: "<p>Guide:</p>\n<a>https://docs.logthm.cn/noah</a>" } } }, locale: { description: "Set language", messages: { "no-auth": "<p>Only group admins can use this feature~</p>", "invalid-select": "<p>No such option!</p>", quit: "<p>Quit!</p>", "reset-channel": "<p>Reset successfully!</p>", "reset-user": "<p>Reset successfully!</p>", success: "<p>Set successfully!</p>", "set-channel": "<p>Select the default language for group chats:</p>\n<p>1. 简体中文</p>\n<p>2. English</p>\n<p>q. Quit</p>", "set-user": "<p>Select the language you use:</p>\n<p>1. 中文</p>\n<p>2. English</p>\n<p>q. Quit</p>" } }, bind: { description: "Bind card", messages: { prompt: "<p>Please enter your card number:</p>", "invalid-code": "<p>The card number is incorrect, if you don't remember it, go to the arcade to check it~</p>", duplicate: "<p>This card has already been bound (︶^︶)</p>", name: "<p>Received! Please give this card a name, no spaces allowed:</p>", invalid_name: "<p>No spaces allowed! Please try again o(一︿一+)o</p>", success: "<p>Bound successfully, your card information is as follows:</p>\n<p>[{cardName}]</p>\n<p>{cardCode}</p>" } }, card: { description: "Manage cards", messages: { "invalid-code": "<p>The card number is incorrect, if you don't remember it, go to the arcade to check it~</p>", "invalid-select": "<p>No such option!</p>", "menu-select": "<p>[Card Management]</p>\n{card_list}\n<p>0. Add new card</p>\n<p>Please enter the serial number:</p>", menu: "<p>[{name}]</p>\n<p>1. Set as default card</p>\n<p>2. View or modify card number</p>\n<p>3. Delete the card</p>\n<p>4. Rename the card</p>\n<p>5. Bind the card to a specified server</p>\n<p>0. Return to card selection</p>\n<p>Please enter the serial number:</p>", "menu-has-bound-server": "<p>[{name}]</p>\n<p>Bound server: {defaultServerName}</p>\n<p>1. Set as default card</p>\n<p>2. View or modify card number</p>\n<p>3. Delete the card</p>\n<p>4. Rename the card</p>\n<p>5. Bind the card to a specified server</p>\n<p>0. Return to card selection</p>\n<p>Please enter the serial number:</p>", "menu-1-success": "<p>Set successfully!</p>", "menu-1-error-duplicate": "<p>The selected card is the same as the old default card!</p>", "menu-2-prompt": "<p>Card number: {code}</p>\n<p>Please enter the new card number:</p>\n<p>Enter 0 to return</p>", "menu-2-success": "<p>Modified successfully!</p>", "menu-2-error-invalid-code": "<p>The card number is incorrect, if you don't remember it, go to the arcade to check it~</p>", "menu-3-success": "<p>Deleted successfully!</p>", "menu-4-prompt": "<p>Enter a new name, no spaces allowed:</p>", "menu-4-error-invalid-name": "<p>No spaces allowed! Please try again o(一︿一+)o</p>", "menu-4-success": "<p>Modified successfully!</p>", "menu-5": "{server_list}\n<p>Please enter the serial number:</p>", "menu-5-success": "<p>Set successfully!</p>", "menu-5-error-duplicate": "<p>The selected server is the same as the old default server!</p>" } }, server: { description: "Manage servers", messages: { "no-channel": "<p>Please use this feature in group chats~</p>", "invalid-select": "<p>No such option!</p>", "no-auth": "<p>Only group admins can use this feature~</p>", "admin-menu-select": "<p>[Group server management]</p>\n{server_list}\n<p>0. Add new server</p>\n<p>Please enter the serial number:</p>", "menu-select": "<p>[Server management]</p>\n{server_list}\n<p>0. Add new server</p>\n<p>Please enter the serial number:</p>", menu: "<p>[{name}]</p>\n<p>Type: {type}</p>\n<p>1. Set as default server</p>\n<p>2. View or modify url</p>\n<p>3. Delete the server</p>\n<p>4. Rename the server</p>\n<p>0. Return to server selection</p>\n<p>Please enter the serial number:</p>", "menu-1-success": "<p>Set successfully!</p>", "menu-1-error-duplicate": "<p>The selected server is the same as the old default server!</p>", "menu-2-prompt": "<p>The server's url: {baseUrl}</p>\n<p>Please enter the new server url:</p>\n<p>Enter 0 to return</p>", "menu-2-success": "<p>Modified successfully!</p>", "menu-3-success": "<p>Deleted successfully!</p>", "menu-4-prompt": "<p>Enter a new name, no spaces allowed:</p>", "menu-4-error-invalid-name": "<p>No spaces allowed! Please try again o(一︿一+)o</p>", "menu-4-success": "<p>Modified successfully!</p>", "add-type": "<p>Please select the server type:</p>\n{server_type_list}", "add-url": "<p>Please enter the server url:</p>", "add-name": "<p>Received! Please give the server a name, no spaces allowed:</p>", "add-invalid_name": "<p>No spaces allowed! Please try again o(一︿一+)o</p>", "add-success": "<p>Added successfully, the server information is as follows:</p>\n<p>[{serverName}]</p>\n<p>Type: {serverType}</p>" } } } };
|
|
1926
|
+
var en_US_default2 = { _config: { $desc: "Core Module Settings", adminUsers: "**Plugin Admin** User ID (use inspect command to get)", guildNameCards: "**Group Card** Name List" }, commands: { maintain: { description: "Switch to maintenance mode", messages: { "no-auth": "<p>You don't have permission to use this feature~</p>", start: "<p>Entering maintenance mode</p>", "success-start": "<p>Successfully switched to maintenance mode</p>", stop: "<p>Exiting maintenance mode</p>", "success-stop": "<p>Successfully exited maintenance mode</p>" } }, timeout: "Noah didn't wait for your reply, please try again!", noah: { help: { description: "Show Noah help information", messages: { content: "<p>Guide:</p>\n<a>https://docs.logthm.cn/noah</a>" } } }, locale: { description: "Set language", messages: { "no-auth": "<p>Only group admins can use this feature~</p>", "invalid-select": "<p>No such option!</p>", quit: "<p>Quit!</p>", "reset-channel": "<p>Reset successfully!</p>", "reset-user": "<p>Reset successfully!</p>", success: "<p>Set successfully!</p>", "set-channel": "<p>Select the default language for group chats:</p>\n<p>1. 简体中文</p>\n<p>2. English</p>\n<p>q. Quit</p>", "set-user": "<p>Select the language you use:</p>\n<p>1. 中文</p>\n<p>2. English</p>\n<p>q. Quit</p>" } }, bind: { description: "Bind card", messages: { prompt: "<p>Please enter your card number:</p>", "invalid-code": "<p>The card number is incorrect, if you don't remember it, go to the arcade to check it~</p>", duplicate: "<p>This card has already been bound (︶^︶)</p>", name: "<p>Received! Please give this card a name, no spaces allowed:</p>", invalid_name: "<p>No spaces allowed! Please try again o(一︿一+)o</p>", success: "<p>Bound successfully, your card information is as follows:</p>\n<p>[{cardName}]</p>\n<p>{cardCode}</p>" } }, card: { description: "Manage cards", options: { detail: "Show detailed card information" }, messages: { "invalid-code": "<p>The card number is incorrect, if you don't remember it, go to the arcade to check it~</p>", "invalid-select": "<p>No such option!</p>", "lookup-error": "Lookup failed: {message}", "lookup-error-unknown": "Lookup failed: unknown error", "menu-select": "<p>[Card Management]</p>\n{card_list}\n<p>0. Add new card</p>\n<p>Please enter the serial number:</p>", menu: "<p>[{name}]</p>\n<p>1. Set as default card</p>\n<p>2. View or modify card number</p>\n<p>3. Delete the card</p>\n<p>4. Rename the card</p>\n<p>5. Bind the card to a specified server</p>\n<p>0. Return to card selection</p>\n<p>Please enter the serial number:</p>", "menu-has-bound-server": "<p>[{name}]</p>\n<p>Bound server: {defaultServerName}</p>\n<p>1. Set as default card</p>\n<p>2. View or modify card number</p>\n<p>3. Delete the card</p>\n<p>4. Rename the card</p>\n<p>5. Bind the card to a specified server</p>\n<p>0. Return to card selection</p>\n<p>Please enter the serial number:</p>", "menu-1-success": "<p>Set successfully!</p>", "menu-1-error-duplicate": "<p>The selected card is the same as the old default card!</p>", "menu-2-prompt": "<p>Card number: {code}</p>\n<p>Please enter the new card number:</p>\n<p>Enter 0 to return</p>", "menu-2-success": "<p>Modified successfully!</p>", "menu-2-error-invalid-code": "<p>The card number is incorrect, if you don't remember it, go to the arcade to check it~</p>", "menu-3-success": "<p>Deleted successfully!</p>", "menu-4-prompt": "<p>Enter a new name, no spaces allowed:</p>", "menu-4-error-invalid-name": "<p>No spaces allowed! Please try again o(一︿一+)o</p>", "menu-4-success": "<p>Modified successfully!</p>", "menu-5": "{server_list}\n<p>Please enter the serial number:</p>", "menu-5-success": "<p>Set successfully!</p>", "menu-5-error-duplicate": "<p>The selected server is the same as the old default server!</p>" } }, server: { description: "Manage servers", messages: { "no-channel": "<p>Please use this feature in group chats~</p>", "invalid-select": "<p>No such option!</p>", "no-auth": "<p>Only group admins can use this feature~</p>", "admin-menu-select": "<p>[Group server management]</p>\n{server_list}\n<p>0. Add new server</p>\n<p>Please enter the serial number:</p>", "menu-select": "<p>[Server management]</p>\n{server_list}\n<p>0. Add new server</p>\n<p>Please enter the serial number:</p>", menu: "<p>[{name}]</p>\n<p>Type: {type}</p>\n<p>1. Set as default server</p>\n<p>2. View or modify url</p>\n<p>3. Delete the server</p>\n<p>4. Rename the server</p>\n<p>0. Return to server selection</p>\n<p>Please enter the serial number:</p>", "menu-1-success": "<p>Set successfully!</p>", "menu-1-error-duplicate": "<p>The selected server is the same as the old default server!</p>", "menu-2-prompt": "<p>The server's url: {baseUrl}</p>\n<p>Please enter the new server url:</p>\n<p>Enter 0 to return</p>", "menu-2-success": "<p>Modified successfully!</p>", "menu-2-invalid-url": "<p>Invalid URL format! Please enter a valid url address.</p>", "menu-2-too-many-attempts": "<p>Too many attempts. Operation cancelled.</p>", "menu-3-success": "<p>Deleted successfully!</p>", "menu-4-prompt": "<p>Enter a new name, no spaces allowed:</p>", "menu-4-error-invalid-name": "<p>No spaces allowed! Please try again o(一︿一+)o</p>", "menu-4-success": "<p>Modified successfully!</p>", "add-type": "<p>Please select the server type:</p>\n{server_type_list}", "add-url": "<p>Please enter the server url:</p>", "add-invalid-url": "<p>Invalid URL format! Please enter a valid url address.</p>", "add-too-many-attempts": "<p>Too many attempts. Operation cancelled.</p>", "add-name": "<p>Received! Please give the server a name, no spaces allowed:</p>", "add-invalid_name": "<p>No spaces allowed! Please try again o(一︿一+)o</p>", "add-success": "<p>Added successfully, the server information is as follows:</p>\n<p>[{serverName}]</p>\n<p>Type: {serverType}</p>" } } } };
|
|
1829
1927
|
|
|
1830
1928
|
// src/core/locales/zh-CN.yml
|
|
1831
|
-
var zh_CN_default2 = { _config: { $desc: "Core 模块设置", adminUsers: "**插件管理员** 的用户id (使用 inspect 指令获取)", guildNameCards: "**群聊卡片** 的名称列表" }, commands: { maintain: { description: "切换到维护模式", messages: { start: "<p>正在进入维护模式</p>", "success-start": "<p>成功切换到维护模式</p>", stop: "<p>正在退出维护模式</p>", "success-stop": "<p>成功退出维护模式</p>" } }, timeout: "Noah 没等到你的回复,请重试!", noah: { help: { description: "显示 Noah 帮助信息", messages: { content: "<p>使用文档:</p>\n<a>https://docs.logthm.cn/noah</a>" } } }, locale: { description: "设置语言", messages: { "no-auth": "<p>只有群管理员能使用本功能哦~</p>", "invalid-select": "<p>没有该选项!</p>", quit: "<p>已退出~</p>", "reset-channel": "<p>重置成功!</p>", "reset-user": "<p>重置成功!</p>", success: "<p>设置成功!</p>", "set-channel": "<p>选择群聊默认使用的语言:</p>\n<p>1. 简体中文</p>\n<p>2. English</p>\n<p>q. 退出</p>", "set-user": "<p>选择你使用的语言:</p>\n<p>1. 简体中文</p>\n<p>2. English</p>\n<p>q. 退出</p>" } }, bind: { description: "绑定卡片", messages: { prompt: "<p>请输入你的卡号:</p>", "invalid-code": "<p>卡号不对哟,不记得的话去机台刷一下吧~</p>", duplicate: "<p>这张卡已经被绑定啦 (︶^︶)</p>", name: "<p>收到!为这张卡取一个名字吧,不要带空格哦:</p>", invalid_name: "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", success: "<p>绑好啦,你的卡片信息如下:</p>\n<p>[{cardName}]</p>\n<p>{cardCode}</p>" } }, card: { description: "管理卡片", messages: { "invalid-code": "<p>卡号不对哟,不记得的话去机台刷一下吧~</p>", "invalid-select": "<p>没有该选项!</p>", quit: "<p>已退出~</p>", "menu-select": "<p>[卡片管理]</p>\n{card_list}\n<p>0. 添加新卡片</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", menu: "<p>[{name}]</p>\n<p>1. 设为默认卡片</p>\n<p>2. 查看或修改卡号</p>\n<p>3. 删除该卡</p>\n<p>4. 重命名该卡片</p>\n<p>5. 将卡片与指定服务器绑定</p>\n<p>0. 返回卡片选择</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-has-bound-server": "<p>[{name}]</p>\n<p>已绑定服务器:{defaultServerName}</p>\n<p>1. 设为默认卡片</p>\n<p>2. 查看或修改卡号</p>\n<p>3. 删除该卡</p>\n<p>4. 重命名该卡片</p>\n<p>5. 将卡片与指定服务器绑定</p>\n<p>0. 返回卡片选择</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-1-success": "<p>设置成功!</p>", "menu-1-error-duplicate": "<p>选择的卡片与旧的默认卡片相同!</p>", "menu-2-prompt": "<p>卡号:{code}</p>\n<p>请输入新的卡号:</p>\n<p>0. 返回</p>\n<p>q. 退出</p>", "menu-2-success": "<p>修改成功!</p>", "menu-2-error-invalid-code": "<p>卡号不对哟,不记得的话去机台刷一下吧~</p>", "menu-3-success": "<p>已删除!</p>", "menu-4-prompt": "<p>输入一个新名字,不要带空格哦:</p>\n<p>q. 退出</p>", "menu-4-error-invalid-name": "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", "menu-4-success": "<p>修改成功!</p>", "menu-5": "<p>请选择一个服务器:</p>\n{server_list}\n<p>q. 退出</p>", "menu-5-success": "<p>设置成功!</p>", "menu-5-error-duplicate": "<p>选择的服务器与旧的默认服务器相同!</p>" } }, server: { description: "管理服务器", messages: { "no-channel": "<p>请在群聊中使用本功能哦~</p>", "invalid-select": "<p>没有该选项!</p>", "no-auth": "<p>只有群管理员能使用本功能哦~</p>", quit: "<p>已退出~</p>", "admin-menu-select": "<p>[群聊服务器管理]</p>\n{server_list}\n<p>0. 添加新服务器</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-select": "<p>[服务器管理]</p>\n{server_list}\n<p>0. 添加新服务器</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", menu: "<p>[{name}]</p>\n<p>类型:{type}</p>\n<p>1. 设为默认服务器</p>\n<p>2. 查看或修改 url</p>\n<p>3. 删除该服务器</p>\n<p>4. 重命名该服务器</p>\n<p>0. 返回服务器选择</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-1-success": "<p>设置成功!</p>", "menu-1-error-duplicate": "<p>选择的服务器与旧的默认服务器相同!</p>", "menu-2-prompt": "<p>该服务器的 url:{baseUrl}</p>\n<p>请输入新的服务器 url:</p>\n<p>0. 返回</p>\n<p>q. 退出</p>", "menu-2-success": "<p>修改成功!</p>", "menu-3-success": "<p>已删除!</p>", "menu-4-prompt": "<p>输入一个新名字,不要带空格哦:</p>\n<p>0. 返回</p>\n<p>q. 退出</p>", "menu-4-error-invalid-name": "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", "menu-4-success": "<p>修改成功!</p>", "add-type": "<p>请选择服务器的类型:</p>\n{server_type_list}\n<p>q. 退出</p>", "add-url": "<p>请输入服务器的 url:</p>\n<p>q. 退出</p>", "add-name": "<p>收到!为服务器取一个名字吧,不要带空格哦:</p>\n<p>q. 退出</p>", "add-invalid_name": "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", "add-success": "<p>添加成功啦,服务器信息如下:</p>\n<p>[{serverName}]</p>\n<p>类型:{serverType}</p>" } } } };
|
|
1929
|
+
var zh_CN_default2 = { _config: { $desc: "Core 模块设置", adminUsers: "**插件管理员** 的用户id (使用 inspect 指令获取)", guildNameCards: "**群聊卡片** 的名称列表" }, commands: { maintain: { description: "切换到维护模式", messages: { "no-auth": "<p>你没有权限使用本功能哦~</p>", start: "<p>正在进入维护模式</p>", "success-start": "<p>成功切换到维护模式</p>", stop: "<p>正在退出维护模式</p>", "success-stop": "<p>成功退出维护模式</p>" } }, timeout: "Noah 没等到你的回复,请重试!", noah: { help: { description: "显示 Noah 帮助信息", messages: { content: "<p>使用文档:</p>\n<a>https://docs.logthm.cn/noah</a>" } } }, locale: { description: "设置语言", messages: { "no-auth": "<p>只有群管理员能使用本功能哦~</p>", "invalid-select": "<p>没有该选项!</p>", quit: "<p>已退出~</p>", "reset-channel": "<p>重置成功!</p>", "reset-user": "<p>重置成功!</p>", success: "<p>设置成功!</p>", "set-channel": "<p>选择群聊默认使用的语言:</p>\n<p>1. 简体中文</p>\n<p>2. English</p>\n<p>q. 退出</p>", "set-user": "<p>选择你使用的语言:</p>\n<p>1. 简体中文</p>\n<p>2. English</p>\n<p>q. 退出</p>" } }, bind: { description: "绑定卡片", messages: { prompt: "<p>请输入你的卡号:</p>", "invalid-code": "<p>卡号不对哟,不记得的话去机台刷一下吧~</p>", duplicate: "<p>这张卡已经被绑定啦 (︶^︶)</p>", name: "<p>收到!为这张卡取一个名字吧,不要带空格哦:</p>", invalid_name: "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", success: "<p>绑好啦,你的卡片信息如下:</p>\n<p>[{cardName}]</p>\n<p>{cardCode}</p>" } }, card: { description: "管理卡片", options: { detail: "显示卡片详细信息" }, messages: { "invalid-code": "<p>卡号不对哟,不记得的话去机台刷一下吧~</p>", "invalid-select": "<p>没有该选项!</p>", quit: "<p>已退出~</p>", "lookup-error": "查询失败: {message}", "lookup-error-unknown": "查询失败: 未知错误", "menu-select": "<p>[卡片管理]</p>\n{card_list}\n<p>0. 添加新卡片</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", menu: "<p>[{name}]</p>\n<p>1. 设为默认卡片</p>\n<p>2. 查看或修改卡号</p>\n<p>3. 删除该卡</p>\n<p>4. 重命名该卡片</p>\n<p>5. 将卡片与指定服务器绑定</p>\n<p>0. 返回卡片选择</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-has-bound-server": "<p>[{name}]</p>\n<p>已绑定服务器:{defaultServerName}</p>\n<p>1. 设为默认卡片</p>\n<p>2. 查看或修改卡号</p>\n<p>3. 删除该卡</p>\n<p>4. 重命名该卡片</p>\n<p>5. 将卡片与指定服务器绑定</p>\n<p>0. 返回卡片选择</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-1-success": "<p>设置成功!</p>", "menu-1-error-duplicate": "<p>选择的卡片与旧的默认卡片相同!</p>", "menu-2-prompt": "<p>卡号:{code}</p>\n<p>请输入新的卡号:</p>\n<p>0. 返回</p>\n<p>q. 退出</p>", "menu-2-success": "<p>修改成功!</p>", "menu-2-error-invalid-code": "<p>卡号不对哟,不记得的话去机台刷一下吧~</p>", "menu-3-success": "<p>已删除!</p>", "menu-4-prompt": "<p>输入一个新名字,不要带空格哦:</p>\n<p>q. 退出</p>", "menu-4-error-invalid-name": "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", "menu-4-success": "<p>修改成功!</p>", "menu-5": "<p>请选择一个服务器:</p>\n{server_list}\n<p>q. 退出</p>", "menu-5-success": "<p>设置成功!</p>", "menu-5-error-duplicate": "<p>选择的服务器与旧的默认服务器相同!</p>" } }, server: { description: "管理服务器", messages: { "no-channel": "<p>请在群聊中使用本功能哦~</p>", "invalid-select": "<p>没有该选项!</p>", "no-auth": "<p>只有群管理员能使用本功能哦~</p>", quit: "<p>已退出~</p>", "admin-menu-select": "<p>[群聊服务器管理]</p>\n{server_list}\n<p>0. 添加新服务器</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-select": "<p>[服务器管理]</p>\n{server_list}\n<p>0. 添加新服务器</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", menu: "<p>[{name}]</p>\n<p>类型:{type}</p>\n<p>1. 设为默认服务器</p>\n<p>2. 查看或修改 url</p>\n<p>3. 删除该服务器</p>\n<p>4. 重命名该服务器</p>\n<p>0. 返回服务器选择</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-1-success": "<p>设置成功!</p>", "menu-1-error-duplicate": "<p>选择的服务器与旧的默认服务器相同!</p>", "menu-2-prompt": "<p>该服务器的 url:{baseUrl}</p>\n<p>请输入新的服务器 url:</p>\n<p>0. 返回</p>\n<p>q. 退出</p>", "menu-2-success": "<p>修改成功!</p>", "menu-2-invalid-url": "<p>URL 格式不正确!请输入有效的 url 地址。</p>", "menu-2-too-many-attempts": "<p>尝试次数过多,操作已取消。</p>", "menu-3-success": "<p>已删除!</p>", "menu-4-prompt": "<p>输入一个新名字,不要带空格哦:</p>\n<p>0. 返回</p>\n<p>q. 退出</p>", "menu-4-error-invalid-name": "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", "menu-4-success": "<p>修改成功!</p>", "add-type": "<p>请选择服务器的类型:</p>\n{server_type_list}\n<p>q. 退出</p>", "add-url": "<p>请输入服务器的 url:</p>\n<p>q. 退出</p>", "add-invalid-url": "<p>URL 格式不正确!请输入有效的 url 地址。</p>", "add-too-many-attempts": "<p>尝试次数过多,操作已取消。</p>", "add-name": "<p>收到!为服务器取一个名字吧,不要带空格哦:</p>\n<p>q. 退出</p>", "add-invalid_name": "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", "add-success": "<p>添加成功啦,服务器信息如下:</p>\n<p>[{serverName}]</p>\n<p>类型:{serverType}</p>" } } } };
|
|
1832
1930
|
|
|
1833
1931
|
// src/core/index.ts
|
|
1834
1932
|
var name5 = "Noah-Core";
|
|
@@ -2066,6 +2164,7 @@ var SDVXDrawer = class extends BaseDrawer {
|
|
|
2066
2164
|
}
|
|
2067
2165
|
} catch (error) {
|
|
2068
2166
|
this.ctx.logger("SDVX-Drawer").warn(`Failed to load jacket image: ${error.message}`);
|
|
2167
|
+
jacketImage = null;
|
|
2069
2168
|
}
|
|
2070
2169
|
const canvas = new Canvas(bgImage.width, bgImage.height);
|
|
2071
2170
|
const ctx = canvas.getContext("2d");
|
|
@@ -2073,28 +2172,30 @@ var SDVXDrawer = class extends BaseDrawer {
|
|
|
2073
2172
|
ctx.imageSmoothingQuality = "high";
|
|
2074
2173
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
2075
2174
|
ctx.drawImage(bgImage, 0, 0);
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2175
|
+
if (jacketImage) {
|
|
2176
|
+
ctx.save();
|
|
2177
|
+
ctx.translate(556, 17);
|
|
2178
|
+
ctx.beginPath();
|
|
2179
|
+
const r = 16, w = 100, h9 = 200, x0 = 0, y0 = 0;
|
|
2180
|
+
ctx.moveTo(x0 + r, y0);
|
|
2181
|
+
ctx.lineTo(x0 + w - r, y0);
|
|
2182
|
+
ctx.arcTo(x0 + w, y0, x0 + w, y0 + r, r);
|
|
2183
|
+
ctx.lineTo(x0 + w, y0 + h9 - r);
|
|
2184
|
+
ctx.arcTo(x0 + w, y0 + h9, x0 + w - r, y0 + h9, r);
|
|
2185
|
+
ctx.lineTo(x0 + r, y0 + h9);
|
|
2186
|
+
ctx.arcTo(x0, y0 + h9, x0, y0 + h9 - r, r);
|
|
2187
|
+
ctx.lineTo(x0, y0 + r);
|
|
2188
|
+
ctx.arcTo(x0, y0, x0 + r, y0, r);
|
|
2189
|
+
ctx.closePath();
|
|
2190
|
+
const circleRadius = 14;
|
|
2191
|
+
const circleX = x0 + w;
|
|
2192
|
+
const circleY = y0 + h9 / 2;
|
|
2193
|
+
ctx.moveTo(circleX + circleRadius, circleY);
|
|
2194
|
+
ctx.arc(circleX, circleY, circleRadius, 0, Math.PI * 2, true);
|
|
2195
|
+
ctx.clip();
|
|
2196
|
+
ctx.drawImage(jacketImage, -100, 0, 200, 200);
|
|
2197
|
+
ctx.restore();
|
|
2198
|
+
}
|
|
2098
2199
|
ctx.drawImage(ticketBgImage, 0, 0);
|
|
2099
2200
|
let mainTitle = "";
|
|
2100
2201
|
let subTitle = "";
|
|
@@ -4975,7 +5076,10 @@ function vf(ctx, config, logger5) {
|
|
|
4975
5076
|
} else {
|
|
4976
5077
|
session.send(import_koishi14.h.image(imageBuffer, "image/jpg"));
|
|
4977
5078
|
}
|
|
4978
|
-
const
|
|
5079
|
+
const sortedScores = [...best50ScoreList].sort((a, b) => b.extra.volforce - a.extra.volforce).slice(0, 50);
|
|
5080
|
+
const total = sortedScores.reduce((sum, score) => sum + score.extra.volforce, 0);
|
|
5081
|
+
const totalVolforce = Math.round(total / 50 * 1e3) / 1e3;
|
|
5082
|
+
console.log(totalVolforce);
|
|
4979
5083
|
if (totalVolforce >= 20) {
|
|
4980
5084
|
try {
|
|
4981
5085
|
await new Promise((resolve3) => setTimeout(resolve3, 2e3));
|
|
@@ -5084,7 +5188,8 @@ var assetConfig = import_koishi16.Schema.object({
|
|
|
5084
5188
|
var import_koishi17 = require("koishi");
|
|
5085
5189
|
var coreConfig = import_koishi17.Schema.object({
|
|
5086
5190
|
adminUsers: import_koishi17.Schema.array(String).role("table"),
|
|
5087
|
-
guildNameCards: import_koishi17.Schema.array(String).role("table").default(["Noah | /help 获取食用指南"])
|
|
5191
|
+
guildNameCards: import_koishi17.Schema.array(String).role("table").default(["Noah | /help 获取食用指南"]),
|
|
5192
|
+
maoServerUrl: import_koishi17.Schema.string().default("http://maomani.cn:573")
|
|
5088
5193
|
}).i18n({
|
|
5089
5194
|
"en-US": en_US_default2._config,
|
|
5090
5195
|
"zh-CN": zh_CN_default2._config
|
package/lib/types/config.d.ts
CHANGED