koishi-plugin-echo-cave 1.6.3 → 1.6.5
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 +5 -6
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -347,16 +347,16 @@ async function deleteCave(ctx, session, id) {
|
|
|
347
347
|
if (!session.guildId) {
|
|
348
348
|
return "\u274C \u8BF7\u5728\u7FA4\u804A\u4E2D\u4F7F\u7528\u8BE5\u547D\u4EE4\uFF01";
|
|
349
349
|
}
|
|
350
|
+
if (!id) {
|
|
351
|
+
return "\u274C \u8BF7\u63D0\u4F9B\u8981\u5220\u9664\u7684\u56DE\u58F0\u6D1E\u6D88\u606F ID\uFF01";
|
|
352
|
+
}
|
|
350
353
|
const caves = await ctx.database.get("echo_cave", id);
|
|
351
354
|
if (caves.length === 0) {
|
|
352
355
|
return "\u{1F50D} \u672A\u627E\u5230\u8BE5 ID \u7684\u56DE\u58F0\u6D1E\u6D88\u606F";
|
|
353
356
|
}
|
|
354
357
|
const caveMsg = caves[0];
|
|
355
358
|
const currentUserId = session.userId;
|
|
356
|
-
const user = await
|
|
357
|
-
session.platform,
|
|
358
|
-
currentUserId
|
|
359
|
-
);
|
|
359
|
+
const user = await ctx.database.getUser(session.platform, currentUserId);
|
|
360
360
|
const userAuthority = user.authority;
|
|
361
361
|
if (currentUserId !== caveMsg.userId && currentUserId !== caveMsg.originUserId && userAuthority < 4) {
|
|
362
362
|
return "\u26D4 \u60A8\u6CA1\u6709\u6743\u9650\u5220\u9664\u6B64\u6D88\u606F\uFF01\u53EA\u6709\u6D88\u606F\u7684\u5B58\u50A8\u8005\u3001\u539F\u59CB\u53D1\u9001\u8005\u6216\u7BA1\u7406\u5458\u53EF\u4EE5\u5220\u9664\u3002";
|
|
@@ -407,8 +407,7 @@ async function addCave(ctx, session) {
|
|
|
407
407
|
`\u2705 \u56DE\u58F0\u6D1E\u6D88\u606F\u5DF2\u6210\u529F\u5B58\u5165\uFF0C\u6D88\u606F ID\uFF1A${result.id}`
|
|
408
408
|
);
|
|
409
409
|
} catch (error) {
|
|
410
|
-
|
|
411
|
-
return "\u274C \u4E0A\u67B6\u5546\u54C1\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\uFF01";
|
|
410
|
+
return "\u274C \u56DE\u58F0\u6D1E\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\uFF01";
|
|
412
411
|
}
|
|
413
412
|
}
|
|
414
413
|
// Annotate the CommonJS export names for ESM import in node:
|