From ba3f5ae0b2c1c7739035c2c9f32f269df284c751 Mon Sep 17 00:00:00 2001 From: Migan178 Date: Wed, 25 Jan 2023 23:05:35 +0900 Subject: [PATCH] fix: add persona field username --- src/ChatBot.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ChatBot.ts b/src/ChatBot.ts index e1ef25d..d372451 100644 --- a/src/ChatBot.ts +++ b/src/ChatBot.ts @@ -45,9 +45,12 @@ export default class ChatBot { } else { if (this.trainType !== 'All') return if (!msg.content.startsWith('머핀아 ')) return - const sql = `INSERT INTO statement(text, persona) VALUES('${msg.content - .replace('머핀아 ', '') - .replaceAll("'", '')}', 'user');` + const user = `user:${msg.author.username + .replaceAll("'", '') + .slice(0, 50) + .toLowerCase()}` + const text = msg.content.replace('머핀아 ', '').replaceAll("'", '') + const sql = `INSERT INTO statement(text, persona) VALUES('${text}', '${user}');` this.db.run(sql, err => { if (err) throw err })