koishi-plugin-echo-cave 1.4.1 → 1.5.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 +24 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -264,12 +264,35 @@ function apply(ctx) {
|
|
|
264
264
|
"cave [id:number]",
|
|
265
265
|
"\u968F\u673A\u83B7\u53D6 / \u83B7\u53D6\u7279\u5B9A id \u7684\u56DE\u58F0\u6D1E\u4FE1\u606F"
|
|
266
266
|
).action(async ({ session }, id) => await getCave(ctx, session, id));
|
|
267
|
-
ctx.command("cave.echo", "\u5C06\u6D88\u606F\u5B58\u5165\u56DE\u58F0\u6D1E
|
|
267
|
+
ctx.command("cave.echo", "\u5C06\u6D88\u606F\u5B58\u5165\u56DE\u58F0\u6D1E").action(
|
|
268
268
|
async ({ session }) => await addCave(ctx, session)
|
|
269
269
|
);
|
|
270
270
|
ctx.command("cave.wipe <id:number>", "\u62B9\u53BB\u7279\u5B9A id \u7684\u56DE\u58F0\u6D1E\u4FE1\u606F").action(
|
|
271
271
|
async ({ session }, id) => await deleteCave(ctx, session, id)
|
|
272
272
|
);
|
|
273
|
+
ctx.command("cave.listen", "\u83B7\u5F97\u7531\u81EA\u5DF1\u6295\u7A3F\u7684\u56DE\u58F0\u6D1E\u5217\u8868").action(
|
|
274
|
+
async ({ session }) => await getCaveListByUser(ctx, session)
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
async function getCaveListByUser(ctx, session) {
|
|
278
|
+
if (!session.guildId) {
|
|
279
|
+
return "\u274C \u8BF7\u5728\u7FA4\u804A\u4E2D\u4F7F\u7528\u8BE5\u547D\u4EE4\uFF01";
|
|
280
|
+
}
|
|
281
|
+
const { userId, channelId } = session;
|
|
282
|
+
const caves = await ctx.database.get("echo_cave", {
|
|
283
|
+
userId,
|
|
284
|
+
channelId
|
|
285
|
+
});
|
|
286
|
+
if (caves.length === 0) {
|
|
287
|
+
return '\u{1F680} \u60A8\u5728\u56DE\u58F0\u6D1E\u4E2D\u6682\u65E0\u6295\u7A3F\uFF0C\u5FEB\u4F7F\u7528 "cave.echo" \u547D\u4EE4\u6DFB\u52A0\u7B2C\u4E00\u6761\u6D88\u606F\u5427\uFF01';
|
|
288
|
+
}
|
|
289
|
+
let response = `\u{1F4DC} \u60A8\u5728\u672C\u9891\u9053\u6295\u7A3F\u7684\u56DE\u58F0\u6D1E\u6D88\u606F\u5217\u8868\uFF1A
|
|
290
|
+
`;
|
|
291
|
+
for (const cave of caves) {
|
|
292
|
+
response += `ID: ${cave.id} | \u521B\u5EFA\u65F6\u95F4: ${formatDate(cave.createTime)}
|
|
293
|
+
`;
|
|
294
|
+
}
|
|
295
|
+
return response;
|
|
273
296
|
}
|
|
274
297
|
async function getCave(ctx, session, id) {
|
|
275
298
|
if (!session.guildId) {
|