Compare commits

..

No commits in common. "e5d520a73bd67905ea50e760d2dffdce311f03c7" and "f3ce349cebe58e72f99192b0750de279fb0736e3" have entirely different histories.

5 changed files with 57 additions and 47 deletions

1
.gitignore vendored
View File

@ -3,7 +3,6 @@
package-lock.json package-lock.json
.VSCodeCounter/ .VSCodeCounter/
.env* .env*
*.env
# Custom folders # Custom folders
# gifs/* # gifs/*

View File

@ -210,61 +210,51 @@ const functions = {
const helpEmbed = new Discord.MessageEmbed() const helpEmbed = new Discord.MessageEmbed()
.setColor('BLUE') .setColor('BLUE')
.setAuthor({name: 'Help Page'}) .setAuthor({name: 'Help Page'})
.setDescription(strings.help.description)
.setThumbnail(strings.urls.avatar); .setThumbnail(strings.urls.avatar);
// Construct the Slash Commands help // Construct the Slash Commands help
let slashCommandsFields = []; let slashCommandsFields = [];
let slashSeenNames = new Array();
const slashCommandsMap = interaction.client.slashCommands.map(e => { const slashCommandsMap = interaction.client.slashCommands.map(e => {
if (!slashSeenNames.includes(e.data.name)) { return {
slashSeenNames.push(e.data.name); name: e.data.name,
return { description: e.data.description
name: e.data.name, };
description: e.data.description })
};
} else {
return null;
}
});
for (const e of slashCommandsMap) { for (const e of slashCommandsMap) {
slashCommandsFields.push(`- \`/${e.name}\` - ${e.description}`); slashCommandsFields.push({
name: `- /${e.name}`,
value: e.description,
inline: false,
});
} }
console.log(slashCommandsFields);
// Construct the Dot Commands Help // Construct the Dot Commands Help
let dotCommandsFields = new Array(); let dotCommandsFields = [];
let dotSeenNames = new Array();
const dotCommandsMap = interaction.client.dotCommands.map(e => { const dotCommandsMap = interaction.client.dotCommands.map(e => {
if (!dotSeenNames.includes(e.name)) { return {
dotSeenNames.push(e.name); name: e.name,
return { description: e.description,
name: e.name, usage: e.usage
description: e.description, };
usage: e.usage
};
} else {
return null;
}
}); });
for (const e of dotCommandsMap) { for (const e of dotCommandsMap) {
if (e != null) { dotCommandsFields.push({
dotCommandsFields.push(`- \`.${e.name}\` - ${e.description} - ${e.usage}`); name: `- .${e.name}`,
} value: `${e.description}\nUsage: ${e.usage}`,
inline: false,
});
} }
console.log(dotCommandsFields);
// Construct the Description Fields helpEmbed.addField('Slash Commands', strings.help.slash);
const descriptionFields = [ helpEmbed.addFields(slashCommandsFields);
`${strings.help.description}\n`, helpEmbed.addField('Dot Commands', strings.help.dot);
`**Slash Commands**\n${strings.help.slash}\n`, helpEmbed.addFields(dotCommandsFields);
`${slashCommandsFields.join('\n')}\n`,
`**Dot Commands**\n${strings.help.dot}\n`,
`${dotCommandsFields.join('\n')}`
];
// Set the description
helpEmbed.setDescription(descriptionFields.join('\n'));
return { embeds: [ return { embeds: [
helpEmbed helpEmbed

View File

@ -1,6 +1,6 @@
{ {
"name": "nodbot", "name": "nodbot",
"version": "3.3.2", "version": "3.3.1",
"description": "Nods and Nod Accessories, now with ChatGPT!", "description": "Nods and Nod Accessories, now with ChatGPT!",
"main": "main.js", "main": "main.js",
"dependencies": { "dependencies": {

View File

@ -4,8 +4,29 @@ const fn = require('../functions.js');
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('help') .setName('help')
.setDescription('Send the help page.'), .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'))
,
async execute(interaction) { 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)); await interaction.reply(fn.embeds.help(interaction));
} },
}; };

View File

@ -1,8 +1,8 @@
{ {
"help": { "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.", "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.", "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`" "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": { "emoji": {
"joint": "<:joint:862082955902976000>", "joint": "<:joint:862082955902976000>",