koishi-plugin-echo-cave 1.16.7 → 1.16.9

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.cjs +4 -12
  2. package/package.json +1 -1
package/lib/index.cjs CHANGED
@@ -169,12 +169,6 @@ function createTextMsg(content) {
169
169
  function parseUserIds(userIds) {
170
170
  const parsedUserIds = [];
171
171
  for (const userIdStr of userIds) {
172
- if (userIdStr === "all") {
173
- return {
174
- parsedUserIds: [],
175
- error: "invalid_all_mention"
176
- };
177
- }
178
172
  try {
179
173
  const cqCode = import_koishi_plugin_adapter_onebot.CQCode.from(userIdStr);
180
174
  if (cqCode.type === "at") {
@@ -195,10 +189,7 @@ function parseUserIds(userIds) {
195
189
  }
196
190
  }
197
191
  } catch (e) {
198
- const num = Number(userIdStr);
199
- if (!Number.isNaN(num)) {
200
- parsedUserIds.push(String(num));
201
- }
192
+ parsedUserIds.push(userIdStr.split(":")[1]);
202
193
  }
203
194
  }
204
195
  return {
@@ -592,7 +583,7 @@ function apply(ctx, cfg) {
592
583
  ctx.command("cave [id:number]").action(
593
584
  async ({ session }, id) => await getCave(ctx, session, cfg, id)
594
585
  );
595
- ctx.command("cave.echo [...userIds:string]").action(
586
+ ctx.command("cave.echo [...userIds:user]").action(
596
587
  async ({ session }, ...userIds) => await addCave(ctx, session, cfg, userIds)
597
588
  );
598
589
  ctx.command("cave.wipe <id:number>").action(
@@ -602,7 +593,7 @@ function apply(ctx, cfg) {
602
593
  ctx.command("cave.trace").action(
603
594
  async ({ session }) => await getCaveListByOriginUser(ctx, session)
604
595
  );
605
- ctx.command("cave.bind <id:number> <...userIds:string>", { authority: 4 }).action(
596
+ ctx.command("cave.bind <id:number> <...userIds:user>", { authority: 4 }).action(
606
597
  async ({ session }, id, ...userIds) => await bindUsersToCave(ctx, session, id, userIds)
607
598
  );
608
599
  }
@@ -721,6 +712,7 @@ async function addCave(ctx, session, cfg, userIds) {
721
712
  const messageId = quote.id;
722
713
  let parsedUserIds = [];
723
714
  if (userIds && userIds.length > 0) {
715
+ ctx.logger.info(`Original userIds in addCave: ${JSON.stringify(userIds)}`);
724
716
  const result = parseUserIds(userIds);
725
717
  if (result.error === "invalid_all_mention") {
726
718
  return session.text(".invalidAllMention");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-echo-cave",
3
3
  "description": "Group echo cave",
4
- "version": "1.16.7",
4
+ "version": "1.16.9",
5
5
  "main": "lib/index.cjs",
6
6
  "typings": "lib/index.d.ts",
7
7
  "type": "module",