feat(Channel): add isVoice() (#6297)

This commit is contained in:
DaStormer
2021-08-05 11:41:06 -04:00
committed by GitHub
parent dd3a79eead
commit 5b4efd13c9
2 changed files with 11 additions and 1 deletions

View File

@@ -9,7 +9,7 @@ let StoreChannel;
let TextChannel;
let ThreadChannel;
let VoiceChannel;
const { ChannelTypes, ThreadChannelTypes } = require('../util/Constants');
const { ChannelTypes, ThreadChannelTypes, VoiceBasedChannelTypes } = require('../util/Constants');
const SnowflakeUtil = require('../util/SnowflakeUtil');
/**
@@ -117,6 +117,15 @@ class Channel extends Base {
return 'messages' in this;
}
/**
* Indicates whether this channel is voice-based
* ({@link VoiceChannel} or {@link StageChannel}).
* @returns {boolean}
*/
isVoice() {
return VoiceBasedChannelTypes.includes(this.type);
}
/**
* Indicates whether this channel is a {@link ThreadChannel}.
* @returns {boolean}

1
typings/index.d.ts vendored
View File

@@ -354,6 +354,7 @@ export class Channel extends Base {
public delete(): Promise<Channel>;
public fetch(force?: boolean): Promise<Channel>;
public isText(): this is TextBasedChannels;
public isVoice(): this is VoiceChannel | StageChannel;
public isThread(): this is ThreadChannel;
public toString(): ChannelMention;
}