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.
- package/lib/index.cjs +4 -12
- 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
|
-
|
|
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:
|
|
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:
|
|
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");
|