feat: Add list item's description(result)

This commit is contained in:
Siwoo Jeon 2025-02-03 15:38:27 +09:00
parent 41fd07f4e7
commit 0cf961718c
Signed by: migan
GPG key ID: 036E9A8C5E8E48DA
2 changed files with 11 additions and 5 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "muffinbot", "name": "muffinbot",
"version": "4.1.0-pudding.r241119a", "version": "4.1.1-pudding.r250203a",
"main": "dist/src/index.js", "main": "dist/src/index.js",
"private": true, "private": true,
"dependencies": { "dependencies": {

View file

@ -27,7 +27,10 @@ export default class ListCommand extends Command {
user_id: user.id, user_id: user.id,
}, },
}) })
const list: string[] = [] const list: {
command: string
result: string
}[] = []
if (!data[0]) { if (!data[0]) {
return await ctx.reply({ return await ctx.reply({
@ -36,8 +39,11 @@ export default class ListCommand extends Command {
}) })
} }
for (const listData of data) { for (const { command, result } of data) {
list.push(listData.command) list.push({
command,
result,
})
} }
await ctx.reply({ await ctx.reply({
@ -46,7 +52,7 @@ export default class ListCommand extends Command {
title: `${user.username}님의 지식`, title: `${user.username}님의 지식`,
description: `총합: ${data.length}\n${codeBlock( description: `총합: ${data.length}\n${codeBlock(
'md', 'md',
list.map(item => `- ${item}`).join('\n'), list.map(item => `- ${item.command}: ${item.result}`).join('\n'),
)}`, )}`,
color: this.container.embedColors.default, color: this.container.embedColors.default,
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),