mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat(Channel): add isVoice() (#6297)
This commit is contained in:
@@ -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
1
typings/index.d.ts
vendored
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user