From 7b967cca8c5d38d830835840e7affe56f080e093 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Mon, 23 Sep 2024 21:06:35 -0400 Subject: [PATCH 1/5] Versioning -- v3.3.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 566a3e0..513ea8b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodbot", - "version": "3.3.1", + "version": "3.3.2", "description": "Nods and Nod Accessories, now with ChatGPT!", "main": "main.js", "dependencies": { From 0c2eae76aa183c89a4e98109a9cac73458b81d4f Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Mon, 23 Sep 2024 21:10:08 -0400 Subject: [PATCH 2/5] Remove vestigial code --- slash-commands/help.js | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/slash-commands/help.js b/slash-commands/help.js index d18d9fe..084f2d1 100644 --- a/slash-commands/help.js +++ b/slash-commands/help.js @@ -4,29 +4,8 @@ const fn = require('../functions.js'); module.exports = { data: new SlashCommandBuilder() .setName('help') - .setDescription('Send the help page.') - // .addStringOption(option => - // option.setName('location') - // .setDescription('Send help in this channel or in DMs?') - // .setRequired(true) - // .addChoice('Here', 'channel') - // .addChoice('DMs', 'dm')) - , + .setDescription('Send the help page.'), async execute(interaction) { - // switch (interaction.options.getString('location')) { - // case 'channel': - // await interaction.reply(fn.embeds.help(interaction)); - // break; - // case 'dm': - // await interaction.user.createDM().then(channel => { - // channel.send(fn.embeds.help(interaction)); - // interaction.reply({content: 'I\'ve sent you a copy of my help page.', ephemeral: true}); - // }); - // break; - // default: - // interaction.reply('There was an error, please try again.'); - // break; - // } await interaction.reply(fn.embeds.help(interaction)); - }, + } }; \ No newline at end of file From f231df89d8393823f87ff64f1cd3018d29175874 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Mon, 23 Sep 2024 21:21:38 -0400 Subject: [PATCH 3/5] Move help from fields to the description. --- functions.js | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/functions.js b/functions.js index 50fc8c5..cee266c 100644 --- a/functions.js +++ b/functions.js @@ -210,31 +210,23 @@ const functions = { const helpEmbed = new Discord.MessageEmbed() .setColor('BLUE') .setAuthor({name: 'Help Page'}) - .setDescription(strings.help.description) .setThumbnail(strings.urls.avatar); // Construct the Slash Commands help let slashCommandsFields = []; - const slashCommandsMap = interaction.client.slashCommands.map(e => { return { name: e.data.name, description: e.data.description }; }) - for (const e of slashCommandsMap) { - slashCommandsFields.push({ - name: `- /${e.name}`, - value: e.description, - inline: false, - }); + slashCommandsFields.push(`- /${e.name} - ${e.description}`); } // Construct the Dot Commands Help let dotCommandsFields = []; - const dotCommandsMap = interaction.client.dotCommands.map(e => { return { name: e.name, @@ -242,19 +234,21 @@ const functions = { usage: e.usage }; }); - for (const e of dotCommandsMap) { - dotCommandsFields.push({ - name: `- .${e.name}`, - value: `${e.description}\nUsage: ${e.usage}`, - inline: false, - }); + dotCommandsFields.push(`- .${e.name} - ${e.description}\nUsage: ${e.usage}`); } - helpEmbed.addField('Slash Commands', strings.help.slash); - helpEmbed.addFields(slashCommandsFields); - helpEmbed.addField('Dot Commands', strings.help.dot); - helpEmbed.addFields(dotCommandsFields); + // Construct the Description Fields + const descriptionFields = [ + `${strings.help.description}\n`, + `**Slash Commands**\n${strings.help.slash}\n`, + `${slashCommandsFields.join('\n')}\n`, + `**Dot Commands**\n${strings.help.dot}\n`, + `${dotCommandsFields.join('\n')}` + ]; + + // Set the description + helpEmbed.setDescription(descriptionFields.join('\n')); return { embeds: [ helpEmbed From 28443611e49287adabef4722de672cfdda883aeb Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Mon, 23 Sep 2024 22:01:19 -0400 Subject: [PATCH 4/5] Vastly improved the /help command --- functions.js | 42 +++++++++++++++++++++++++++++------------- strings.json | 6 +++--- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/functions.js b/functions.js index cee266c..d6b12dd 100644 --- a/functions.js +++ b/functions.js @@ -215,28 +215,44 @@ const functions = { // Construct the Slash Commands help let slashCommandsFields = []; + let slashSeenNames = new Array(); const slashCommandsMap = interaction.client.slashCommands.map(e => { - return { - name: e.data.name, - description: e.data.description - }; - }) + if (!slashSeenNames.includes(e.data.name)) { + slashSeenNames.push(e.data.name); + return { + name: e.data.name, + description: e.data.description + }; + } else { + return null; + } + }); for (const e of slashCommandsMap) { - slashCommandsFields.push(`- /${e.name} - ${e.description}`); + slashCommandsFields.push(`- \`/${e.name}\` - ${e.description}`); } + console.log(slashCommandsFields); // Construct the Dot Commands Help - let dotCommandsFields = []; + let dotCommandsFields = new Array(); + let dotSeenNames = new Array(); const dotCommandsMap = interaction.client.dotCommands.map(e => { - return { - name: e.name, - description: e.description, - usage: e.usage - }; + if (!dotSeenNames.includes(e.name)) { + dotSeenNames.push(e.name); + return { + name: e.name, + description: e.description, + usage: e.usage + }; + } else { + return null; + } }); for (const e of dotCommandsMap) { - dotCommandsFields.push(`- .${e.name} - ${e.description}\nUsage: ${e.usage}`); + if (e != null) { + dotCommandsFields.push(`- \`.${e.name}\` - ${e.description} - ${e.usage}`); + } } + console.log(dotCommandsFields); // Construct the Description Fields const descriptionFields = [ diff --git a/strings.json b/strings.json index e7991f8..8883464 100644 --- a/strings.json +++ b/strings.json @@ -1,8 +1,8 @@ { "help": { - "description": "Hi there! Thanks for checking out NodBot. NodBot is used in two distinct ways: with 'Slash Commands' (/help), and with 'Dot Commands' (nod.gif). The two types will be outlined below, along with usage examples.", - "slash": "Slash Commands always begin with a / and a menu will pop up to help complete the commands.", - "dot": "Dot Commands have the command at the end of the message, for example to search for a gif of 'nod', type 'nod.gif'" + "description": "Hi there! Thanks for checking out NodBot. NodBot is used in two distinct ways: with 'Slash Commands' (`/help`), and with 'Dot Commands' (`nod.gif`). The two types will be outlined below, along with usage examples.", + "slash": "Slash Commands always begin with a `/` and a menu will pop up to help complete the commands.", + "dot": "Dot Commands have the command at the end of the message, for example to search for a gif of `nod`, type `nod.gif`" }, "emoji": { "joint": "<:joint:862082955902976000>", From fdcb56998c8dd32cee2e5bdbf96ce659301be097 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Mon, 23 Sep 2024 22:02:01 -0400 Subject: [PATCH 5/5] Ignore new env format --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fcfa662..10223d5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ package-lock.json .VSCodeCounter/ .env* +*.env # Custom folders # gifs/*