forked from Galactic/galactic-bot
bugfix to channel type checks
This commit is contained in:
parent
4c5cb81e42
commit
c875ac2e2f
@ -22,7 +22,7 @@ class PruneCommand extends ModerationCommand
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'channels',
|
name: 'channels',
|
||||||
type: CommandOptionType.CHANNELS,
|
type: CommandOptionType.TEXT_CHANNELS,
|
||||||
description: 'The channels to prune'
|
description: 'The channels to prune'
|
||||||
}, {
|
}, {
|
||||||
name: 'users',
|
name: 'users',
|
||||||
|
@ -428,7 +428,7 @@ class CommandOption
|
|||||||
throw new Error('Invalid rawValue');
|
throw new Error('Invalid rawValue');
|
||||||
for (const arg of this.#rawValue)
|
for (const arg of this.#rawValue)
|
||||||
{
|
{
|
||||||
const channel = await this.#guild.resolveChannel(arg, this.strict, (ch) => ch.type === ChannelType.GuildText);
|
const channel = await this.#guild.resolveChannel(arg, this.strict, (ch) => ch.isTextBased());
|
||||||
if (channel)
|
if (channel)
|
||||||
{
|
{
|
||||||
channels.push(channel);
|
channels.push(channel);
|
||||||
@ -455,7 +455,7 @@ class CommandOption
|
|||||||
{
|
{
|
||||||
const channel = await this.#guild.resolveChannel(
|
const channel = await this.#guild.resolveChannel(
|
||||||
arg, this.strict,
|
arg, this.strict,
|
||||||
(ch) => ch.type === ChannelType.GuildVoice
|
(ch) => ch.isVoiceBased()
|
||||||
);
|
);
|
||||||
if (channel)
|
if (channel)
|
||||||
{
|
{
|
||||||
@ -645,7 +645,7 @@ class CommandOption
|
|||||||
if (typeof this.#rawValue !== 'string')
|
if (typeof this.#rawValue !== 'string')
|
||||||
throw new Error('Invalid rawValue');
|
throw new Error('Invalid rawValue');
|
||||||
const channel = await this.#guild.resolveChannel(this.#rawValue);
|
const channel = await this.#guild.resolveChannel(this.#rawValue);
|
||||||
if (!channel || channel.type !== ChannelType.GuildText)
|
if (!channel || !channel.isTextBased())
|
||||||
return { error: true };
|
return { error: true };
|
||||||
return { value: channel, removed: [ this.#rawValue ] };
|
return { value: channel, removed: [ this.#rawValue ] };
|
||||||
},
|
},
|
||||||
@ -658,7 +658,7 @@ class CommandOption
|
|||||||
if (typeof this.#rawValue !== 'string')
|
if (typeof this.#rawValue !== 'string')
|
||||||
throw new Error('Invalid rawValue');
|
throw new Error('Invalid rawValue');
|
||||||
const channel = await this.#guild.resolveChannel(this.#rawValue);
|
const channel = await this.#guild.resolveChannel(this.#rawValue);
|
||||||
if (!channel || channel.type !== ChannelType.GuildVoice)
|
if (!channel || !channel.isVoiceBased())
|
||||||
return { error: true };
|
return { error: true };
|
||||||
return { value: channel, removed: [ this.#rawValue ] };
|
return { value: channel, removed: [ this.#rawValue ] };
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user