fix: error

This commit is contained in:
Siwoo Jeon 2023-11-25 15:10:50 +09:00
parent 4d1d259882
commit dce1e072da
Signed by: migan
GPG key ID: C4151385FFD2082A
2 changed files with 14 additions and 4 deletions

View file

@ -8,14 +8,23 @@ export default class extends Command {
public async execute(msg: Message, args: string[]) { public async execute(msg: Message, args: string[]) {
const db = await msg.client.chatBot.db.getConnection() const db = await msg.client.chatBot.db.getConnection()
const command = args[0] const command = args[0]
const [rows] = await db.execute<LearnData[]>('SELECT * FROM learn WHERE command = ?;', [command]) const [rows] = await db.execute<LearnData[]>(
'SELECT * FROM learn WHERE command = ?;',
[command],
)
if (!command) {
return msg.channel.send('```멒힌아 삭제 (지울 단어)```')
}
if (!rows[0]) { if (!rows[0]) {
await msg.channel.send('해당하는 걸 찾ㅈ을 수 없어요.') return await msg.channel.send('해당하는 걸 찾ㅈ을 수 없어요.')
} }
if (rows[0].user_id !== msg.author.id) { if (rows[0].user_id !== msg.author.id) {
await msg.channel.send('당신ㄴ은 해당 지식을 안가르ㄹ쳐 주셨ㅅ는데요?') return await msg.channel.send(
'당신ㄴ은 해당 지식을 안가르ㄹ쳐 주셨ㅅ는데요?',
)
} }
try { try {

View file

@ -24,6 +24,7 @@ export default class extends Command {
'migan', 'migan',
'간미', '간미',
'삭제', '삭제',
'삭제',
] ]
const disallowed = ['@everyone', '@here', `<@${config.bot.owner_ID}>`] const disallowed = ['@everyone', '@here', `<@${config.bot.owner_ID}>`]
const db = await msg.client.chatBot.db.getConnection() const db = await msg.client.chatBot.db.getConnection()