koishi-plugin-echo-cave 1.2.0 → 1.3.0
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 +14 -0
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -149,6 +149,9 @@ function apply(ctx) {
|
|
|
149
149
|
ctx.command("cave.echo", "\u5C06\u6D88\u606F\u5B58\u5165\u56DE\u58F0\u6D1E\u7A74").action(
|
|
150
150
|
async ({ session }) => await addCave(ctx, session)
|
|
151
151
|
);
|
|
152
|
+
ctx.command("cave.wipe <id:number>", "\u62B9\u53BB\u7279\u5B9A id \u7684\u56DE\u58F0\u6D1E\u4FE1\u606F", {
|
|
153
|
+
authority: 4
|
|
154
|
+
}).action(async ({ session }, id) => await deleteCave(ctx, session, id));
|
|
152
155
|
}
|
|
153
156
|
async function getCave(ctx, session, id) {
|
|
154
157
|
if (!session.guildId) {
|
|
@@ -173,6 +176,17 @@ async function getCave(ctx, session, id) {
|
|
|
173
176
|
}
|
|
174
177
|
await sendCaveMsg(session, caveMsg);
|
|
175
178
|
}
|
|
179
|
+
async function deleteCave(ctx, session, id) {
|
|
180
|
+
if (!session.guildId) {
|
|
181
|
+
return "\u274C \u8BF7\u5728\u7FA4\u804A\u4E2D\u4F7F\u7528\u8BE5\u547D\u4EE4\uFF01";
|
|
182
|
+
}
|
|
183
|
+
const caves = await ctx.database.get("echo_cave", id);
|
|
184
|
+
if (caves.length === 0) {
|
|
185
|
+
return "\u{1F50D} \u672A\u627E\u5230\u8BE5 ID \u7684\u56DE\u58F0\u6D1E\u6D88\u606F";
|
|
186
|
+
}
|
|
187
|
+
await ctx.database.remove("echo_cave", id);
|
|
188
|
+
return `\u2705 \u5DF2\u6210\u529F\u62B9\u53BB\u56DE\u58F0\u6D1E\u6D88\u606F ID\uFF1A${id}`;
|
|
189
|
+
}
|
|
176
190
|
async function addCave(ctx, session) {
|
|
177
191
|
if (!session.guildId) {
|
|
178
192
|
return "\u274C \u8BF7\u5728\u7FA4\u804A\u4E2D\u4F7F\u7528\u8BE5\u547D\u4EE4\uFF01";
|