commit
This commit is contained in:
parent
7f70ea5cd7
commit
e59a60042b
1 changed files with 35 additions and 4 deletions
39
app.js
39
app.js
|
@ -216,15 +216,46 @@ client.on('interactionCreate', async interaction => {
|
||||||
convs = await getConvs();
|
convs = await getConvs();
|
||||||
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);
|
||||||
interaction.editReply('Conversation added to db');
|
const embed = new discord.EmbedBuilder()
|
||||||
|
.setColor(0xFABBDE)
|
||||||
|
.setAuthor({ name : "Conversation added", iconURL : client.user.displayAvatarURL()})
|
||||||
|
.setDescription("Conversation " + interaction.options.get('name').value + " added to db")
|
||||||
|
.setFooter({ text : "Powered by OpenAI https://www.openai.com/", iconURL : "https://seeklogo.com/images/O/open-ai-logo-8B9BFEDC26-seeklogo.com.png" });
|
||||||
|
|
||||||
|
interaction.editReply({ embeds : [embed] });
|
||||||
} else {
|
} else {
|
||||||
interaction.editReply('Verify the name of the conversation (it must not contain spaces and must be unique)');
|
const embed = new discord.EmbedBuilder()
|
||||||
|
.setColor(0xFABBDE)
|
||||||
|
.setAuthor({ name : "Error", iconURL : client.user.displayAvatarURL()})
|
||||||
|
.setDescription("Verify the name of the conversation (it must not contain spaces and must be unique)")
|
||||||
|
.setFooter({ text : "Powered by OpenAI https://www.openai.com/", iconURL : "https://seeklogo.com/images/O/open-ai-logo-8B9BFEDC26-seeklogo.com.png" });
|
||||||
|
|
||||||
|
interaction.editReply({ embeds : [embed] });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (interaction.commandName === 'delconv') {
|
else if (interaction.commandName === 'delconv') {
|
||||||
console.log(await delConv(interaction.options.get('name').value));
|
await interaction.deferReply();
|
||||||
interaction.reply('Conversation deleted from db');
|
|
||||||
|
convs = await getConvs();
|
||||||
|
if (!convs.includes(interaction.options.get('name').value)) {
|
||||||
|
const embed = new discord.EmbedBuilder()
|
||||||
|
.setColor(0xFABBDE)
|
||||||
|
.setAuthor({ name : "Error", iconURL : client.user.displayAvatarURL()})
|
||||||
|
.setDescription("Conversation not found in the database")
|
||||||
|
.setFooter({ text : "Powered by OpenAI https://www.openai.com/", iconURL : "https://seeklogo.com/images/O/open-ai-logo-8B9BFEDC26-seeklogo.com.png" });
|
||||||
|
|
||||||
|
interaction.editReply({ embeds : [embed] });
|
||||||
|
} else {
|
||||||
|
await delConv(interaction.options.get('name').value);
|
||||||
|
const embed = new discord.EmbedBuilder()
|
||||||
|
.setColor(0xFABBDE)
|
||||||
|
.setAuthor({ name : "Conversation deleted", iconURL : client.user.displayAvatarURL()})
|
||||||
|
.setDescription("Conversation " + interaction.options.get('name').value + " deleted from the database")
|
||||||
|
.setFooter({ text : "Powered by OpenAI https://www.openai.com/", iconURL : "https://seeklogo.com/images/O/open-ai-logo-8B9BFEDC26-seeklogo.com.png" });
|
||||||
|
|
||||||
|
interaction.editReply({ embeds : [embed] });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (interaction.commandName === 'listconvs') {
|
else if (interaction.commandName === 'listconvs') {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue