commit
This commit is contained in:
parent
03c833d26b
commit
63f422e367
4 changed files with 8 additions and 16 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1,5 @@
|
||||||
tests.js
|
tests.js
|
||||||
register-commands.js
|
register-commands.js
|
||||||
|
Dockerfile
|
||||||
|
docker-compose.yml
|
||||||
|
start.sh
|
|
@ -32,19 +32,6 @@ const commands = [
|
||||||
description : 'utilise pas cette commande fdp',
|
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',
|
name : 'addconv',
|
||||||
description : 'Add a conversation to the database',
|
description : 'Add a conversation to the database',
|
||||||
|
|
|
@ -144,6 +144,7 @@ async function addconv(interaction, client) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
addToLogs(err);
|
addToLogs(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!interaction.options.get('name').value.includes(" ") && !convs.includes(interaction.options.get('name').value)) {
|
if (!interaction.options.get('name').value.includes(" ") && !convs.includes(interaction.options.get('name').value)) {
|
||||||
await addConv(interaction.options.get('name').value);
|
await addConv(interaction.options.get('name').value);
|
||||||
const embed = new discord.EmbedBuilder()
|
const embed = new discord.EmbedBuilder()
|
||||||
|
@ -264,7 +265,7 @@ async function addmsg(interaction, client) {
|
||||||
});
|
});
|
||||||
|
|
||||||
sendConv(messages).then((res) => {
|
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);
|
console.log(err);
|
||||||
addToLogs(err);
|
addToLogs(err);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const mysql = require('mysql');
|
const mysql = require('mysql');
|
||||||
|
|
||||||
const connection = mysql.createConnection({
|
const connection = mysql.createConnection({
|
||||||
host: "localhost",
|
host: process.env.MYSQL_HOST,
|
||||||
user: "root",
|
user: "root",
|
||||||
password: process.env.MYSQL,
|
password: process.env.MYSQL,
|
||||||
database: "discord"
|
database: "discord"
|
||||||
|
@ -13,6 +13,7 @@ function addUserToDb(id, user) {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
} else {
|
} else {
|
||||||
|
console.log('User added to database');
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue