koishi-plugin-xxck-1 0.2.6 → 0.2.7
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 +23 -5
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -2087,13 +2087,29 @@ async function apply(ctx, config) {
|
|
|
2087
2087
|
const session = argv.session;
|
|
2088
2088
|
if (!session) return;
|
|
2089
2089
|
const content = session.content || "";
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2090
|
+
let targetQQ = null;
|
|
2091
|
+
const cqMatch = content.match(/\[CQ:at,qq=(\d+)\]/i);
|
|
2092
|
+
if (cqMatch) {
|
|
2093
|
+
targetQQ = cqMatch[1];
|
|
2094
|
+
} else {
|
|
2095
|
+
const atMatch = content.match(/@(\d+)/);
|
|
2096
|
+
if (atMatch) {
|
|
2097
|
+
targetQQ = atMatch[1];
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
if (!targetQQ) {
|
|
2101
|
+
return await session.send(build_msg(session, "请@你要挑战的人,如:WWC对战@123456"));
|
|
2102
|
+
}
|
|
2103
|
+
await doBattleChallenge(ctx, session, targetQQ);
|
|
2093
2104
|
});
|
|
2094
2105
|
ctx.command("同意", "同意对战").action(async (argv) => {
|
|
2095
2106
|
const session = argv.session;
|
|
2096
|
-
if (session)
|
|
2107
|
+
if (!session) return;
|
|
2108
|
+
const qq = session.userId?.toString();
|
|
2109
|
+
if (!qq || !battlePending2.has(qq)) {
|
|
2110
|
+
return await session.send(build_msg(session, "没有待处理的对战请求"));
|
|
2111
|
+
}
|
|
2112
|
+
await doBattleAgree(ctx, session);
|
|
2097
2113
|
});
|
|
2098
2114
|
ctx.command("拒绝", "拒绝对战").action(async (argv) => {
|
|
2099
2115
|
const session = argv.session;
|
|
@@ -2101,7 +2117,9 @@ async function apply(ctx, config) {
|
|
|
2101
2117
|
const qq = session.userId?.toString();
|
|
2102
2118
|
if (qq && battlePending2.has(qq)) {
|
|
2103
2119
|
battlePending2.delete(qq);
|
|
2104
|
-
await session.send(build_msg(session, "
|
|
2120
|
+
await session.send(build_msg(session, "已拒绝对战"));
|
|
2121
|
+
} else {
|
|
2122
|
+
await session.send(build_msg(session, "没有待处理的对战请求"));
|
|
2105
2123
|
}
|
|
2106
2124
|
});
|
|
2107
2125
|
ctx.command("WWC对战记录", "查看对战记录").action(async (argv) => {
|