koishi-plugin-echo-cave 1.6.2 → 1.6.4
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 +6 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -347,13 +347,18 @@ 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
|
-
|
|
359
|
+
const user = await ctx.database.getUser(session.platform, currentUserId);
|
|
360
|
+
const userAuthority = user.authority;
|
|
361
|
+
if (currentUserId !== caveMsg.userId && currentUserId !== caveMsg.originUserId && userAuthority < 4) {
|
|
357
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";
|
|
358
363
|
}
|
|
359
364
|
await ctx.database.remove("echo_cave", id);
|