From 461ffbf4ef53208fc5d76787651f930b7fa2ae2f Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Mon, 17 Jan 2022 17:44:08 +0200 Subject: [PATCH] fixed text channel parsing --- src/structure/components/observers/CommandHandler.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/structure/components/observers/CommandHandler.js b/src/structure/components/observers/CommandHandler.js index b6ed133..05c1112 100644 --- a/src/structure/components/observers/CommandHandler.js +++ b/src/structure/components/observers/CommandHandler.js @@ -89,7 +89,7 @@ class CommandHandler extends Observer { const { command, subcommand } = interaction; if(!interaction.guild && command.guildOnly) { - return interaction.reply({ template: { index: 'O_COMMANDHANDLER_GUILDONLY' }, emoji: 'failure', ephemeral: true }); + return interaction.reply({ index: 'O_COMMANDHANDLER_GUILDONLY', emoji: 'failure', ephemeral: true }); } let error = null; @@ -136,7 +136,8 @@ class CommandHandler extends Observer { } - async _parseOption(thing, option) { + async _parseOption(interaction, option) { + const { guild } = interaction; const types = { // ROLES: (string) => { @@ -174,7 +175,7 @@ class CommandHandler extends Observer { MEMBER: async (user) => { let member = null; try { - member = await thing.guild.members.fetch(user); + member = await guild.members.fetch(user); } catch(error) {} //eslint-disable-line no-empty if(!member) return { error: true }; return { error: false, value: member }; @@ -182,7 +183,8 @@ class CommandHandler extends Observer { USER: (user) => { return { error: false, value: user }; }, - TEXT_CHANNEL: (channel) => { + TEXT_CHANNEL: async (channel) => { + channel = await guild.resolveChannel(channel); if(channel.type !== 'GUILD_TEXT') return { error: true }; return { error: false, value: channel }; },