From 63f422e367f890dc958b5d65feaf8503364717c3 Mon Sep 17 00:00:00 2001 From: Lukian Date: Sat, 20 May 2023 23:09:50 +0200 Subject: [PATCH] commit --- .gitignore | 5 ++++- commands/commands.js | 13 ------------- events/discordEvents.js | 3 ++- libs/mysql.js | 3 ++- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 92fb423..93d4954 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ tests.js -register-commands.js \ No newline at end of file +register-commands.js +Dockerfile +docker-compose.yml +start.sh \ No newline at end of file diff --git a/commands/commands.js b/commands/commands.js index d837192..cd513a5 100644 --- a/commands/commands.js +++ b/commands/commands.js @@ -32,19 +32,6 @@ const commands = [ description : 'utilise pas cette commande fdp', }, - { - name : 'createconv', - description : 'Create a new conversation', - options : [ - { - name : 'name', - description : 'The name of the conversation', - type : ApplicationCommandOptionType.String, - required : true, - }, - ], - }, - { name : 'addconv', description : 'Add a conversation to the database', diff --git a/events/discordEvents.js b/events/discordEvents.js index 7045ecd..eb712dd 100644 --- a/events/discordEvents.js +++ b/events/discordEvents.js @@ -144,6 +144,7 @@ async function addconv(interaction, client) { console.log(err); addToLogs(err); }); + if (!interaction.options.get('name').value.includes(" ") && !convs.includes(interaction.options.get('name').value)) { await addConv(interaction.options.get('name').value); const embed = new discord.EmbedBuilder() @@ -264,7 +265,7 @@ async function addmsg(interaction, client) { }); sendConv(messages).then((res) => { - addMessage(interaction.options.get('name').value, "assistant", res.data.choices[0].message.content, "Chaise bot").catch((err) => { + addMessage(interaction.options.get('name').value, "assistant", res.data.choices[0].message.content.replace(/"/g, "\'").replace("\""), "Chaise bot").catch((err) => { console.log(err); addToLogs(err); }); diff --git a/libs/mysql.js b/libs/mysql.js index 7f8330d..0c0e5fd 100644 --- a/libs/mysql.js +++ b/libs/mysql.js @@ -1,7 +1,7 @@ const mysql = require('mysql'); const connection = mysql.createConnection({ - host: "localhost", + host: process.env.MYSQL_HOST, user: "root", password: process.env.MYSQL, database: "discord" @@ -13,6 +13,7 @@ function addUserToDb(id, user) { if (error) { reject(error); } else { + console.log('User added to database'); resolve(); } });