koishi-plugin-xxck-1 0.2.3 → 0.2.4
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 +10 -4
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -2096,10 +2096,16 @@ 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
|
-
const
|
|
2101
|
-
|
|
2102
|
-
|
|
2099
|
+
let targetQQ = null;
|
|
2100
|
+
const content = session.content ?? "";
|
|
2101
|
+
const atMatch = content.match(/\[CQ:at,qq=(\d+)\]/);
|
|
2102
|
+
if (atMatch) {
|
|
2103
|
+
targetQQ = atMatch[1];
|
|
2104
|
+
}
|
|
2105
|
+
if (!targetQQ) {
|
|
2106
|
+
return await session.send(build_msg(session, "请@你要挑战的人,例如:WWC对战@XXX"));
|
|
2107
|
+
}
|
|
2108
|
+
await doBattleChallenge(ctx, session, targetQQ);
|
|
2103
2109
|
});
|
|
2104
2110
|
ctx.command("同意", "同意对战").action(async (argv) => {
|
|
2105
2111
|
const session = argv.session;
|