feat: Add information command

This commit is contained in:
Siwoo Jeon 2024-09-27 21:44:46 +09:00
parent dfa6b75b32
commit 9526aeb238
Signed by: migan
GPG key ID: 036E9A8C5E8E48DA
4 changed files with 73 additions and 5 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "muffinbot", "name": "muffinbot",
"version": "4.0.0-pudding.e240924a", "version": "4.0.0-pudding.e240927a",
"main": "dist/index.js", "main": "dist/index.js",
"private": true, "private": true,
"dependencies": { "dependencies": {

View file

@ -12,16 +12,17 @@ import './interaction-handlers/_load'
import './listeners/_load' import './listeners/_load'
import './Commands/_load' import './Commands/_load'
const release = version
.slice((semver.coerce(version)?.toString() + '-').length)
.split('.')[1]
container.config = config container.config = config
container.prefix = config.bot.prefix container.prefix = config.bot.prefix
container.version = version container.version = version
container.database = new PrismaClient() container.database = new PrismaClient()
container.dokdoAliases = ['dokdo', 'dok', 'Dokdo', 'Dok', '테스트'] container.dokdoAliases = ['dokdo', 'dok', 'Dokdo', 'Dok', '테스트']
container.chatBot = new ChatBot(container.database) container.chatBot = new ChatBot(container.database)
container.lastUpdated = new Date('2024-09-27')
const release = version
.slice((semver.coerce(version)?.toString() + '-').length)
.split('.')[1]
if (release.startsWith('e')) { if (release.startsWith('e')) {
container.release = 'EXPERIMENTAL' container.release = 'EXPERIMENTAL'
@ -71,6 +72,7 @@ declare module '@sapphire/framework' {
dokdoAliases: string[] dokdoAliases: string[]
config: Config config: Config
release: 'EXPERIMENTAL' | 'DEV' | 'PREVIEW' | 'RELEASE' release: 'EXPERIMENTAL' | 'DEV' | 'PREVIEW' | 'RELEASE'
lastUpdated: Date
} }
} }

View file

@ -1,5 +1,6 @@
import './learning_data' import './learning_data'
import './deleteLearn' import './deleteLearn'
import './information'
import './learn' import './learn'
import './help' import './help'
import './list' import './list'

View file

@ -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<Command.Options>({
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',
})