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",
"version": "2.0.0-81-oreo",
"version": "2.0.0-82-oreo",
"main": "dist/index.js",
"private": true,
"dependencies": {

View file

@ -57,24 +57,32 @@ export default class MuffinAI extends Client {
console.log(`먹힐 준비 완료`)
}).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.content.startsWith('머핀아 ')) {
if (msg.channel instanceof TextChannel) {
await msg.channel.sendTyping()
this.chatBot //
.getResponse(msg)
.then(response => {
msg.channel.send(response)
})
const command = this.#modules.get(args.shift()!.toLowerCase())
if (command) {
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)) {
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())
if (!command) return
if (command.noPerm && msg.author.id !== config.bot.owner_ID)