This commit is contained in:
Lukian LEIZOUR 2023-03-02 19:10:29 +01:00
parent 4afa276479
commit 614b7afc08
3 changed files with 15 additions and 2 deletions

11
app.js
View file

@ -155,7 +155,12 @@ client.on('interactionCreate', async interaction => {
if (interaction.commandName === 'gptrequest') { if (interaction.commandName === 'gptrequest') {
answerQuestion(interaction.options.get('question').value).then((res) => { answerQuestion(interaction.options.get('question').value).then((res) => {
const embed = new discord.EmbedBuilder().setTitle("test").setDescription(res.data.choices[0].message.content); const embed = new discord.EmbedBuilder()
.setColor(0xFABBDE)
.setAuthor({ name : "Reply to : " + interaction.member.user.username, iconURL : "https://cdn.discordapp.com/avatars/"+interaction.member.user.id+"/"+interaction.member.user.avatar+".jpeg"})
.setTitle("Question : " + interaction.options.get('question').value)
.setDescription(res.data.choices[0].message.content)
.setFooter({ text : "Powered by OpenAI https://www.openai.com/", iconURL : "https://seeklogo.com/images/O/open-ai-logo-8B9BFEDC26-seeklogo.com.png" });
console.log('[Discord] Sent answer to : ' + interaction.options.get('question').value); console.log('[Discord] Sent answer to : ' + interaction.options.get('question').value);
addToLogs('[Discord] Sent answer to : ' +interaction.options.get('question').value); addToLogs('[Discord] Sent answer to : ' +interaction.options.get('question').value);
@ -169,6 +174,10 @@ client.on('interactionCreate', async interaction => {
console.log('[Discord] Generating answer to : ' + interaction.options.get('question').value); console.log('[Discord] Generating answer to : ' + interaction.options.get('question').value);
addToLogs('[Discord] Generating answer to : ' + interaction.options.get('question').value); addToLogs('[Discord] Generating answer to : ' + interaction.options.get('question').value);
} }
else if (interaction.commandName === 'info') {
console.log(interaction)
}
}); });
//bot launch //bot launch

View file

@ -32,7 +32,6 @@ async function answerQuestion(query) {
addToLogs("--> error : " + err); addToLogs("--> error : " + err);
}) })
console.log(response);
return response; return response;
} }

View file

@ -12,6 +12,11 @@ const commands = [
required: true, required: true,
}, },
], ],
},
{
name : 'info',
description : 'utilise pas cette commande fdp',
} }
]; ];