feat: Use to discord.js#Message.reply

This commit is contained in:
Siwoo Jeon 2024-05-30 18:50:14 +09:00
parent a57d3d6d69
commit b5e6e68dee
Signed by: migan
GPG key ID: C4151385FFD2082A
64 changed files with 907 additions and 27 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

894
.yarn/releases/yarn-4.2.2.cjs vendored Executable file

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,8 @@
{
"bot": {
"owner_ID": "",
"token": ""
"token": "",
"prefix": ""
},
"train": {
"user_ID": ""

View file

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

View file

@ -5,13 +5,12 @@ import {
GatewayIntentBits,
TextChannel,
} from 'discord.js'
import { Command, noPerm, ChatBot, NODE_ENV } from './modules'
import { type Command, noPerm, ChatBot, NODE_ENV } from './modules'
import { readdirSync } from 'node:fs'
import { join } from 'node:path'
import { execSync } from 'node:child_process'
import config from '../config.json'
const prefix = '멒힌아 '
const prefix = config.bot.prefix
export default class MuffinAI extends Client {
get chatBot() {
@ -37,14 +36,10 @@ export default class MuffinAI extends Client {
const a = require(join(__dirname, 'Commands', file))
const b: Command = new a.default()
this.#modules.set(b.name, b)
if (NODE_ENV === 'development') console.log(b.name)
if (NODE_ENV === 'development') console.log(`${b.name}가 로ㄷ드됨`)
})
this.once('ready', client => {
console.log(
`Build Number: ${execSync('git rev-parse --short HEAD').toString()}`,
)
function setStatus() {
client.user.setActivity({
type: ActivityType.Custom,
@ -64,7 +59,7 @@ export default class MuffinAI extends Client {
if (NODE_ENV === 'development') console.log(args)
if (msg.author.bot) return
if (msg.content.startsWith('머핀아 ')) {
if (msg.content.startsWith(prefix)) {
if (msg.channel instanceof TextChannel) {
await msg.channel.sendTyping()
const command = this.#modules.get(args.shift()!.toLowerCase())
@ -73,22 +68,12 @@ export default class MuffinAI extends Client {
if (command.noPerm && msg.author.id !== config.bot.owner_ID)
return await noPerm(msg)
command.execute(msg, args)
await command.execute(msg, args)
} else {
const response = await this.chatBot.getResponse(msg)
await msg.channel.send(response)
await msg.reply(response)
}
}
} else if (msg.content.startsWith(prefix)) {
if (msg.channel instanceof TextChannel) if (msg.channel.nsfw) return
await msg.channel.sendTyping()
const command = this.#modules.get(args.shift()!.toLowerCase())
if (!command) return
if (command.noPerm && msg.author.id !== config.bot.owner_ID)
return await noPerm(msg)
command.execute(msg, args)
}
})
return super.login(config.bot.token)

View file

@ -24,6 +24,6 @@ export default class extends Command {
}
await db.learn.delete(command)
await msg.channel.send('해당 단어를 삭ㄱ제했어요.')
await msg.reply('해당 단어를 삭ㄱ제했어요.')
}
}

View file

@ -9,7 +9,7 @@ export default class extends Command {
public async execute(msg: Message, args: string[]) {
if (!args[0] || !args[1]) {
return await msg.channel.send(
return await msg.reply(
'```\n멒힌아 배워 (등록할 단어) (대답)\n```\n `_`를 대답에 쓰면 공백으로 바뀌ㅇ어요.',
)
}

View file

@ -15,7 +15,7 @@ export default class extends Command {
if (row.persona === 'muffin') muffin.push(row)
else return
})
msg.channel.send(
await msg.reply(
`머핀 데이터: ${muffin.length}\nnsfw 데이터: ${nsfwData.length}\n지금까지 배운 단어: ${learnData.length}`,
)
}

View file

@ -21,7 +21,7 @@ export default class extends Command {
list.push(listData.command)
}
await msg.channel.send({
await msg.reply({
embeds: [
{
title: '지식',