fixed text channel parsing
This commit is contained in:
parent
f65ce7d3eb
commit
461ffbf4ef
@ -89,7 +89,7 @@ class CommandHandler extends Observer {
|
|||||||
const { command, subcommand } = interaction;
|
const { command, subcommand } = interaction;
|
||||||
|
|
||||||
if(!interaction.guild && command.guildOnly) {
|
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;
|
let error = null;
|
||||||
@ -136,7 +136,8 @@ class CommandHandler extends Observer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async _parseOption(thing, option) {
|
async _parseOption(interaction, option) {
|
||||||
|
const { guild } = interaction;
|
||||||
|
|
||||||
const types = {
|
const types = {
|
||||||
// ROLES: (string) => {
|
// ROLES: (string) => {
|
||||||
@ -174,7 +175,7 @@ class CommandHandler extends Observer {
|
|||||||
MEMBER: async (user) => {
|
MEMBER: async (user) => {
|
||||||
let member = null;
|
let member = null;
|
||||||
try {
|
try {
|
||||||
member = await thing.guild.members.fetch(user);
|
member = await guild.members.fetch(user);
|
||||||
} catch(error) {} //eslint-disable-line no-empty
|
} catch(error) {} //eslint-disable-line no-empty
|
||||||
if(!member) return { error: true };
|
if(!member) return { error: true };
|
||||||
return { error: false, value: member };
|
return { error: false, value: member };
|
||||||
@ -182,7 +183,8 @@ class CommandHandler extends Observer {
|
|||||||
USER: (user) => {
|
USER: (user) => {
|
||||||
return { error: false, value: 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 };
|
if(channel.type !== 'GUILD_TEXT') return { error: true };
|
||||||
return { error: false, value: channel };
|
return { error: false, value: channel };
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user