diff --git a/package.json b/package.json index 84666ee..ba5e41d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "muffin-ai-arujak", - "version": "2.0.0-oreo.d240530b", + "version": "2.0.0-oreo.b240530a", "main": "dist/index.js", "private": true, "dependencies": { diff --git a/src/Client.ts b/src/Client.ts index 680431d..cde16f3 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -13,7 +13,7 @@ import Dokdo from 'dokdo' const prefix = config.bot.prefix -export default class MuffinAI extends Client { +export default class MuffinBot extends Client { get chatBot() { return new ChatBot() } @@ -26,8 +26,10 @@ export default class MuffinAI extends Client { prefix, }) } + get modules(): Collection { + return this.#modules + } #modules: Collection = new Collection() - public constructor() { super({ intents: [ @@ -45,7 +47,7 @@ export default class MuffinAI extends Client { readdirSync(join(__dirname, 'Commands')).forEach(file => { const a = require(join(__dirname, 'Commands', file)) const b: Command = new a.default() - this.#modules.set(b.name, b) + this.modules.set(b.name, b) if (NODE_ENV === 'development') console.log(`${b.name}가 로ㄷ드됨`) }) @@ -75,7 +77,7 @@ export default class MuffinAI extends Client { } else { if (msg.channel instanceof TextChannel) { await msg.channel.sendTyping() - const command = this.#modules.get(args.shift()!.toLowerCase()) + const command = this.modules.get(args.shift()!.toLowerCase()) if (command) { if (command.noPerm && msg.author.id !== config.bot.owner_ID) @@ -97,5 +99,6 @@ export default class MuffinAI extends Client { declare module 'discord.js' { interface Client { get chatBot(): ChatBot + get modules(): Collection } } diff --git a/src/Commands/help.ts b/src/Commands/help.ts new file mode 100644 index 0000000..6b71831 --- /dev/null +++ b/src/Commands/help.ts @@ -0,0 +1,32 @@ +import { Command } from '../modules' +import { codeBlock, type Message } from 'discord.js' +import { version } from '../../package.json' + +export default class extends Command { + public constructor() { + super('도움말') + } + + public async execute(msg: Message, args: string[]) { + const commandList: string[] = [] + + msg.client.modules.forEach(module => { + commandList.push(module.name) + }) + + await msg.reply({ + embeds: [ + { + title: '머핀봇의 도움말', + description: codeBlock( + 'md', + commandList.map(item => `- ${item}`).join('\n'), + ), + footer: { + text: `머핀봇 버전: ${version}`, + }, + }, + ], + }) + } +}