koishi-plugin-echo-cave 1.5.0 → 1.6.1
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
|
@@ -221,7 +221,7 @@ async function sendCaveMsg(ctx, session, caveMsg) {
|
|
|
221
221
|
const needsNewline = last?.type === "text";
|
|
222
222
|
content.unshift(createTextMsg(chosen.prefix));
|
|
223
223
|
content.push(
|
|
224
|
-
createTextMsg(`${needsNewline ? "\n" : ""}${chosen.suffix}`)
|
|
224
|
+
createTextMsg(`${needsNewline ? "\n\n" : ""}${chosen.suffix}`)
|
|
225
225
|
);
|
|
226
226
|
await session.onebot.sendGroupMsg(channelId, content);
|
|
227
227
|
}
|
|
@@ -273,6 +273,9 @@ function apply(ctx) {
|
|
|
273
273
|
ctx.command("cave.listen", "\u83B7\u5F97\u7531\u81EA\u5DF1\u6295\u7A3F\u7684\u56DE\u58F0\u6D1E\u5217\u8868").action(
|
|
274
274
|
async ({ session }) => await getCaveListByUser(ctx, session)
|
|
275
275
|
);
|
|
276
|
+
ctx.command("cave.trace", "\u83B7\u5F97\u81EA\u5DF1\u53D1\u8A00\u7684\u56DE\u58F0\u6D1E\u5217\u8868").action(
|
|
277
|
+
async ({ session }) => await getCaveListByOriginUser(ctx, session)
|
|
278
|
+
);
|
|
276
279
|
}
|
|
277
280
|
async function getCaveListByUser(ctx, session) {
|
|
278
281
|
if (!session.guildId) {
|
|
@@ -294,6 +297,26 @@ async function getCaveListByUser(ctx, session) {
|
|
|
294
297
|
}
|
|
295
298
|
return response;
|
|
296
299
|
}
|
|
300
|
+
async function getCaveListByOriginUser(ctx, session) {
|
|
301
|
+
if (!session.guildId) {
|
|
302
|
+
return "\u274C \u8BF7\u5728\u7FA4\u804A\u4E2D\u4F7F\u7528\u8BE5\u547D\u4EE4\uFF01";
|
|
303
|
+
}
|
|
304
|
+
const { userId, channelId } = session;
|
|
305
|
+
const caves = await ctx.database.get("echo_cave", {
|
|
306
|
+
originUserId: userId,
|
|
307
|
+
channelId
|
|
308
|
+
});
|
|
309
|
+
if (caves.length === 0) {
|
|
310
|
+
return '\u{1F680} \u60A8\u5728\u56DE\u58F0\u6D1E\u4E2D\u6682\u65E0\u53D1\u8A00\u88AB\u6295\u7A3F\uFF0C\u5FEB\u4F7F\u7528 "cave.echo" \u547D\u4EE4\u6DFB\u52A0\u7B2C\u4E00\u6761\u6D88\u606F\u5427\uFF01';
|
|
311
|
+
}
|
|
312
|
+
let response = `\u{1F4DC} \u60A8\u5728\u672C\u9891\u9053\u53D1\u8A00\u7684\u56DE\u58F0\u6D1E\u6D88\u606F\u5217\u8868\uFF1A
|
|
313
|
+
`;
|
|
314
|
+
for (const cave of caves) {
|
|
315
|
+
response += `ID: ${cave.id} | \u521B\u5EFA\u65F6\u95F4: ${formatDate(cave.createTime)}
|
|
316
|
+
`;
|
|
317
|
+
}
|
|
318
|
+
return response;
|
|
319
|
+
}
|
|
297
320
|
async function getCave(ctx, session, id) {
|
|
298
321
|
if (!session.guildId) {
|
|
299
322
|
return "\u274C \u8BF7\u5728\u7FA4\u804A\u4E2D\u4F7F\u7528\u8BE5\u547D\u4EE4\uFF01";
|