Fuck it. This only fixes the crashes on startup, Does NOT work with slash commands.

This commit is contained in:
IDeletedSystem64 2022-07-26 23:27:46 -05:00
parent d527cab9f5
commit ca77b63c97
1 changed files with 11 additions and 7 deletions

View File

@ -1,26 +1,30 @@
const { Constants } = require('discord.js');
module.exports = { module.exports = {
name: require('path').parse(__filename).name, name: require('path').parse(__filename).name,
description: 'Get help on anything from commands, to what the bot does! just not your homework..', description: 'Get help on anything from commands, to what the bot does! just not your homework..',
options: [{ options: [{
name: '<Command>', name: 'command',
description: 'View Information about this command', description: 'View Information about this command',
required: false required: false,
type: Constants.ApplicationCommandOptionTypes.STRING
}], }],
async parseMessage (client, config, message, args) { async parseMessage (client, config, message, args) {
await message.channel.send(this.handle(client, config, message.author, args)); await message.channel.send(this.handle(client, config, message.author, args[0]));
}, },
async parseInteraction (client, config, interaction) { async parseInteraction (client, config, interaction) {
await interaction.reply(this.handle(client, config, interaction.user)); await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getString('command')));
}, },
handle (client, config, user, args) { handle (client, config, user, command) {
if (!args[0]) { if (!command) {
return client.generateErrorMessage('Note to self: Design default help embed.', user.displayAvatarURL()); return client.generateErrorMessage('Note to self: Design default help embed.', user.displayAvatarURL());
} }
const cmdName = args[0].toLowerCase(); // const cmdName = args[0].toLowerCase();
const cmdName = command
const cmd = client.commands.get(cmdName); const cmd = client.commands.get(cmdName);
if (!cmd) { if (!cmd) {