import { Command, container } from '@sapphire/framework' import { ApplyOptions } from '@sapphire/decorators' import { Message, codeBlock } from 'discord.js' @ApplyOptions({ name: '리스트', aliases: ['list', '목록'], description: '당신이 가ㄹ르쳐준 단어를 나열해요.', detailedDescription: { usage: '머핀아 리스트', }, }) class ListCommand extends Command { public async messageRun(msg: Message) { const db = this.container.database const data = await db.learn.findMany({ where: { user_id: msg.author.id, }, }) const list: string[] = [] if (!data[0]) { return await msg.reply('당신ㄴ은 단어를 가르쳐준 기억이 없ㅅ는데요.') } for (const listData of data) { list.push(listData.command) } await msg.reply({ embeds: [ { title: `${msg.author.username}님의 지식`, description: `총합: ${data.length}개\n${codeBlock( 'md', list.map(item => `- ${item}`).join('\n'), )}`, color: this.container.embedColor, timestamp: new Date().toISOString(), }, ], }) } } void container.stores.loadPiece({ piece: ListCommand, name: 'list', store: 'commands', })