In discordjs v14, channel#isText()
, channel#isVoice()
, channel#isDM()
, etc. are not available any more. You should use the ChannelType
enums instead.
If you want to check if a channel is a TextChannel
, you can use the following:
const { ChannelType, Client } = require('discord.js');
// ..
if (message.channel.type === ChannelType.GuildText)
Also, channel.type
is no longer a string but a number. For example, channel.type
for a TextChannel
returns 0
, that's why channel.type === 'GUILD_TEXT'
no longer works for you.
Here is a list of channel types in v14:
channel type |
v12 |
v13 |
v14 |
v14 type() |
guild text channel |
text |
GUILD_TEXT |
GuildText |
0 |
DM channel |
dm |
DM |
DM |
1 |
guild voice channel |
voice |
GUILD_VOICE |
GuildVoice |
2 |
group DM channel |
N/A |
GROUP_DM |
GroupDM |
3 |
guild category channel |
category |
GUILD_CATEGORY |
GuildCategory |
4 |
guild news channel |
news |
GUILD_NEWS |
GuildNews |
5 |
guild news channel's public thread channel |
N/A |
GUILD_NEWS_THREAD |
GuildNewsThread |
10 |
guild text channel's public thread channel |
N/A |
GUILD_PUBLIC_THREAD |
GuildPublicThread |
11 |
guild text channel's private thread channel |
N/A |
GUILD_PRIVATE_THREAD |
GuildPrivateThread |
12 |
guild stage voice channel |
N/A |
GUILD_STAGE_VOICE |
GuildStageVoice |
13 |
guild store channel |
store |
GUILD_STORE |
N/A |
N/A |
generic channel of unknown type |
unknown |
UNKNOWN |
N/A |
N/A |