Skip to main content

Module: @sapphire/discord.js-utilities

Classes

Interfaces

Type aliases

ChannelTypeString

ฦฌ ChannelTypeString: ChannelTypes["type"] | "UNKNOWN"

The types of a channel, with the addition of 'UNKNOWN'

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/utility-types.ts:65


ChannelTypes

ฦฌ ChannelTypes: CategoryChannel | DMChannel | PartialDMChannel | NewsChannel | StageChannel | StoreChannel | TextChannel | ThreadChannel | VoiceChannel | GuildChannel | Channel

A union of all the various types of channels that Discord.js has

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/utility-types.ts:19


GuildBasedChannelTypes

ฦฌ GuildBasedChannelTypes: NonThreadGuildBasedChannelTypes | ThreadChannel

A union of all the channel types that belong to a guild, including {@link ThreadChannel}

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/utility-types.ts:50


GuildTextBasedChannelTypes

ฦฌ GuildTextBasedChannelTypes: NonThreadGuildTextBasedChannelTypes | ThreadChannel

A union of guild based message channels, including {@link ThreadChannel}

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/utility-types.ts:60


MessageBuilderFileResolvable

ฦฌ MessageBuilderFileResolvable: NonNullable<MessageOptions["files"]>[number]

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:3


MessageBuilderResolvable

ฦฌ MessageBuilderResolvable: Omit<MessageOptions, "embed" | "disableMentions" | "reply"> & { embeds?: MessageOptions["embeds"] }

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:4


MessagePrompterChannelTypes

ฦฌ MessagePrompterChannelTypes: Exclude<ChannelTypes, VoiceBasedChannelTypes | StoreChannel | CategoryChannel>

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/MessagePrompter/constants.ts:10


MessagePrompterMessage

ฦฌ MessagePrompterMessage: ArgumentTypes<PartialTextBasedChannelFields["send"]>[0]

A type to extend multiple discord types and simplify usage in MessagePrompter

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/MessagePrompter/constants.ts:8


NonThreadGuildBasedChannelTypes

ฦฌ NonThreadGuildBasedChannelTypes: Extract<ChannelTypes, GuildChannel>

A union of all the channel types that belong to a guild, not including {@link ThreadChannel}

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/utility-types.ts:45


NonThreadGuildTextBasedChannelTypes

ฦฌ NonThreadGuildTextBasedChannelTypes: Extract<TextBasedChannelTypes, GuildChannel>

A union of guild based message channels, not including {@link ThreadChannel}

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/utility-types.ts:55


PaginatedMessageEmbedResolvable

ฦฌ PaginatedMessageEmbedResolvable: MessageOptions["embeds"]

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessageTypes.ts:134


PaginatedMessageMessageOptionsUnion

ฦฌ PaginatedMessageMessageOptionsUnion: MessageOptions | WebhookEditMessageOptions

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessageTypes.ts:136


PaginatedMessagePage

ฦฌ PaginatedMessagePage: (index: number, pages: PaginatedMessagePage[], handler: PaginatedMessage) => Awaitable<PaginatedMessageMessageOptionsUnion> | PaginatedMessageMessageOptionsUnion

The pages that are used for PaginatedMessage.pages

Pages can be either a {@link Message}, or an Awaitable function that returns a {@link Message}.

Furthermore, {@link MessageOptions} can be used to construct the pages without state. This library also provides MessageBuilder, which can be used as a chainable alternative to raw objects, similar to how {@link MessageEmbed} works.

Ideally, however, you should use the utility functions addPageBuilder, addPageContent, and addPageEmbed as opposed to manually constructing MessagePages. This is because a PaginatedMessage does a lot of post-processing on the provided pages and we can only guarantee this will work properly when using the utility methods.

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessageTypes.ts:113


PaginatedMessageSelectMenuOptionsFunction

ฦฌ PaginatedMessageSelectMenuOptionsFunction: (pageIndex: number, internationalizationContext: PaginatedMessageInternationalizationContext) => Awaitable<Omit<MessageSelectOptionData, "value">>

Type declaration

โ–ธ (pageIndex, internationalizationContext): Awaitable<Omit<MessageSelectOptionData, "value">>

The type of the custom function that can be set for the PaginatedMessage.selectMenuOptions

Parameters
NameType
pageIndexnumber
internationalizationContextPaginatedMessageInternationalizationContext
Returns

Awaitable<Omit<MessageSelectOptionData, "value">>

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessageTypes.ts:120


PaginatedMessageWrongUserInteractionReplyFunction

ฦฌ PaginatedMessageWrongUserInteractionReplyFunction: (targetUser: User, interactionUser: User, internationalizationContext: PaginatedMessageInternationalizationContext) => Awaitable<Parameters<MessageComponentInteraction["reply"]>[0]>

Type declaration

โ–ธ (targetUser, interactionUser, internationalizationContext): Awaitable<Parameters<MessageComponentInteraction["reply"]>[0]>

The type of the custom function that can be set for the PaginatedMessage.wrongUserInteractionReply

Parameters
NameType
targetUserUser
interactionUserUser
internationalizationContextPaginatedMessageInternationalizationContext
Returns

Awaitable<Parameters<MessageComponentInteraction["reply"]>[0]>

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessageTypes.ts:128


TextBasedChannelTypes

ฦฌ TextBasedChannelTypes: Message["channel"]

A union of all the channel types that a message can come from

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/utility-types.ts:35


VoiceBasedChannelTypes

ฦฌ VoiceBasedChannelTypes: VoiceChannel | StageChannel

A union of all the voice-based channel types that Discord.js has

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/utility-types.ts:40

Variables

ChannelLimits

โ€ข ChannelLimits: Object

Namespace containing limits related to Discord channels.

Type declaration

NameTypeDescription
MaximumDescriptionLength1024Maximum characters allowed in a channel description.
MaximumNameLength100Maximum characters allowed in a channel name.
MaximumViewersPerScreenShare50Maximum viewers allowed per screen share.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:4


ChannelMentionRegex

โ€ข ChannelMentionRegex: RegExp

Regex that can capture the ID in Discord Channel mentions

raw /^<#(?<id>\d{17,19})>$/

remark Capture group 1 is the ID of the channel. It is named id.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:6


ChannelMessageRegex

โ€ข ChannelMessageRegex: RegExp

Regex that can capture the channel and message IDs in a channelId-messageId pattern This pattern can be found when you hold Shift and hover over a message, and click the "ID" button

raw /^(?<channelId>\d{17,19})-(?<messageId>\d{17,19})$/

remark Capture group 1 is the ID of the channel, named channelId.

remark Capture group 2 is the ID of the message, named messageId.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:14


DiscordHostnameRegex

โ€ข DiscordHostnameRegex: RegExp

Regex that matches links on the known Discord host names

raw /(?<subdomain>\w+)\.?(?<hostname>dis(?:cord)?(?:app|merch|status)?)\.(?<tld>com|g(?:d|g|ift)|(?:de(?:sign|v))|media|new|store|net)/i

remark The regex is case insensitive

remark Capture group 1 is the subdomain for this URL. It is named subdomain.

remark Capture group 2 is the hostname for this URL, primarily discord but can also be discordmerch, discordstatus, dis, and discordapp. It is named hostname.

remark Capture group 3 is the Top-Level Domain without .. It is named tld.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:23


DiscordInviteLinkRegex

โ€ข DiscordInviteLinkRegex: RegExp

Regex that can can capture the code of Discord invite links

raw /^(?:https?:\/\/)?(?:www\.)?(?:discord\.gg\/|discord(?:app)?\.com\/invite\/)?(?<code>[\w\d-]{2,})$/i

remark Capture group 1 is the invite URL's unique code. It is named code.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:29


EmbedLimits

โ€ข EmbedLimits: Object

Namespace containing limits related to Discord embeds.

Type declaration

NameTypeDescription
MaximumAuthorNameLength256Maximum characters allowed in the author field of an embed.
MaximumDescriptionLength4096Maximum characters allowed in an embed description.
MaximumFieldNameLength256Maximum characters allowed in the name of a field in an embed.
MaximumFieldValueLength1024Maximum characters allowed in the avlue of a field in an embed.
MaximumFields25Maximum fields allowed in an embed.
MaximumFooterLength2048Maximum characters allowed in a footer of an embed.
MaximumTitleLength256Maximum characters allowed in the title of an embed.
MaximumTotalCharacters6000Maximum characters allowed in an embed, in total.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:21


EmojiLimits

โ€ข EmojiLimits: Object

Namespace containing limits related to Discord emojis.

Type declaration

NameTypeDescription
MaximumEmojiNameLength32Maximum characters allowed in a custom guild emoji.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:58


EmojiRegex

โ€ข EmojiRegex: RegExp

Regex that can capture the ID of any animated or non-animated custom Discord emoji

raw /^(?:<(?<animated>a)?:(?<name>\w{2,32}):)?(?<id>\d{17,21})>?$/

remark Capture group 1 can be used to determine whether the emoji is animated or not. It is named animated.

remark Capture group 2 is the name of the emoji as it is typed in a message. It is named name.

remark Capture group 3 is the ID of the emoji. It is named id.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:37


FormattedCustomEmoji

โ€ข FormattedCustomEmoji: RegExp

Regex that matches any animated or non-animated custom Discord emoji. Unlike EmojiRegex It can be a substring of a larger string.

raw /<a?:\w{2,32}:\d{17,18}>/

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:43


FormattedCustomEmojiWithGroups

โ€ข FormattedCustomEmojiWithGroups: RegExp

Regex that can capture any animated or non-animated custom Discord emoji. Similar to FormattedCustomEmoji and unlike EmojiRegex can also be a substring of a larger string.

raw /(?<animated>a?):(?<name>[^:]+):(?<id>\d{17,19})/

remark Capture group 1 can be used to determine whether the emoji is animated or not. It is named animated.

remark Capture group 2 is the name of the emoji as it is typed in a message. It is named name.

remark Capture group 3 is the ID of the emoji. It is named id.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:52


GuildLimits

โ€ข GuildLimits: Object

Namespace containing limits related to Discord guilds.

Type declaration

NameTypeDescription
MaximumChannels500Maximum channels allowed per guild, including category channels.
MaximumRoles250Maximum roles allowed in a guild.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:67


GuildMemberLimits

โ€ข GuildMemberLimits: Object

Namespace containing limits related to Discord guild members.

Type declaration

NameTypeDescription
MaximumDisplayNameLength32Maximum characters allowed in the display name of a guild member.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:80


HttpUrlRegex

โ€ข HttpUrlRegex: RegExp

Regex that matches any URL starting with http or https

raw /^https?:\/\//

remark for WebSocket URLs see {@link WebsocketGenericUrlRegex}

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:58


InteractionLimits

โ€ข InteractionLimits: Object

Namespace containing limits related to Discord interactions.

Type declaration

NameTypeDescription
MaximumButtonsPerActionRow5Maximum buttons allowed in a single action row.
MaximumOptionsInSelectMenus25Maximum options allowed in a single select menu.
MaximumSelectMenusPerActionRow1Maximum select menus allowed in a single action row.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:89


MessageLimits

โ€ข MessageLimits: Object

Namespace containing limits related to Discord messages.

Type declaration

NameTypeDescription
MaximumActionRows5Maximum action rows allowed in a single message.
MaximumEmbeds10Maximum embeds allowed in a single message.
MaximumLength2000Maximum characters allowed in a single message for a user.
MaximumNitroLength4000Maximum characters allowed in a single message for a nitro user.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:106


MessageLinkRegex

โ€ข MessageLinkRegex: RegExp

Regex that can capture the Guild, Channel, and Message ID based on a shareable Discord message link.

raw /^(?:https:\/\/)?(?:ptb\.|canary\.)?discord(?:app)?\.com\/channels\/(?<guildId>(?:\d{17,19}|@me))\/(?<channelId>\d{17,19})\/(?<messageId>\d{17,19})$/

remark Capture group 1 is the ID of the guild the message was sent in. It is named guildId.

remark Capture group 2 is the ID of the channel in that guild the message was sent in. It is named channelId.

remark Capture group 3 is the ID of the message itself. It is named messageId.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:66


ParsedCustomEmoji

โ€ข ParsedCustomEmoji: RegExp

Regex that matches any animated or non-animated custom Discord emoji *without the wrapping <...> symbols. This means that a string that matches this regex can directly be send inside a Discord message. Other than this difference it is similar to FormattedCustomEmoji.

raw /a?:\w{2,32}:\d{17,18}/

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:73


ParsedCustomEmojiWithGroups

โ€ข ParsedCustomEmojiWithGroups: RegExp

Regex that matches any animated or non-animated custom Discord emoji *without the wrapping <...> symbols. This means that a string that matches this regex can directly be send inside a Discord message. Other than this difference it is similar to FormattedCustomEmojiWithGroups.

raw /(?<animated>a?):(?<name>[^:]+):(?<id>\d{17,19})/

remark Capture group 1 can be used to determine whether the emoji is animated or not. It is named animated.

remark Capture group 2 is the name of the emoji as it is typed in a message. It is named name.

remark Capture group 3 is the ID of the emoji. It is named id.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:83


RoleLimits

โ€ข RoleLimits: Object

Namespace containing limits related to Discord roles.

Type declaration

NameTypeDescription
MaximumNameLength100Maximum characters allowed in a role name.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:127


RoleMentionRegex

โ€ข RoleMentionRegex: RegExp

Regex that can capture the ID in Discord Role mentions

raw /^<@&(?<id>\d{17,19})>$/

remark Capture group 1 is the ID of the role. It is named id.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:89


SnowflakeRegex

โ€ข SnowflakeRegex: RegExp

Regex that can capture any Discord Snowflake ID

raw /^(?<id>\d{17,19})$/

remark Capture group 1 is the Snowflake. It is named id.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:95


TwemojiRegex

โ€ข TwemojiRegex: RegExp

Regex that can capture a Twemoji (Twitter Emoji)

raw See official source code

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:100


UserLimits

โ€ข UserLimits: Object

Namespace containing limits related to Discord users and Direct Messages.

Type declaration

NameTypeDescription
MaximumUsersPerDMGroup10Maximum numbers of users in a DM group.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:136


UserOrMemberMentionRegex

โ€ข UserOrMemberMentionRegex: RegExp

Regex that can capture the ID of a user in Discord user mentions

raw /^<@!?(?<id>\d{17,19})>$/

remark Capture group 1 is the ID of the user. It is named id.

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:106


WebSocketUrlRegex

โ€ข WebSocketUrlRegex: RegExp

Regex that matches any WebSocket URL starting with ws or wss

raw /^wss?:\/\//

remark for regular HTTP URLs see HttpUrlRegex

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:112


WebhookRegex

โ€ข WebhookRegex: RegExp

Regex that captures the Webhook ID and token from a Discord Webhook URL.

raw /(?<url>^https:\/\/(?:(?:canary|ptb).)?discordapp.com\/api\/webhooks\/(?<id>\d+)\/(?<token>[\w-]+)\/?$)/

remark Capture group 1 is the full URL of the Discord Webhook. It is named url.

remark Capture group 2 is the ID of the Discord Webhook. It is named id.

remark Capture group 3 is the token of the Discord Webhook. It is named token.

remark for regular HTTP URLs see HttpUrlRegex

Defined in

node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:121

Functions

canReact

โ–ธ canReact(channel): boolean

Determines whether or not we can send react to messages in a given channel.

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to test the permissions from.

Returns

boolean

Whether or not we can react to messages in the specified channel.

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/utilities.ts:72


canReadMessages

โ–ธ canReadMessages(channel): boolean

Determines whether or not we can send messages in a given channel.

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to test the permissions from.

Returns

boolean

Whether or not we can send messages in the specified channel.

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/utilities.ts:13


canRemoveAllReactions

โ–ธ canRemoveAllReactions(channel): boolean

Determines whether or not we can remove reactions from messages in a given channel.

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to test the permissions from.

Returns

boolean

Whether or not we can remove reactions from messages in the specified channel.

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/utilities.ts:87


canSendAttachments

โ–ธ canSendAttachments(channel): boolean

Determines whether or not we can send attachments in a given channel.

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to test the permissions from.

Returns

boolean

Whether or not we can send attachments in the specified channel.

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/utilities.ts:57


canSendEmbeds

โ–ธ canSendEmbeds(channel): boolean

Determines whether or not we can send embeds in a given channel.

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to test the permissions from.

Returns

boolean

Whether or not we can send embeds in the specified channel.

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/utilities.ts:42


canSendMessages

โ–ธ canSendMessages(channel): boolean

Determines whether or not we can send messages in a given channel.

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to test the permissions from.

Returns

boolean

Whether or not we can send messages in the specified channel.

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/utilities.ts:27


createPartitionedMessageRow

โ–ธ createPartitionedMessageRow(components): MessageActionRow[]

Parameters

NameType
components(MessageButton | MessageSelectMenu)[]

Returns

MessageActionRow[]

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/utils.ts:14


isCategoryChannel

โ–ธ isCategoryChannel(channel): channel is CategoryChannel

Checks whether a given channel is a {@link CategoryChannel}

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to check

Returns

channel is CategoryChannel

Defined in

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


isDMChannel

โ–ธ isDMChannel(channel): channel is DMChannel | PartialDMChannel

Checks whether a given channel is a {@link DMChannel}

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to check

Returns

channel is DMChannel | PartialDMChannel

Defined in

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


isGroupChannel

โ–ธ isGroupChannel(channel): channel is PartialGroupDMChannel

Checks whether a given channel is a {@link PartialGroupDMChannel}

Parameters

NameTypeDescription
channelPartialDMChannel | Channel | NullishThe channel to check

Returns

channel is PartialGroupDMChannel

Defined in

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


isGuildBasedChannel

โ–ธ isGuildBasedChannel(channel): channel is GuildTextBasedChannelTypes

Checks if a channel comes from a guild.

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to check

Returns

channel is GuildTextBasedChannelTypes

Whether or not the channel is guild-based.

Defined in

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


isGuildBasedChannelByGuildKey

โ–ธ isGuildBasedChannelByGuildKey(channel): channel is GuildTextBasedChannelTypes

Checks whether or not a channel comes from a guild.

remark As opposed to isGuildBasedChannel this checks if there is guild property on the channel.

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to check.

Returns

channel is GuildTextBasedChannelTypes

Whether or not the channel is guild-based.

Defined in

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


isMessageButtonComponent

โ–ธ isMessageButtonComponent(component): component is MessageButton

Parameters

NameType
componentMessageButton | MessageSelectMenu

Returns

component is MessageButton

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/utils.ts:10


isMessageButtonInteraction

โ–ธ isMessageButtonInteraction(interaction): interaction is InteractionButtonOptions

Parameters

NameType
interactionInteractionButtonOptions | MessageSelectMenuOptions

Returns

interaction is InteractionButtonOptions

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/utils.ts:4


isNewsChannel

โ–ธ isNewsChannel(channel): channel is NewsChannel

Checks whether a given channel is a {@link NewsChannel}.

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to check.

Returns

channel is NewsChannel

Defined in

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


isNewsThreadChannel

โ–ธ isNewsThreadChannel(channel): channel is ThreadChannel

Checks whether a given channel is a News {@link ThreadChannel}

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to check.

Returns

channel is ThreadChannel

Defined in

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


isNsfwChannel

โ–ธ isNsfwChannel(channel): boolean

Checks whether a given channel allows NSFW content or not

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to check.

Returns

boolean

Defined in

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


isPrivateThreadChannel

โ–ธ isPrivateThreadChannel(channel): channel is ThreadChannel

Checks whether a given channel is a Private {@link ThreadChannel}

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to check.

Returns

channel is ThreadChannel

Defined in

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


isPublicThreadChannel

โ–ธ isPublicThreadChannel(channel): channel is ThreadChannel

Checks whether a given channel is a Public {@link ThreadChannel}

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to check.

Returns

channel is ThreadChannel

Defined in

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


isStageChannel

โ–ธ isStageChannel(channel): channel is StageChannel

Checks whether a given channel is a {@link StageChannel}

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to check

Returns

channel is StageChannel

Defined in

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


isStoreChannel

โ–ธ isStoreChannel(channel): channel is StoreChannel

Checks whether a given channel is a {@link StoreChannel}

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to check

Returns

channel is StoreChannel

Defined in

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


isTextBasedChannel

โ–ธ isTextBasedChannel(channel): channel is DMChannel | PartialDMChannel | NewsChannel | TextChannel | ThreadChannel

Checks whether a given channel is a TextBasedChannelTypes. This means it has a send method.

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to check.

Returns

channel is DMChannel | PartialDMChannel | NewsChannel | TextChannel | ThreadChannel

Defined in

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


isTextChannel

โ–ธ isTextChannel(channel): channel is TextChannel

Checks whether a given channel is a {@link TextChannel}.

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to check.

Returns

channel is TextChannel

Defined in

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


isThreadChannel

โ–ธ isThreadChannel(channel): channel is ThreadChannel

Checks whether a given channel is a {@link ThreadChannel}

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to check.

Returns

channel is ThreadChannel

Defined in

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


isVoiceChannel

โ–ธ isVoiceChannel(channel): channel is VoiceChannel

Checks whether a given channel is a {@link VoiceChannel}

Parameters

NameTypeDescription
channelChannelTypes | NullishThe channel to check

Returns

channel is VoiceChannel

Defined in

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