koishi-plugin-xxck-1 0.2.49 → 0.2.50
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/index.js +15 -29
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -630,8 +630,17 @@ async function _do_register(ctx, session, nickname, masterQQ) {
|
|
|
630
630
|
__name(_do_register, "_do_register");
|
|
631
631
|
async function _do_check(ctx, session, check_qq, masterQQ, all) {
|
|
632
632
|
ctx.logger.info("========== _do_check 被调用 ==========");
|
|
633
|
-
const
|
|
634
|
-
|
|
633
|
+
const userId = session.userId;
|
|
634
|
+
const isNumeric = /^\d+$/.test(userId);
|
|
635
|
+
let userQQ = userId;
|
|
636
|
+
if (!isNumeric) {
|
|
637
|
+
const records = await ctx.database.get("user_platform_map", {
|
|
638
|
+
platform_user_id: userId
|
|
639
|
+
});
|
|
640
|
+
ctx.logger.info("[手动查询] 映射表结果: " + JSON.stringify(records));
|
|
641
|
+
if (records.length) userQQ = records[0].qq;
|
|
642
|
+
}
|
|
643
|
+
ctx.logger.info(`[手动查询] userQQ=${userQQ}, masterQQ=${masterQQ}`);
|
|
635
644
|
if (userQQ !== masterQQ) {
|
|
636
645
|
return await session.send(build_msg(session, session.text("error.common.noPermission")));
|
|
637
646
|
}
|
|
@@ -726,7 +735,6 @@ async function _do_sign(ctx, session, signResetHour, signResetMinute) {
|
|
|
726
735
|
`${session.text("tip.sign.success")}
|
|
727
736
|
${session.text("tip.sign.getDraw", { count: SIGN_DRAW_COUNT, left: newDrawCount })}`
|
|
728
737
|
));
|
|
729
|
-
await giveDailyBattleShard(ctx, qq);
|
|
730
738
|
}
|
|
731
739
|
__name(_do_sign, "_do_sign");
|
|
732
740
|
async function _do_add_card(ctx, session, card_lines, masterQQ) {
|
|
@@ -1802,23 +1810,6 @@ async function _do_reject(ctx, session, rejectQQ, masterQQ) {
|
|
|
1802
1810
|
}
|
|
1803
1811
|
}
|
|
1804
1812
|
__name(_do_reject, "_do_reject");
|
|
1805
|
-
async function giveDailyBattleShard(ctx, qq) {
|
|
1806
|
-
let user = await ctx.database.get("gacha_user_battle_shard", { qq });
|
|
1807
|
-
let data = user[0] || { qq, target_card_id: "", shard: 0, awake_ticket: 0 };
|
|
1808
|
-
const own = await ctx.database.get("gacha_user_card", { qq });
|
|
1809
|
-
const pool = await ctx.database.get("gacha_battle_card", {});
|
|
1810
|
-
const avail = own.filter(
|
|
1811
|
-
(o) => pool.some((p) => p.card_id === o.card_id)
|
|
1812
|
-
).map((o) => o.card_id);
|
|
1813
|
-
if (avail.length === 0) return;
|
|
1814
|
-
let target = data.target_card_id;
|
|
1815
|
-
if (!target || !avail.includes(target)) {
|
|
1816
|
-
target = avail[Math.floor(Math.random() * avail.length)];
|
|
1817
|
-
}
|
|
1818
|
-
data.shard += 2;
|
|
1819
|
-
await ctx.database.upsert("gacha_user_battle_shard", [data]);
|
|
1820
|
-
}
|
|
1821
|
-
__name(giveDailyBattleShard, "giveDailyBattleShard");
|
|
1822
1813
|
async function _do_help(ctx, session) {
|
|
1823
1814
|
const helpMsg = session.text("command.wwc.help.title") + "\n" + session.text("command.wwc.help.register") + "\n" + session.text("command.wwc.help.sign") + "\n" + session.text("command.wwc.help.draw") + "\n" + session.text("command.wwc.help.warehouse") + "\n" + session.text("command.wwc.help.shop") + "\n" + session.text("command.wwc.help.upgrade") + "\n" + session.text("command.wwc.help.exchange") + "\n" + session.text("command.wwc.help.collection") + "\n" + session.text("command.wwc.help.ranking") + "\n" + session.text("command.wwc.help.eventStatus") + "\n" + session.text("command.wwc.help.eventDraw") + "\n" + session.text("command.wwc.help.eventExchange") + "\n" + session.text("command.wwc.help.tip");
|
|
1824
1815
|
await session.send(build_msg(session, helpMsg));
|
|
@@ -1974,15 +1965,11 @@ async function apply(ctx, config) {
|
|
|
1974
1965
|
await _do_register(ctx, session, nickname, config.masterQQ);
|
|
1975
1966
|
});
|
|
1976
1967
|
ctx.command("WWC审核 [QQ]", "审核用户昵称,仅主人可用").option("-a, --all", "通过所有待审核用户").alias("wwc审核").alias("WWC通过").action(async (argv, qq) => {
|
|
1977
|
-
ctx.logger.info("[WWC审核] action
|
|
1978
|
-
if (!argv.session)
|
|
1979
|
-
|
|
1980
|
-
return;
|
|
1981
|
-
}
|
|
1982
|
-
const session = argv.session;
|
|
1983
|
-
const isAll = !!argv.options?.["all"];
|
|
1968
|
+
ctx.logger.info("[WWC审核] action 触发,argv.options=" + JSON.stringify(argv.options));
|
|
1969
|
+
if (!argv.session) return;
|
|
1970
|
+
const isAll = !!(argv.options?.["-a"] || argv.options?.["--all"] || argv.options?.["all"]);
|
|
1984
1971
|
ctx.logger.info("[WWC审核] isAll=" + isAll + ", qq=" + qq);
|
|
1985
|
-
await _do_check(ctx, session, qq, config.masterQQ, isAll);
|
|
1972
|
+
await _do_check(ctx, argv.session, qq, config.masterQQ, isAll);
|
|
1986
1973
|
});
|
|
1987
1974
|
ctx.command("WWC驳回 <QQ:string>", "驳回昵称申请,显示QQ或原昵称").alias("wwc驳回").action(async (argv, qq) => {
|
|
1988
1975
|
if (!argv.session) return;
|
|
@@ -2133,7 +2120,6 @@ async function apply(ctx, config) {
|
|
|
2133
2120
|
if (!raw.startsWith("WWC")) return next();
|
|
2134
2121
|
if (raw.startsWith("WWC绑定QQ")) return next();
|
|
2135
2122
|
const userId = session.userId;
|
|
2136
|
-
const platform = session.platform;
|
|
2137
2123
|
const isNumeric = /^\d+$/.test(userId);
|
|
2138
2124
|
let unifiedQQ = null;
|
|
2139
2125
|
if (isNumeric) {
|