commit
This commit is contained in:
parent
62d605c68b
commit
53db6d49ed
1 changed files with 69 additions and 17 deletions
60
app.js
60
app.js
|
@ -230,10 +230,6 @@ client.on('messageCreate', async msg => {
|
||||||
msg.reply('Link of the Gihhub repository :\n -https://github.com/Ninja-Jambon/chaise_bot')
|
msg.reply('Link of the Gihhub repository :\n -https://github.com/Ninja-Jambon/chaise_bot')
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (msg.content.startsWith('/q')) {
|
|
||||||
msg.reply("utilise la slash commande enculé")
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (msg.content.startsWith('/g')) {
|
else if (msg.content.startsWith('/g')) {
|
||||||
generateImage(msg.content.slice(+3)).then((res) => {
|
generateImage(msg.content.slice(+3)).then((res) => {
|
||||||
console.log('[Discord] Sent image to : ' + msg.content.slice(+3));
|
console.log('[Discord] Sent image to : ' + msg.content.slice(+3));
|
||||||
|
@ -324,6 +320,9 @@ client.on('interactionCreate', async interaction => {
|
||||||
.setFooter({ text : "Powered by OpenAI https://www.openai.com/", iconURL : "https://seeklogo.com/images/O/open-ai-logo-8B9BFEDC26-seeklogo.com.png" });
|
.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] });
|
interaction.editReply({ embeds : [embed] });
|
||||||
|
|
||||||
|
addToLogs('[Discord] Added conversation : ' + interaction.options.get('name').value);
|
||||||
|
console.log('[Discord] Added conversation : ' + interaction.options.get('name').value);
|
||||||
} else {
|
} else {
|
||||||
const embed = new discord.EmbedBuilder()
|
const embed = new discord.EmbedBuilder()
|
||||||
.setColor(0xFABBDE)
|
.setColor(0xFABBDE)
|
||||||
|
@ -332,6 +331,9 @@ client.on('interactionCreate', async interaction => {
|
||||||
.setFooter({ text : "Powered by OpenAI https://www.openai.com/", iconURL : "https://seeklogo.com/images/O/open-ai-logo-8B9BFEDC26-seeklogo.com.png" });
|
.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] });
|
interaction.editReply({ embeds : [embed] });
|
||||||
|
|
||||||
|
addToLogs('[Discord] Error adding conversation : ' + interaction.options.get('name').value);
|
||||||
|
console.log('[Discord] Error adding conversation : ' + interaction.options.get('name').value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,6 +349,9 @@ client.on('interactionCreate', async interaction => {
|
||||||
.setFooter({ text : "Powered by OpenAI https://www.openai.com/", iconURL : "https://seeklogo.com/images/O/open-ai-logo-8B9BFEDC26-seeklogo.com.png" });
|
.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] });
|
interaction.editReply({ embeds : [embed] });
|
||||||
|
|
||||||
|
addToLogs('[Discord] Conversation not found in the database : ' + interaction.options.get('name').value);
|
||||||
|
console.log('[Discord] Conversation not found in the database : ' + interaction.options.get('name').value);
|
||||||
} else {
|
} else {
|
||||||
await delConv(interaction.options.get('name').value);
|
await delConv(interaction.options.get('name').value);
|
||||||
const embed = new discord.EmbedBuilder()
|
const embed = new discord.EmbedBuilder()
|
||||||
|
@ -356,6 +361,9 @@ client.on('interactionCreate', async interaction => {
|
||||||
.setFooter({ text : "Powered by OpenAI https://www.openai.com/", iconURL : "https://seeklogo.com/images/O/open-ai-logo-8B9BFEDC26-seeklogo.com.png" });
|
.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] });
|
interaction.editReply({ embeds : [embed] });
|
||||||
|
|
||||||
|
addToLogs('[Discord] Conversation deleted from the database : ' + interaction.options.get('name').value);
|
||||||
|
console.log('[Discord] Conversation deleted from the database : ' + interaction.options.get('name').value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,6 +385,9 @@ client.on('interactionCreate', async interaction => {
|
||||||
.setFooter({ text : "Powered by OpenAI https://www.openai.com/", iconURL : "https://seeklogo.com/images/O/open-ai-logo-8B9BFEDC26-seeklogo.com.png" });
|
.setFooter({ text : "Powered by OpenAI https://www.openai.com/", iconURL : "https://seeklogo.com/images/O/open-ai-logo-8B9BFEDC26-seeklogo.com.png" });
|
||||||
|
|
||||||
interaction.reply({ embeds : [embed] });
|
interaction.reply({ embeds : [embed] });
|
||||||
|
|
||||||
|
addToLogs('[Discord] Sent conversations list');
|
||||||
|
console.log('[Discord] Sent conversations list');
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (interaction.commandName === 'addmsg') {
|
else if (interaction.commandName === 'addmsg') {
|
||||||
|
@ -400,6 +411,9 @@ client.on('interactionCreate', async interaction => {
|
||||||
.setFooter({ text : "Powered by OpenAI https://www.openai.com/", iconURL : "https://seeklogo.com/images/O/open-ai-logo-8B9BFEDC26-seeklogo.com.png" });
|
.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] });
|
interaction.editReply({ embeds : [embed] });
|
||||||
|
|
||||||
|
addToLogs('[Discord] Quota exceeded for user : ' + interaction.member.user.username);
|
||||||
|
console.log('[Discord] Quota exceeded for user : ' + interaction.member.user.username);
|
||||||
} else {
|
} else {
|
||||||
await addMessage(interaction.options.get('name').value,"user" ,interaction.options.get('message').value, interaction.member.user.username);
|
await addMessage(interaction.options.get('name').value,"user" ,interaction.options.get('message').value, interaction.member.user.username);
|
||||||
|
|
||||||
|
@ -420,6 +434,9 @@ client.on('interactionCreate', async interaction => {
|
||||||
.setFooter({ text : "Powered by OpenAI https://www.openai.com/", iconURL : "https://seeklogo.com/images/O/open-ai-logo-8B9BFEDC26-seeklogo.com.png" });
|
.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_user, embed_bot] });
|
interaction.editReply({ embeds : [embed_user, embed_bot] });
|
||||||
|
|
||||||
|
addToLogs('[Discord] Added message to conversation : ' + interaction.options.get('name').value);
|
||||||
|
console.log('[Discord] Added message to conversation : ' + interaction.options.get('name').value);
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
});
|
});
|
||||||
|
@ -428,6 +445,34 @@ client.on('interactionCreate', async interaction => {
|
||||||
|
|
||||||
else if (interaction.commandName === 'displayconv') {
|
else if (interaction.commandName === 'displayconv') {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
||||||
|
if (interaction.options.get('name').includes(" ")) {
|
||||||
|
const embed = new discord.EmbedBuilder()
|
||||||
|
.setColor(0xFABBDE)
|
||||||
|
.setAuthor({ name : "Error", iconURL : client.user.displayAvatarURL()})
|
||||||
|
.setDescription("Conversation name can't contain spaces")
|
||||||
|
.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] });
|
||||||
|
|
||||||
|
addToLogs('[Discord] Conversation name can\'t contain spaces');
|
||||||
|
console.log('[Discord] Conversation name can\'t contain spaces');
|
||||||
|
}else {
|
||||||
|
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] });
|
||||||
|
|
||||||
|
addToLogs('[Discord] Conversation not found in the database');
|
||||||
|
console.log('[Discord] Conversation not found in the database');
|
||||||
|
}
|
||||||
|
|
||||||
messages = await getMessages(interaction.options.get('name').value, "user");
|
messages = await getMessages(interaction.options.get('name').value, "user");
|
||||||
|
|
||||||
embed_text = "";
|
embed_text = "";
|
||||||
|
@ -446,6 +491,10 @@ client.on('interactionCreate', async interaction => {
|
||||||
.setFooter({ text : "Powered by OpenAI https://www.openai.com/", iconURL : "https://seeklogo.com/images/O/open-ai-logo-8B9BFEDC26-seeklogo.com.png" });
|
.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] });
|
interaction.editReply({ embeds : [embed] });
|
||||||
|
|
||||||
|
addToLogs('[Discord] Displayed conversation : ' + interaction.options.get('name').value);
|
||||||
|
console.log('[Discord] Displayed conversation : ' + interaction.options.get('name').value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (interaction.commandName === 'getmyguota') {
|
else if (interaction.commandName === 'getmyguota') {
|
||||||
|
@ -468,6 +517,9 @@ client.on('interactionCreate', async interaction => {
|
||||||
.setFooter({ text : "Powered by OpenAI https://www.openai.com/", iconURL : "https://seeklogo.com/images/O/open-ai-logo-8B9BFEDC26-seeklogo.com.png" });
|
.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] });
|
interaction.editReply({ embeds : [embed] });
|
||||||
|
|
||||||
|
addToLogs('[Discord] Quota requested by ' + interaction.member.user.username);
|
||||||
|
console.log('[Discord] Quota requested by ' + interaction.member.user.username);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue