This commit is contained in:
Siwoo Jeon 2023-12-02 16:22:48 +09:00
parent f3bbbdc532
commit 785db5431b
Signed by: migan
GPG key ID: C4151385FFD2082A
2 changed files with 19 additions and 11 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "muffin-ai-arujak", "name": "muffin-ai-arujak",
"version": "2.0.0-81-oreo", "version": "2.0.0-82-oreo",
"main": "dist/index.js", "main": "dist/index.js",
"private": true, "private": true,
"dependencies": { "dependencies": {

View file

@ -57,24 +57,32 @@ export default class MuffinAI extends Client {
console.log(`먹힐 준비 완료`) console.log(`먹힐 준비 완료`)
}).on('messageCreate', async msg => { }).on('messageCreate', async msg => {
const args: string[] = msg.content
.slice(prefix.length)
.trim()
.split(/ +/g)
if (NODE_ENV === 'development') console.log(args)
if (msg.author.bot) return if (msg.author.bot) return
if (msg.content.startsWith('머핀아 ')) { if (msg.content.startsWith('머핀아 ')) {
if (msg.channel instanceof TextChannel) { if (msg.channel instanceof TextChannel) {
await msg.channel.sendTyping() await msg.channel.sendTyping()
this.chatBot // const command = this.#modules.get(args.shift()!.toLowerCase())
.getResponse(msg)
.then(response => { if (command) {
msg.channel.send(response) if (command.noPerm && msg.author.id !== config.bot.owner_ID)
}) return await noPerm(msg)
command.execute(msg, args)
} else {
const response = await this.chatBot.getResponse(msg)
await msg.channel.send(response)
}
} }
} else if (msg.content.startsWith(prefix)) { } else if (msg.content.startsWith(prefix)) {
if (msg.channel instanceof TextChannel) if (msg.channel.nsfw) return if (msg.channel instanceof TextChannel) if (msg.channel.nsfw) return
await msg.channel.sendTyping()
const args: string[] = msg.content
.slice(prefix.length)
.trim()
.split(/ +/g)
if (NODE_ENV === 'development') console.log(args)
const command = this.#modules.get(args.shift()!.toLowerCase()) const command = this.#modules.get(args.shift()!.toLowerCase())
if (!command) return if (!command) return
if (command.noPerm && msg.author.id !== config.bot.owner_ID) if (command.noPerm && msg.author.id !== config.bot.owner_ID)