Skip to content

Commit

Permalink
feat(Channel): add isVoice() (#6297)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaStormer committed Aug 5, 2021
1 parent dd3a79e commit 5b4efd1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/structures/Channel.js
Expand Up @@ -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');

/**
Expand Down Expand Up @@ -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}
Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Expand Up @@ -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;
}
Expand Down

0 comments on commit 5b4efd1

Please sign in to comment.