From 1d2d6425c1ea0e8528a3bd43d69b5180237c4f1e Mon Sep 17 00:00:00 2001 From: Migan178 Date: Sun, 12 Feb 2023 20:45:54 +0900 Subject: [PATCH] . --- example.env | 2 +- src/Client.ts | 3 +-- src/modules/ChatBot.ts | 2 +- tests/database.test.ts | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/example.env b/example.env index df35bf9..aea780a 100644 --- a/example.env +++ b/example.env @@ -3,4 +3,4 @@ MYSQL_USER='MYSQL_USER' MYSQL_HOST='MYSQL_HOST' MYSQL_PASSWORD='MYSQL_PASSWORD' MYSQL_DATABASE='MYSQL_DATABASE' -MYSQL_PORT='MYSQL_PORT' \ No newline at end of file +MYSQL_PORT='MYSQL_PORT' diff --git a/src/Client.ts b/src/Client.ts index e405ed5..e40b1be 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -49,7 +49,6 @@ export default class MuffinAI extends Client { if (msg.author.bot) return if (msg.content.startsWith('머핀아 ')) { if (msg.channel instanceof TextChannel) { - // if (msg.channel.nsfw) return await msg.channel.sendTyping() this.chatBot // .getResponse(msg) @@ -67,7 +66,7 @@ export default class MuffinAI extends Client { if (NODE_ENV === 'development') console.log(args) const command = this.#modules.get(args.shift()!.toLowerCase()) if (!command) return - if (command.noPerm && msg.author.id !== '415135882006495242') + if (command.noPerm && msg.author.id !== process.env.OWNER_ID) return await noPerm(msg) command.execute(msg, args) diff --git a/src/modules/ChatBot.ts b/src/modules/ChatBot.ts index 47ddbd7..9454984 100644 --- a/src/modules/ChatBot.ts +++ b/src/modules/ChatBot.ts @@ -31,7 +31,7 @@ export default class ChatBot { client.on('messageCreate', async msg => { if (msg.author.bot) return const db = await this.db - if (msg.author.id === '1026185545837191238') { + if (msg.author.id === process.env.TRAIN_USER_ID) { const response = await this.getResponse(msg) const [rows] = await db.execute( 'SELECT * FROM statement;' diff --git a/tests/database.test.ts b/tests/database.test.ts index 7e45111..2843ade 100644 --- a/tests/database.test.ts +++ b/tests/database.test.ts @@ -3,7 +3,7 @@ import { createConnection } from 'mysql2/promise' describe('test database system', () => { test('Validate rows', async () => { - return database.getConnection().then(async conn1 => { + return database.then(async conn1 => { const [rows1] = await conn1.execute('SELECT * FROM statement;') const conn2 = await createConnection(config) const [rows2] = await conn2.execute(`SELECT * FROM statement;`)