koishi-plugin-xxck-1 0.2.6 → 0.2.8

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.
Files changed (2) hide show
  1. package/lib/index.js +16 -5
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -2087,13 +2087,22 @@ async function apply(ctx, config) {
2087
2087
  const session = argv.session;
2088
2088
  if (!session) return;
2089
2089
  const content = session.content || "";
2090
- const atMatch = content.match(/\[CQ:at,qq=(\d+)\]/);
2091
- if (!atMatch) return await session.send(build_msg(session, "请@你要挑战的人"));
2092
- await doBattleChallenge(ctx, session, atMatch[1]);
2090
+ const qqMatch = content.match(/@(\d+)/);
2091
+ const cqMatch = content.match(/\[CQ:at,qq=(\d+)\]/);
2092
+ const targetQQ = cqMatch?.[1] || qqMatch?.[1] || null;
2093
+ if (!targetQQ) {
2094
+ return await session.send(build_msg(session, "请@你要挑战的人,如:WWC对战@123456"));
2095
+ }
2096
+ await doBattleChallenge(ctx, session, targetQQ);
2093
2097
  });
2094
2098
  ctx.command("同意", "同意对战").action(async (argv) => {
2095
2099
  const session = argv.session;
2096
- if (session) await doBattleAgree(ctx, session);
2100
+ if (!session) return;
2101
+ const qq = session.userId?.toString();
2102
+ if (!qq || !battlePending2.has(qq)) {
2103
+ return await session.send(build_msg(session, "没有待处理的对战请求"));
2104
+ }
2105
+ await doBattleAgree(ctx, session);
2097
2106
  });
2098
2107
  ctx.command("拒绝", "拒绝对战").action(async (argv) => {
2099
2108
  const session = argv.session;
@@ -2101,7 +2110,9 @@ async function apply(ctx, config) {
2101
2110
  const qq = session.userId?.toString();
2102
2111
  if (qq && battlePending2.has(qq)) {
2103
2112
  battlePending2.delete(qq);
2104
- await session.send(build_msg(session, "已拒绝"));
2113
+ await session.send(build_msg(session, "已拒绝对战"));
2114
+ } else {
2115
+ await session.send(build_msg(session, "没有待处理的对战请求"));
2105
2116
  }
2106
2117
  });
2107
2118
  ctx.command("WWC对战记录", "查看对战记录").action(async (argv) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-xxck-1",
3
3
  "description": "自用(?)抽卡系统|完整指令说明见readme|建议使用skia-canvas|指令与本地化已经基本完成",
4
- "version": "0.2.6",
4
+ "version": "0.2.8",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [