Skip to main content

Function: isNsfwChannel()

isNsfwChannel(channel: Nullish | ChannelTypes): boolean

Checks whether a given channel allows NSFW content or not

For the following channel types this is always false:

  • ChannelType.DM
  • ChannelType.GroupDM
  • ChannelType.GuildCategory
  • ChannelType.GuildStageVoice
  • ChannelType.GuildVoice
  • ChannelType.GuildDirectory

For the following channel types the actual channel is checked:

  • ChannelType.GuildAnnouncement
  • ChannelType.GuildText
  • ChannelType.GuildForum

For the following channel types the parent of the channel is checked:

  • ChannelType.AnnouncementThread
  • ChannelType.PrivateThread
  • ChannelType.PublicThread
  • ChannelType.MediaChannel

Parameters

ParameterTypeDescription
channelNullish | ChannelTypesThe channel to check.

Returns

boolean

Source

projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:198