koishi-plugin-echo-cave 1.16.15 → 1.16.16

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 +15 -25
  2. package/package.json +1 -1
package/lib/index.cjs CHANGED
@@ -135,7 +135,6 @@ var require_zh_CN = __commonJS({
135
135
  noUserIdProvided: "\u274C \u8BF7\u63D0\u4F9B\u8981\u7ED1\u5B9A\u7684\u7528\u6237 ID\uFF01",
136
136
  msgNotFound: "\u{1F50D} \u672A\u627E\u5230\u8BE5 ID \u7684\u56DE\u58F0\u6D1E\u6D88\u606F",
137
137
  userBoundSuccess: "\u2705 \u5DF2\u6210\u529F\u5C06\u7528\u6237\u7ED1\u5B9A\u5230\u56DE\u58F0\u6D1E #{0}\uFF01",
138
- userAlreadyBound: "\u2139\uFE0F \u8BE5\u7528\u6237\u5DF2\u7ED1\u5B9A\u5230\u56DE\u58F0\u6D1E #{0}\uFF01",
139
138
  userNotInGroup: "\u274C \u63D0\u4F9B\u7684\u7528\u6237 ID \u4E0D\u5168\u5C5E\u4E8E\u8BE5\u7FA4\u7EC4\uFF01",
140
139
  invalidAllMention: "\u274C \u4E0D\u652F\u6301 @\u5168\u4F53\u6210\u5458\uFF0C\u8BF7\u76F4\u63A5\u6307\u5B9A\u5177\u4F53\u7528\u6237\uFF01"
141
140
  }
@@ -169,23 +168,21 @@ function createTextMsg(content) {
169
168
  function parseUserIds(userIds) {
170
169
  const parsedUserIds = [];
171
170
  for (const userId of userIds) {
172
- try {
173
- const element = import_koishi.h.parse(userId);
174
- if (element.length === 1 && element[0].type === "at") {
175
- const userId2 = element[0].attrs.id;
176
- if (userId2 === "all") {
177
- return {
178
- parsedUserIds: [],
179
- error: "invalid_all_mention"
180
- };
181
- }
182
- parsedUserIds.push(userId2);
183
- }
184
- } catch (e) {
185
- const num = Number(userId);
186
- if (!Number.isNaN(num)) {
187
- parsedUserIds.push(userId);
171
+ const num = Number(userId);
172
+ if (!Number.isNaN(num)) {
173
+ parsedUserIds.push(userId);
174
+ continue;
175
+ }
176
+ const element = import_koishi.h.parse(userId);
177
+ if (element.length === 1 && element[0].type === "at") {
178
+ const userId2 = element[0].attrs.id;
179
+ if (userId2 === "all") {
180
+ return {
181
+ parsedUserIds: [],
182
+ error: "invalid_all_mention"
183
+ };
188
184
  }
185
+ parsedUserIds.push(userId2);
189
186
  }
190
187
  }
191
188
  return {
@@ -590,14 +587,7 @@ function apply(ctx, cfg) {
590
587
  async ({ session }) => await getCaveListByOriginUser(ctx, session)
591
588
  );
592
589
  ctx.command("cave.bind <id:number> <...userIds>", { authority: 4 }).action(
593
- async ({ session }, id, ...userIds) => {
594
- ctx.logger.info(`Binding users ${JSON.stringify(userIds)} to cave ID ${id}`);
595
- for (const uid of userIds) {
596
- ctx.logger.info(`User ID to bind: ${uid}`);
597
- ctx.logger.info(`userid type: ${typeof uid}`);
598
- }
599
- await bindUsersToCave(ctx, session, id, userIds);
600
- }
590
+ async ({ session }, id, ...userIds) => await bindUsersToCave(ctx, session, id, userIds)
601
591
  );
602
592
  }
603
593
  async function getCaveListByUser(ctx, session) {
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.15",
4
+ "version": "1.16.16",
5
5
  "main": "lib/index.cjs",
6
6
  "typings": "lib/index.d.ts",
7
7
  "type": "module",