koishi-plugin-xxck-1 0.2.3 → 0.2.5
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 +14 -6
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -2096,14 +2096,22 @@ async function apply(ctx, config) {
|
|
|
2096
2096
|
ctx.command("WWC对战", "挑战他人对战(必须@)").action(async (argv) => {
|
|
2097
2097
|
const session = argv.session;
|
|
2098
2098
|
if (!session) return;
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2099
|
+
let targetQQ = null;
|
|
2100
|
+
if (session.quote?.user.id) {
|
|
2101
|
+
targetQQ = String(session.quote.user.id);
|
|
2102
|
+
} else {
|
|
2103
|
+
const match = session.content?.match(/\[CQ:at,qq=(\d+)\]/);
|
|
2104
|
+
if (match) targetQQ = match[1];
|
|
2105
|
+
}
|
|
2106
|
+
if (!targetQQ) {
|
|
2107
|
+
return await session.send(build_msg(session, "请@你要挑战的人,如:WWC对战@XXX"));
|
|
2108
|
+
}
|
|
2109
|
+
await doBattleChallenge(ctx, session, targetQQ);
|
|
2103
2110
|
});
|
|
2104
2111
|
ctx.command("同意", "同意对战").action(async (argv) => {
|
|
2105
2112
|
const session = argv.session;
|
|
2106
|
-
if (session)
|
|
2113
|
+
if (!session) return;
|
|
2114
|
+
await doBattleAgree(ctx, session);
|
|
2107
2115
|
});
|
|
2108
2116
|
ctx.command("拒绝", "拒绝对战").action(async (argv) => {
|
|
2109
2117
|
const session = argv.session;
|
|
@@ -2111,7 +2119,7 @@ async function apply(ctx, config) {
|
|
|
2111
2119
|
const qq = session.userId;
|
|
2112
2120
|
if (battlePending2.has(qq)) {
|
|
2113
2121
|
battlePending2.delete(qq);
|
|
2114
|
-
await session.send("已拒绝对战");
|
|
2122
|
+
await session.send(build_msg(session, "已拒绝对战"));
|
|
2115
2123
|
}
|
|
2116
2124
|
});
|
|
2117
2125
|
ctx.command("WWC对战记录", "查看对战数据、胜率、连胜、最近5场").action(async (argv) => {
|