This commit is contained in:
Lukian LEIZOUR 2023-03-30 16:40:36 +02:00
parent 7cbaa32b60
commit 323d861852
2 changed files with 15 additions and 32 deletions

View file

@ -3,7 +3,7 @@ const {ApplicationCommandOptionType} = require('discord.js');
const commands = [ const commands = [
{ {
name: 'gptrequest', name: 'gptrequest',
description: 'Make a request to the GPT-3.5-Turbo API', description: 'Make a request to the GPT-4 API',
options: [ options: [
{ {
name: 'question', name: 'question',
@ -102,11 +102,6 @@ const commands = [
name : 'github', name : 'github',
description : 'Get the github link of the bot', description : 'Get the github link of the bot',
}, },
{
name : 'servers',
description : 'Get the number of servers the bot is in',
},
]; ];
module.exports = { commands }; module.exports = { commands };

View file

@ -6,7 +6,7 @@ const { incrementQuota, addConv, delConv, getConvs, addMessage, getMessages, isN
const { commands } = require('../commands/commands'); const { commands } = require('../commands/commands');
async function gptrequest(interaction) { async function gptrequest(interaction, client) {
await interaction.deferReply(); await interaction.deferReply();
quota = isNewUser(interaction.member.user.id, interaction.member.user.username).catch((err) => { quota = isNewUser(interaction.member.user.id, interaction.member.user.username).catch((err) => {
@ -72,7 +72,7 @@ async function gptrequest(interaction) {
} }
async function addconv(interaction) { async function addconv(interaction, client) {
await interaction.deferReply(); await interaction.deferReply();
convs = await getConvs().catch((err) => { convs = await getConvs().catch((err) => {
console.log(err); console.log(err);
@ -105,7 +105,7 @@ async function addconv(interaction) {
} }
async function delconv(interaction) { async function delconv(interaction, client) {
await interaction.deferReply(); await interaction.deferReply();
convs = await getConvs().catch((err) => { convs = await getConvs().catch((err) => {
@ -139,7 +139,7 @@ async function delconv(interaction) {
} }
async function listconvs(interaction) { async function listconvs(interaction, client) {
convs = await getConvs().catch((err) => { convs = await getConvs().catch((err) => {
console.log(err); console.log(err);
addToLogs(err); addToLogs(err);
@ -166,7 +166,7 @@ async function listconvs(interaction) {
} }
async function addmsg(interaction) { async function addmsg(interaction, client) {
await interaction.deferReply(); await interaction.deferReply();
quota = isNewUser(interaction.member.user.id, interaction.member.user.username).catch((err) => { quota = isNewUser(interaction.member.user.id, interaction.member.user.username).catch((err) => {
@ -224,7 +224,7 @@ async function addmsg(interaction) {
} }
async function displayconv(interaction) { async function displayconv(interaction, client) {
await interaction.deferReply(); await interaction.deferReply();
if (interaction.options.get('name').value.includes(" ")) { if (interaction.options.get('name').value.includes(" ")) {
@ -310,7 +310,7 @@ async function getmyguota(interaction) {
} }
async function github(interation) { async function github(interaction, client) {
await interaction.deferReply(); await interaction.deferReply();
const embed = new discord.EmbedBuilder() const embed = new discord.EmbedBuilder()
@ -325,14 +325,6 @@ async function github(interation) {
console.log('[Discord] Github requested by ' + interaction.member.user.username); console.log('[Discord] Github requested by ' + interaction.member.user.username);
} }
async function servers(client) {
console.log("Serveurs:");
client.guilds.cache.forEach((guild) => {
console.log(" - " + guild);
})
}
module.exports = { module.exports = {
newMessage: (client) => { newMessage: (client) => {
client.on('messageCreate', async msg => { client.on('messageCreate', async msg => {
@ -360,7 +352,7 @@ module.exports = {
if (!interaction.isCommand()) return; if (!interaction.isCommand()) return;
if (interaction.commandName === 'gptrequest') { if (interaction.commandName === 'gptrequest') {
gptrequest(interaction); gptrequest(interaction, client);
} }
else if (interaction.commandName === 'info') { else if (interaction.commandName === 'info') {
@ -368,23 +360,23 @@ module.exports = {
} }
else if (interaction.commandName === 'addconv') { else if (interaction.commandName === 'addconv') {
addconv(interaction); addconv(interaction, client);
} }
else if (interaction.commandName === 'delconv') { else if (interaction.commandName === 'delconv') {
delconv(interaction); delconv(interaction, client);
} }
else if (interaction.commandName === 'listconvs') { else if (interaction.commandName === 'listconvs') {
listconvs(interaction); listconvs(interaction, client);
} }
else if (interaction.commandName === 'addmsg') { else if (interaction.commandName === 'addmsg') {
addmsg(interaction); addmsg(interaction, client);
} }
else if (interaction.commandName === 'displayconv') { else if (interaction.commandName === 'displayconv') {
displayconv(interaction); displayconv(interaction, client);
} }
else if (interaction.commandName === 'getmyguota') { else if (interaction.commandName === 'getmyguota') {
@ -392,11 +384,7 @@ module.exports = {
} }
else if (interaction.commandName === 'github') { else if (interaction.commandName === 'github') {
github(interaction); github(interaction, client);
}
else if (interaction.commandName === 'servers') {
servers(client);
} }
}); });
}, },