From 9526aeb2384711742d6db3cd86496da6a10187aa Mon Sep 17 00:00:00 2001 From: Siwoo Jeon Date: Fri, 27 Sep 2024 21:44:46 +0900 Subject: [PATCH] feat: Add information command --- package.json | 2 +- src/Client.ts | 10 +++--- src/Commands/_load.ts | 1 + src/Commands/information.ts | 65 +++++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 src/Commands/information.ts diff --git a/package.json b/package.json index d47a9b8..3c14a0f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "muffinbot", - "version": "4.0.0-pudding.e240924a", + "version": "4.0.0-pudding.e240927a", "main": "dist/index.js", "private": true, "dependencies": { diff --git a/src/Client.ts b/src/Client.ts index 9e52d82..88fa76f 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -12,16 +12,17 @@ import './interaction-handlers/_load' import './listeners/_load' import './Commands/_load' +const release = version + .slice((semver.coerce(version)?.toString() + '-').length) + .split('.')[1] + container.config = config container.prefix = config.bot.prefix container.version = version container.database = new PrismaClient() container.dokdoAliases = ['dokdo', 'dok', 'Dokdo', 'Dok', '테스트'] container.chatBot = new ChatBot(container.database) - -const release = version - .slice((semver.coerce(version)?.toString() + '-').length) - .split('.')[1] +container.lastUpdated = new Date('2024-09-27') if (release.startsWith('e')) { container.release = 'EXPERIMENTAL' @@ -71,6 +72,7 @@ declare module '@sapphire/framework' { dokdoAliases: string[] config: Config release: 'EXPERIMENTAL' | 'DEV' | 'PREVIEW' | 'RELEASE' + lastUpdated: Date } } diff --git a/src/Commands/_load.ts b/src/Commands/_load.ts index b8bf690..8b49f57 100644 --- a/src/Commands/_load.ts +++ b/src/Commands/_load.ts @@ -1,5 +1,6 @@ import './learning_data' import './deleteLearn' +import './information' import './learn' import './help' import './list' diff --git a/src/Commands/information.ts b/src/Commands/information.ts new file mode 100644 index 0000000..7e94c30 --- /dev/null +++ b/src/Commands/information.ts @@ -0,0 +1,65 @@ +import { ApplyOptions } from '@sapphire/decorators' +import { Command, container } from '@sapphire/framework' +import { Message } from 'discord.js' +import { platform, arch } from 'os' + +@ApplyOptions({ + name: '정보', + description: '머핀봇의 정보를 알ㄹ려줘요.', + detailedDescription: { + usage: '머핀아 정보', + }, +}) +class InformationCommand extends Command { + public async messageRun(msg: Message) { + await msg.reply({ + embeds: [ + { + title: `${this.container.client.user?.username}의 정ㅂ보`, + fields: [ + { + name: '구동ㅎ환경', + value: `${platform()} ${arch()}`, + inline: false, + }, + { + name: '버ㅈ전', + value: this.container.version, + inline: true, + }, + { + name: '채ㄴ널', + value: this.container.release.toLowerCase(), + inline: true, + }, + { + name: '최근 업ㄷ데이트 날짜', + value: this.container.lastUpdated.toLocaleDateString('ko', { + dateStyle: 'long', + }), + inline: true, + }, + { + name: '개ㅂ발자', + value: ( + await this.container.client.users.fetch( + this.container.config.bot.owner_ID, + ) + ).username, + inline: false, + }, + ], + thumbnail: { + url: this.container.client.user!.displayAvatarURL()!, + }, + }, + ], + }) + } +} + +void container.stores.loadPiece({ + piece: InformationCommand, + name: 'information', + store: 'commands', +})