fix: add persona field username

This commit is contained in:
Siwoo Jeon 2023-01-25 23:05:35 +09:00
parent 26f5997687
commit ba3f5ae0b2
Signed by: migan
GPG key ID: C4151385FFD2082A

View file

@ -45,9 +45,12 @@ export default class ChatBot {
} else { } else {
if (this.trainType !== 'All') return if (this.trainType !== 'All') return
if (!msg.content.startsWith('머핀아 ')) return if (!msg.content.startsWith('머핀아 ')) return
const sql = `INSERT INTO statement(text, persona) VALUES('${msg.content const user = `user:${msg.author.username
.replace('머핀아 ', '') .replaceAll("'", '')
.replaceAll("'", '')}', 'user');` .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 => { this.db.run(sql, err => {
if (err) throw err if (err) throw err
}) })