diff --git a/commands/commands.js b/commands/commands.js index d26d6d0..1bde90b 100644 --- a/commands/commands.js +++ b/commands/commands.js @@ -141,6 +141,11 @@ const commands = [ }, ], }, + + { + name : 'help', + description : 'Get help', + }, ]; module.exports = { commands }; \ No newline at end of file diff --git a/events/discordEvents.js b/events/discordEvents.js index b838fb2..f005cf3 100644 --- a/events/discordEvents.js +++ b/events/discordEvents.js @@ -14,6 +14,7 @@ const github = require('../functions/discord/github'); const dalle = require('../functions/discord/dalle'); const addchannel = require('../functions/discord/addchannel'); const deletechannel = require('../functions/discord/deletechannel'); +const help = require('../functions/discord/help'); const { listchannels, incrementQuota, isNewUser } = require('../libs/mysql'); const { sendQuickConv } = require('../libs/openAi') @@ -119,6 +120,10 @@ module.exports = { else if (interaction.commandName === 'deletechannel') { deletechannel(interaction, client); } + + else if (interaction.commandName === 'help') { + help(interaction, client); + } }); }, @@ -126,8 +131,6 @@ module.exports = { client.on('ready', async () => { console.log(`[Discord] Logged in as ${client.user.tag} !`); - client.user.setPresence({ activities: [{ name: client.guilds.cache.size + ' servers !', type: 3 }] }); - const rest = new discord.REST({ version: '10' }).setToken(process.env.DISCORD); await rest.put( @@ -136,6 +139,21 @@ module.exports = { ); console.log('[Discord] Successfully reloaded application (/) commands globally.'); + + client.user.setPresence({ activities: [{ name: client.guilds.cache.size + ' servers !', type: 3 }] }); + + n = 1; + + act = [ + [{ name: client.guilds.cache.size + ' servers !', type: 3 }], + [{ name: '/help command', type: 3 }], + ]; + + setInterval(() => { + client.user.setPresence({ activities: act[n] }); + if (n == 1) { n = 0; } + else { n = 1; } + }, 10000); }); }, } \ No newline at end of file diff --git a/functions/discord/help.js b/functions/discord/help.js new file mode 100644 index 0000000..209e745 --- /dev/null +++ b/functions/discord/help.js @@ -0,0 +1,38 @@ +const { EmbedBuilder } = require('discord.js'); + +function help(interaction, client) { + const embed = new EmbedBuilder() + .setColor(0xFABBDE) + .setAuthor({ name: "Help", iconURL: client.user.displayAvatarURL() }) + .setDescription(` + **OpenAI basic commands :** + \`/gptrequest [query]\` : Make a request to the GPT-4 API + \`/quickgpt [query]\` : Make a request to the GPT-3.5-turbo API + \`/dalle [query]\` : Make a request to the DALL-E API + + **OpenAI conversations commands :** + *Note : These commands allow you to create conversations and add messages to them, so that the bot will remember your previous messages* + + \`/addconv [convName]\` : Add a conversation to the database + \`/delconv [convName]\` : Delete a conversation from the database + \`/listconvs\` : List all the conversations in the database + \`/displayconv [convName]\` : Display a conversation from the database + \`/addmsg [message]\` : Add a message to the conversation + + **Channel commands :** + *Note : These commands allow you to talk to the bots without using any commands in a specific channel (this requires admin permission)* + + \`/addchannel [channelName]\` : Add a channel to the database + \`/delchannel [channelName]\` : Delete a channel from the database + + **Miscellaneous commands :** + \`/github\` : Get the github link of the bot + \`/getmyquota\` : Get your quota *Note : Since the OpenAI API is not free, all users have a quota of 200k tokens* + \`/help\` : Display this message + `) + .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] }); +} + +module.exports = help; \ No newline at end of file