From dce1e072daba63327c439414b5d45cacd0777d51 Mon Sep 17 00:00:00 2001 From: Migan178 Date: Sat, 25 Nov 2023 15:10:50 +0900 Subject: [PATCH] fix: error --- src/Commands/deleteLearn.ts | 17 +++++++++++++---- src/Commands/learn.ts | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Commands/deleteLearn.ts b/src/Commands/deleteLearn.ts index 056eb4a..72a4191 100644 --- a/src/Commands/deleteLearn.ts +++ b/src/Commands/deleteLearn.ts @@ -8,14 +8,23 @@ export default class extends Command { public async execute(msg: Message, args: string[]) { const db = await msg.client.chatBot.db.getConnection() const command = args[0] - const [rows] = await db.execute('SELECT * FROM learn WHERE command = ?;', [command]) - + const [rows] = await db.execute( + 'SELECT * FROM learn WHERE command = ?;', + [command], + ) + + if (!command) { + return msg.channel.send('```멒힌아 삭제 (지울 단어)```') + } + if (!rows[0]) { - await msg.channel.send('해당하는 걸 찾ㅈ을 수 없어요.') + return await msg.channel.send('해당하는 걸 찾ㅈ을 수 없어요.') } if (rows[0].user_id !== msg.author.id) { - await msg.channel.send('당신ㄴ은 해당 지식을 안가르ㄹ쳐 주셨ㅅ는데요?') + return await msg.channel.send( + '당신ㄴ은 해당 지식을 안가르ㄹ쳐 주셨ㅅ는데요?', + ) } try { diff --git a/src/Commands/learn.ts b/src/Commands/learn.ts index 96e6d5b..6e415b5 100644 --- a/src/Commands/learn.ts +++ b/src/Commands/learn.ts @@ -24,6 +24,7 @@ export default class extends Command { 'migan', '간미', '삭제', + '삭제', ] const disallowed = ['@everyone', '@here', `<@${config.bot.owner_ID}>`] const db = await msg.client.chatBot.db.getConnection()