v3.3.2 The Help Fix #17
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@
|
||||
package-lock.json
|
||||
.VSCodeCounter/
|
||||
.env*
|
||||
*.env
|
||||
|
||||
# Custom folders
|
||||
# gifs/*
|
||||
|
70
functions.js
70
functions.js
@ -210,51 +210,61 @@ 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 = [];
|
||||
|
||||
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({
|
||||
name: `- /${e.name}`,
|
||||
value: e.description,
|
||||
inline: false,
|
||||
});
|
||||
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({
|
||||
name: `- .${e.name}`,
|
||||
value: `${e.description}\nUsage: ${e.usage}`,
|
||||
inline: false,
|
||||
});
|
||||
if (e != null) {
|
||||
dotCommandsFields.push(`- \`.${e.name}\` - ${e.description} - ${e.usage}`);
|
||||
}
|
||||
}
|
||||
console.log(dotCommandsFields);
|
||||
|
||||
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
|
||||
|
@ -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": {
|
||||
|
@ -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));
|
||||
},
|
||||
}
|
||||
};
|
@ -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>",
|
||||
|
Loading…
Reference in New Issue
Block a user