fixed text channel parsing

This commit is contained in:
Erik 2022-01-17 17:44:08 +02:00
parent f65ce7d3eb
commit 461ffbf4ef
No known key found for this signature in database
GPG Key ID: FEFF4B220DDF5589

View File

@ -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 };
},