Skip to main content

Module: @sapphire/discord.js-utilities

Classes

Interfaces

Type Aliases

AnyInteractableInteraction

Ƭ AnyInteractableInteraction: Exclude<AnyInteraction, AutocompleteInteraction>

A union of ChatInputCommandInteraction, UserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, StringSelectMenuInteraction, ButtonInteraction, and ModalSubmitInteraction

Defined in

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


AnyInteraction

Ƭ AnyInteraction: Interaction

A union of ChatInputCommandInteractionUserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, AutocompleteInteraction, StringSelectMenuInteraction, ButtonInteraction, and ModalSubmitInteraction

Defined in

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


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:70


ChannelTypes

Ƭ ChannelTypes: CategoryChannel | DMChannel | PartialDMChannel | NewsChannel | StageChannel | 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:25


ChatInputOrContextMenuCommandInteraction

Ƭ ChatInputOrContextMenuCommandInteraction: ChatInputCommandInteraction | UserContextMenuCommandInteraction | MessageContextMenuCommandInteraction

A union of ChatInputCommandInteraction, UserContextMenuCommandInteraction and MessageContextMenuCommandInteraction. Similar to CommandInteraction class but as a type union.

Defined in

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


EmbedResolvable

Ƭ EmbedResolvable: JSONEncodable<APIEmbed> | APIEmbed

Represents a resolvable object that can be used to create an embed in Discord. It can be either a JSON-encodable object or an APIEmbed object.

Defined in

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


GuildBasedChannelTypes

Ƭ GuildBasedChannelTypes: NonThreadGuildBasedChannelTypes | ThreadChannel

A union of all the channel types that belong to a guild, including ThreadChannel

Defined in

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


GuildTextBasedChannelTypes

Ƭ GuildTextBasedChannelTypes: NonThreadGuildTextBasedChannelTypes | ThreadChannel

A union of guild based message channels, including ThreadChannel

Defined in

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


MessageBuilderFileResolvable

Ƭ MessageBuilderFileResolvable: NonNullable<MessageCreateOptions["files"]>[number]

Defined in

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


MessageBuilderResolvable

Ƭ MessageBuilderResolvable: Omit<MessageCreateOptions, "embed" | "disableMentions" | "reply"> & { components?: MessageCreateOptions["components"] ; embeds?: MessageCreateOptions["embeds"] }

Defined in

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


MessagePrompterChannelTypes

Ƭ MessagePrompterChannelTypes: Exclude<ChannelTypes, VoiceBasedChannelTypes | 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


NonModalInteraction

Ƭ NonModalInteraction: ChatInputOrContextMenuCommandInteraction | AutocompleteInteraction | StringSelectMenuInteraction | ButtonInteraction

A union of ChatInputCommandInteractionUserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, AutocompleteInteraction, StringSelectMenuInteraction and ButtonInteraction

Defined in

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


NonThreadGuildBasedChannelTypes

Ƭ NonThreadGuildBasedChannelTypes: Extract<ChannelTypes, GuildChannel>

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

Defined in

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


NonThreadGuildTextBasedChannelTypes

Ƭ NonThreadGuildTextBasedChannelTypes: Extract<TextBasedChannelTypes, GuildChannel>

A union of guild based message channels, not including ThreadChannel

Defined in

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


PaginatedMessageAction

Ƭ PaginatedMessageAction: PaginatedMessageActionButton | PaginatedMessageActionLink | PaginatedMessageActionStringMenu | PaginatedMessageActionUserMenu | PaginatedMessageActionRoleMenu | PaginatedMessageActionMentionableMenu | PaginatedMessageActionChannelMenu

Represents an action that can be performed in a paginated message.

Defined in

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


PaginatedMessageActionButton

Ƭ PaginatedMessageActionButton: InteractionButtonComponentData & PaginatedMessageActionRun

To utilize buttons you can pass an object with the structure of PaginatedMessageActionButton to PaginatedMessage actions.

Example

const StopAction: PaginatedMessageActionButton = {
customId: 'CustomStopAction',
emoji: '⏹️',
run: ({ collector }) => {
collector.stop();
}
}

Defined in

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


PaginatedMessageActionChannelMenu

Ƭ PaginatedMessageActionChannelMenu: PaginatedMessageActionRun & ChannelSelectMenuComponentData & { options?: never }

To utilize Channel Select Menus you can pass an object with the structure of PaginatedMessageActionChannelMenu to PaginatedMessage actions.

Example

const ChannelMenu: PaginatedMessageActionChannelMenu = {
customId: 'CustomChannelSelectMenu',
type: ComponentType.ChannelSelect,
channelTypes: [ChannelType.GuildText],
run: ({ interaction }) => {
if (interaction.isChannelSelectMenu()) {
console.log(interaction.values[0])
}
}
}

Defined in

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


Ƭ PaginatedMessageActionLink: LinkButtonComponentData

To utilize links you can pass an object with the structure of PaginatedMessageActionLink to PaginatedMessage actions.

Example

 You can also give the object directly.

const LinkSapphireJs: PaginatedMessageActionLink = {
url: 'https://sapphirejs.dev',
label: 'Sapphire Website',
emoji: '🔗'
}

Defined in

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


PaginatedMessageActionMentionableMenu

Ƭ PaginatedMessageActionMentionableMenu: PaginatedMessageActionRun & MentionableSelectMenuComponentData & { options?: never }

To utilize Mentionable Select Menus you can pass an object with the structure of PaginatedMessageActionMentionableMenu to PaginatedMessage actions.

Example

const MentionableMenu: PaginatedMessageActionMentionableMenu = {
customId: 'CustomMentionableSelectMenu',
type: ComponentType.MentionableSelect,
run: ({ interaction }) => {
if (interaction.isMentionableSelectMenu()) {
console.log(interaction.values[0])
}
}
}

Defined in

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


PaginatedMessageActionRoleMenu

Ƭ PaginatedMessageActionRoleMenu: PaginatedMessageActionRun & RoleSelectMenuComponentData & { options?: never }

To utilize Role Select Menus you can pass an object with the structure of PaginatedMessageActionRoleMenu to PaginatedMessage actions.

Example

const RoleMenu: PaginatedMessageActionRoleMenu = {
customId: 'CustomRoleSelectMenu',
type: ComponentType.RoleSelect,
run: ({ interaction }) => {
if (interaction.isRoleSelectMenu()) {
console.log(interaction.values[0])
}
}
}

Defined in

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


PaginatedMessageActionStringMenu

Ƭ PaginatedMessageActionStringMenu: PaginatedMessageActionRun & StringSelectMenuComponentData

To utilize String Select Menus you can pass an object with the structure of PaginatedMessageActionStringMenu to PaginatedMessage actions.

Example

const StringMenu: PaginatedMessageActionStringMenu = {
customId: 'CustomStringSelectMenu',
type: ComponentType.StringSelect,
run: ({ handler, interaction }) => interaction.isStringSelectMenu() && (handler.index = parseInt(interaction.values[0], 10))
}

Defined in

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


PaginatedMessageActionUserMenu

Ƭ PaginatedMessageActionUserMenu: PaginatedMessageActionRun & UserSelectMenuComponentData & { options?: never }

To utilize User Select Menus you can pass an object with the structure of PaginatedMessageActionUserMenu to PaginatedMessage actions.

Example

const UserMenu: PaginatedMessageActionUserMenu = {
customId: 'CustomUserSelectMenu',
type: ComponentType.UserSelect,
run: ({ interaction }) => {
if (interaction.isChannelSelectMenu()) {
console.log(interaction.values[0])
}
}
}

Defined in

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


PaginatedMessageComponentUnion

Ƭ PaginatedMessageComponentUnion: JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<ActionRowComponentOptions | MessageActionRowComponentBuilder> | APIActionRowComponent<APIMessageActionRowComponent>

Represents a union type for components in a paginated message. It can be one of the following types:

  • JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>>
  • ActionRowData<ActionRowComponentOptions | MessageActionRowComponentBuilder>
  • APIActionRowComponent<APIMessageActionRowComponent>

Defined in

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


PaginatedMessageEmbedResolvable

Ƭ PaginatedMessageEmbedResolvable: BaseMessageOptions["embeds"]

Represents the resolvable type for the embeds property of a paginated message.

Defined in

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


PaginatedMessageInteractionUnion

Ƭ PaginatedMessageInteractionUnion: Exclude<CollectedInteraction, ModalSubmitInteraction>

Represents the union type of interactions for a paginated message, excluding the ModalSubmitInteraction.

Defined in

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


PaginatedMessageMessageOptionsUnion

Ƭ PaginatedMessageMessageOptionsUnion: Omit<PaginatedMessageResolvedPage, "components"> & { actions?: PaginatedMessageAction[] }

Represents the union of options for a paginated message.

Defined in

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


PaginatedMessagePage

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

The pages that are used for PaginatedMessage.pages

Pages can be either a Message, or an Awaitable function that returns a Message.

Furthermore, 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 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:259


PaginatedMessageResolvedPage

Ƭ PaginatedMessageResolvedPage: Omit<BaseMessageOptions, "flags"> | WebhookMessageEditOptions

Represents a resolved page for a paginated message. It can be either a BaseMessageOptions object with the flags property omitted, or a WebhookMessageEditOptions object.

Defined in

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


PaginatedMessageSelectMenuOptionsFunction

Ƭ PaginatedMessageSelectMenuOptionsFunction: (pageIndex: number, internationalizationContext: PaginatedMessageInternationalizationContext) => Awaitable<Omit<SelectMenuComponentOptionData, "value">>

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

Type declaration

▸ (pageIndex, internationalizationContext): Awaitable<Omit<SelectMenuComponentOptionData, "value">>

Parameters
NameType
pageIndexnumber
internationalizationContextPaginatedMessageInternationalizationContext
Returns

Awaitable<Omit<SelectMenuComponentOptionData, "value">>

Defined in

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


PaginatedMessageStopReasons

Ƭ PaginatedMessageStopReasons: "time" | "idle" | "user" | "messageDelete" | "channelDelete" | "threadDelete" | "guildDelete" | "limit" | "componentLimit" | "userLimit"

Represents the possible reasons for stopping a paginated message.

Defined in

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


PaginatedMessageWrongUserInteractionReplyFunction

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

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

Type declaration

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

Parameters
NameType
targetUserUser
interactionUserUser
internationalizationContextPaginatedMessageInternationalizationContext
Returns

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

Defined in

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


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:40


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:45

Variables

ActionMetadataLimits

Const ActionMetadataLimits: Object

Namespace containing limits related to Discord Auto Moderation Action Metadata.

Type declaration

NameTypeDescription
MaximumCustomBlockMessageLength150Maximum number of characters allowed in a custom block message.
MaximumTimeoutDurationSeconds2419200Maximum timeout duration in seconds.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:658


AllowedMentionsLimits

Const AllowedMentionsLimits: Object

Namespace containing limits related to Discord Message Allowed Mentions.

Type declaration

NameTypeDescription
MaximumRoles100Maximum number of roles allowed in an allowed mentions object.
MaximumUsers100Maximum number of users allowed in an allowed mentions object.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:671


ApplicationCommandLimits

Const ApplicationCommandLimits: Object

Namespace containing limits related to Discord application commands (slash commands).

Type declaration

NameTypeDescription
MaximumCombinedCharacters4000Maximum combined characters allowed in the name, description, and value properties of an application command, its options (including subcommands and groups), and choices.
MaximumDescriptionCharacters100Maximum characters allowed in an application command description.
MaximumNameCharacters32Maximum characters allowed in an application command name.
MaximumOptionsLength25Maximum options allowed in an application command.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:287


ApplicationCommandOptionLimits

Const ApplicationCommandOptionLimits: Object

Namespace containing limits related to Choices of Discord Application Commands.

Type declaration

NameTypeDescription
MaximumChoicesLength25Maximum length of choices allowed in the option of an application command.
MaximumDescriptionCharacters100Maximum characters allowed in the description of an option of an application command.
MaximumNameCharacters32Maximum characters allowed in the name of an option of an application command.
MaximumStringLength6000Maximum length of string allowed in the string option of an application command.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:308


ApplicationCommandPermissionLimits

Const ApplicationCommandPermissionLimits: Object

Namespace containing limits related to Permissions of Discord Application Commands.

Type declaration

NameTypeDescription
MaximumPermissionsLength100Maximum length of permissions allowed in the option of an application command.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:329


ApplicationRoleConnectionLimits

Const ApplicationRoleConnectionLimits: Object

Namespace containing limits related to Discord Application Role Connections.

Type declaration

NameTypeDescription
MaximumMetadataRecords5Maximum application role connection metadata records an application can have.
MaximumMetadataValueLength100Maximum characters allowed in metadata values.
MaximumPlatformNameLength50Maximum characters allowed in a platform name.
MaximumPlatformUsernameLength100Maximum characters allowed in a platform username.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:549


AutoCompleteLimits

Const AutoCompleteLimits: Object

Namespace container limits related to Discord autocomplete interactions.

Type declaration

NameTypeDescription
MaximumAmountOfOptions25Maximum options allowed in a single autocomplete response.
MaximumLengthOfNameOfOption100Maximum characters allowed in a select menu option's name.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:498


AutoModerationRuleLimits

Const AutoModerationRuleLimits: Object

Namespace containing limits related to Discord Auto Moderation Rules.

Type declaration

NameTypeDescription
MaximumExemptChannels50Maximum number of exempt channels a rule can have.
MaximumExemptRoles20Maximum number of exempt roles a rule can have.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:583


ButtonLimits

Const ButtonLimits: Object

Namespace containing limits related to Message Buttons.

Type declaration

NameTypeDescription
MaximumCustomIdCharacters100Maximum characters allowed in a button custom ID.
MaximumLabelCharacters80Maximum characters allowed in a button label.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:338


ChannelInviteLimits

Const ChannelInviteLimits: Object

Namespace containing limits related to Discord Channel Invites.

Type declaration

NameTypeDescription
MaximumAgeSeconds604800Maximum age of an invite in seconds.
MaximumUses100Maximum number of uses allowed for an invite.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:684


ChannelLimits

Const 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. Deprecated Use VoiceChannelLimits.MaximumViewersPerScreenShare instead.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:89


ChannelMentionRegex

Const ChannelMentionRegex: RegExp

Regex that can capture the ID in Discord Channel mentions

Raw

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

Remark

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

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:723


ChannelMessageRegex

Const 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,20})-(?<messageId>\d{17,20})$/

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/esm/index.d.mts:731


DiscordHostnameRegex

Const 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/esm/index.d.mts:740


DiscordInviteLinkRegex

Const DiscordInviteLinkRegex: RegExp

Regex that can can capture the code of Discord invite links

Raw

/(?:^|\b)discord(?:(?:app)?\.com/invite|\.gg(?:/invite)?)/(?<code>[\w-]{2,255})(?:$|\b)/gi

Remark

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

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:746


EmbedLimits

Const 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 value 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/esm/index.d.mts:151


EmojiLimits

Const EmojiLimits: Object

Namespace containing limits related to Discord emojis.

Type declaration

NameTypeDescription
MaximumEmojiNameLength32Maximum characters allowed in a custom guild emoji.
MaximumEmojiSize256000Maximum size allowed for a custom guild emoji. Size is in bytes, and corresponds to 256KB.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:188


EmojiRegex

Const 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/esm/index.d.mts:754


FormattedCustomEmoji

Const 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,20}>/

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:760


FormattedCustomEmojiWithGroups

Const 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,20})/

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/esm/index.d.mts:769


GuildAuditLogsLimits

Const GuildAuditLogsLimits: Object

Namespace containing limits related to Discord Guild Audit Logs.

Type declaration

NameTypeDescription
MaximumEntriesToFetch100Maximum number of entries to return from the guild audit log API.
MinimumEntriesToFetch1Minimum number of entries to return from the guild audit log API.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:570


GuildBansLimits

Const GuildBansLimits: Object

Namespace containing limits related to Discord guild bans.

Type declaration

NameTypeDescription
MaximumBansToFetch1000Maximum number of bans to return from the guild bans API.
MinimumBansToFetch1Minimum number of bans to return from the guild bans API.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:253


GuildIntegrationLimits

Const GuildIntegrationLimits: Object

Namespace containing limits related to Discord Guild Integrations.

Type declaration

NameTypeDescription
MaximumIntegrationsToFetch50Maximum number of integrations returned from the guild integrations API. Needs a more description name than "MaximumIntegrations".

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:697


GuildLimits

Const 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.
MaximumScheduledOrActiveEvents100Maximum scheduled or active events allowed in a guild.
MaximumUserGuildsToFetch200Maximum number of user guilds to return from the user guilds API.
MinimumUserGuildsToFetch1Minimum number of user guilds to return from the user guilds API.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:202


GuildMemberLimits

Const GuildMemberLimits: Object

Namespace containing limits related to Discord guild members.

Type declaration

NameTypeDescription
MaximumDisplayNameLength32Maximum characters allowed in the display name of a guild member.
MaximumMembersToFetch1000Maximum number of members to return from the guild members API.
MinimumMembersToFetch1Minimum number of members to return from the guild members API.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:236


GuildScheduledEventLimits

Const GuildScheduledEventLimits: Object

Namespace containing limits related to Discord guild scheduled events.

Type declaration

NameTypeDescription
MaximumUsersToFetch100Maximum number of users to return from the guild scheduled event users API.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:227


HttpUrlRegex

Const HttpUrlRegex: RegExp

Regex that matches any URL starting with http or https

Raw

/^https?:///

Remark

for WebSocket URLs see WebSocketUrlRegex

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:775


InteractionLimits

Const 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.
MaximumTextInputsPerActionRow1Maximum text inputs allowed in a single action row.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:266


MessageLimits

Const 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.
MaximumMessagesToBulkDelete100Maximum number of messages to delete in a single bulk delete request.
MaximumMessagesToFetch100Maximum number of messages to return from the channel messages API.
MaximumNitroBasicUploadSize50000000Maximum upload size for a Nitro Basic user, in any guild or in DMs. Size is in bytes, and corresponds to 50MB.
MaximumNitroLength4000Maximum characters allowed in a single message for a nitro user.
MaximumNitroUploadSize500000000Maximum upload size for a Nitro user, in any guild or in DMs. Size is in bytes, and corresponds to 500MB.
MaximumReactions20Maximum numbers of reactions allowed for a message.
MaximumRequestSize25000000Maximum request size when sending a messages. Size is in bytes, and corresponds to 25MB.
MaximumUploadSize25000000Maximum upload size for a free user in a guild of tier 1 or below, or in DMs. Size is in bytes, and corresponds to 25MB.
MaximumUploadSizeInGuildreadonly [25000000, 25000000, 50000000, 100000000]Maximum upload size for a free user for all different boost levels available in a guild. Sizes are in bytes, and correspond to 25MB, 25MB, 50MB, and 100MB.
MinimumMessagesToBulkDelete2Minimum number of messages to delete in a single bulk delete request.
MinimumMessagesToFetch1Minimum number of messages to return from the channel messages API.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:388


MessageLinkRegex

Const 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,20}|@me))/(?<channelId>\d{17,20})/(?<messageId>\d{17,20})$/

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/esm/index.d.mts:783


ModalLimits

Const ModalLimits: Object

Namespace containing limits related to Discord Modals.

Type declaration

NameTypeDescription
MaximumComponents5Maximum components allowed in a modal.
MaximumCustomIdCharacters100Maximum characters allowed in a modal custom ID.
MaximumTitleCharacters45Maximum characters allowed in a modal title.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:511


ModerationLimits

Const ModerationLimits: Object

Namespace containing limits related to built-in moderation features.

Type declaration

NameTypeDescription
MaximumTimeoutDuration2419200Maximum duration of a guild timeout, in seconds (corresponds to 28 days).

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:467


ParsedCustomEmoji

Const 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,20}/

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:790


ParsedCustomEmojiWithGroups

Const 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,20})/

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/esm/index.d.mts:800


ReactionLimits

Const ReactionLimits: Object

Namespace containing limits related to Discord message reactions.

Type declaration

NameTypeDescription
MaximumReactionsToFetchnumberMaximum number of reactions to fetch from the message reactions API.
MinimumReactionToFetchnumberMinimum number of reactions to fetch from the message reactions API.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:454


RoleLimits

Const 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/esm/index.d.mts:476


RoleMentionRegex

Const RoleMentionRegex: RegExp

Regex that can capture the ID in Discord Role mentions

Raw

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

Remark

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

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:806


SelectMenuLimits

Const SelectMenuLimits: Object

Namespace containing limits related to Select Menus.

Type declaration

NameTypeDescription
MaximumCustomIdCharacters100Maximum characters allowed in a select menu custom ID.
MaximumLengthOfDescriptionOfOption100Maximum characters allowed in a select menu option's description.
MaximumLengthOfNameOfOption100Maximum characters allowed in a select menu option's name.
MaximumLengthOfValueOfOption100Maximum characters allowed in a select menu option's value.
MaximumMaxValuesSize25Maximum "maximum" values allowed in a select menu.
MaximumMinValuesSize25Maximum "minimum" values allowed in a select menu.
MaximumOptionsLength25Maximum amount of options allowed in a select menu.
MaximumPlaceholderCharacters150Maximum characters allowed in a select menu placeholder.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:351


SnowflakeRegex

Const SnowflakeRegex: RegExp

Regex that can capture any Discord Snowflake ID

Raw

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

Remark

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

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:812


StageChannelLimits

Const StageChannelLimits: Object

Namespace containing limits related to Discord stage channels.

Type declaration

NameTypeDescription
MaximumUserLimitnumberMaximum user limit of stage channel.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:120


StickerLimits

Const StickerLimits: Object

Namespace containing limits related to Discord Stickers.

Type declaration

NameTypeDescription
MaximumStickerSizenumberMaximum size allowed for a sticker. Size is in bytes, and corresponds to 512KB.
MaximumTagsLengthnumberMaximum number of characters allowed in the autocomplete/suggestion tags for the sticker.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:706


TextChannelLimits

Const TextChannelLimits: Object

Namespace containing limits related to Discord text channels.

Type declaration

NameTypeDescription
MaximumMessagePins50Maximum pins allowed in a text channel.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:129


TextInputLimits

Const TextInputLimits: Object

Namespace containing limits related to Discord Modal Text Input component.

Type declaration

NameTypeDescription
MaximumCustomIdCharacters100Maximum characters allowed in a text input custom ID.
MaximumLabelCharacters45Maximum characters allowed in a text input label.
MaximumPlaceholderCharacters100Maximum characters allowed in a text input placeholder.
MaximumValueCharacters4000Maximum characters allowed in a text input value.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:528


ThreadLimits

Const ThreadLimits: Object

Namespace containing limits related to Discord threads.

Type declaration

NameTypeDescription
MaximumThreadsToFetch100Maximum number of threads to return from the threads API.
MinimumThreadsToFetch1Minimum number of threads to return from the threads API.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:138


TokenRegex

Const TokenRegex: RegExp

Regex that can capture a Discord Token

Raw

/(?<mfaToken>mfa\.[a-z0-9_-]{20,})|(?<basicToken>[a-z0-9_-]{23,28}\.[a-z0-9_-]{6,7}\.[a-z0-9_-]{27})/i

Remark

Capture group 1 can be used to retrieve a token for a User that has Multi-Factor Authentication enabled. It is named mfaToken.

Remark

Capture group 2 can be used to retrieve a token for a User that doesn't have Multi-Factor Authentication enabled, or a Bot application. It is named basicToken.

Remark

For a valid token, either Capture group 1 or Capture group 2 will always be undefined, whereas the other group will then be defined and contain the matched token. You can use the name of the capture group to determine if the validated token was configured for a user with Multi-Factor Authentication, for a user without Multi-Factor Authentication, or for a bot application. If both capture groups are undefined, then the token is invalid.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:823


TriggerMetadataLimits

Const TriggerMetadataLimits: Object

Namespace containing limits related to Discord Auto Moderation Trigger Metadata.

Type declaration

NameTypeDescription
MaximumCharactersPerRegexPattern260Maximum number of characters allowed in a regular expression pattern.
MaximumKeywordAllowListKeywordLength60Maximum characters per keyword that should not trigger the keyword rule.
MaximumKeywordAllowListLength100Maximum number of substrings which should not trigger the keyword rule.
MaximumKeywordFilterLength60Maximum number of characters allowed in a keyword filter.
MaximumKeywordFilters1000Maximum number of substrings which will be searched for in content.
MaximumKeywordPresetAllowListKeywordPresetLength60Maximum characters per keyword should not trigger the keyword preset rule.
MaximumKeywordPresetAllowListLength1000Maximum number of substrings which should not trigger the keyword preset rule.
MaximumMentionSpamTotalMentions50Maximum number of unique role and user mentions allowed per message.
MaximumRegexPatterns10Maximum number of regular expression patterns which will be matched against content.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:617


TriggerTypeLimits

Const TriggerTypeLimits: Object

Namespace containing limits related to Discord Auto Moderation Triggers.

Type declaration

NameTypeDescription
MaximumKeywordPresetTriggersPerChannel1Maximum number of keyword triggers a channel can have.
MaximumKeywordTriggersPerGuild6Maximum number of keyword triggers a guild can have.
MaximumMentionSpamTriggersPerChannel1Maximum number of mention spam triggers a channel can have.
MaximumSpamTriggersPerGuild1Maximum number of mention spam triggers a guild can have.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:596


TwemojiRegex

Const TwemojiRegex: RegExp

Regex that can capture a Twemoji (Twitter Emoji)

Raw

See official source code

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:850


UserLimits

Const UserLimits: Object

Namespace containing limits related to Discord users and Direct Messages.

Type declaration

NameTypeDescription
MaximumBiographyLength190Maximum characters allowed in a user's biography (the "About Me" section).
MaximumUsersPerDMGroup10Maximum numbers of users in a DM group.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:485


UserOrMemberMentionRegex

Const UserOrMemberMentionRegex: RegExp

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

Raw

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

Remark

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

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:829


VoiceChannelLimits

Const VoiceChannelLimits: Object

Namespace containing limits related to Discord voice channels.

Type declaration

NameTypeDescription
MaximumUserLimitnumberMaximum user limit of voice channel.
MaximumViewersPerScreenSharenumberMaximum viewers allowed per screen share.

Defined in

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:107


WebSocketUrlRegex

Const 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/esm/index.d.mts:835


WebhookRegex

Const WebhookRegex: RegExp

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

Raw

/(?<url>^https://(?:(?:canary|ptb).)?discord(?:app)?.com/api(?:/v\d+)?/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/esm/index.d.mts:844

Functions

actionIsButtonOrMenu

actionIsButtonOrMenu(action): action is PaginatedMessageActionButton | PaginatedMessageActionStringMenu | PaginatedMessageActionUserMenu | PaginatedMessageActionRoleMenu | PaginatedMessageActionMentionableMenu | PaginatedMessageActionChannelMenu

Checks if a PaginatedMessageAction is a button or menu.

Parameters

NameTypeDescription
actionPaginatedMessageActionThe PaginatedMessageAction to check.

Returns

action is PaginatedMessageActionButton | PaginatedMessageActionStringMenu | PaginatedMessageActionUserMenu | PaginatedMessageActionRoleMenu | PaginatedMessageActionMentionableMenu | PaginatedMessageActionChannelMenu

true if the action is a button or menu, false otherwise.

Defined in

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


actionIsLinkButton

actionIsLinkButton(action): action is LinkButtonComponentData

Checks if a PaginatedMessageAction is a button with ButtonStyle.Link style link.

Parameters

NameTypeDescription
actionPaginatedMessageActionThe PaginatedMessageAction to check.

Returns

action is LinkButtonComponentData

true if the action is a button with ButtonStyle.Link style link, false otherwise.

Defined in

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


canJoinVoiceChannel

canJoinVoiceChannel(channel): boolean

Determines whether the client can join the given voice based channel.

Parameters

NameTypeDescription
channelVoiceBasedChannel | NullishThe channel to test the permissions from.

Returns

boolean

Whether or not the client can join the specified channel.

Defined in

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


canReact

canReact(channel): boolean

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

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe 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:76


canReadMessages

canReadMessages(channel): boolean

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

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe channel to test the permissions from.

Returns

boolean

Whether or not we can read 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
channelNullish | ChannelTypesThe 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:95


canSendAttachments

canSendAttachments(channel): boolean

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

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe 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
channelNullish | ChannelTypesThe 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
channelNullish | ChannelTypesThe 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): PaginatedMessageComponentUnion[]

Creates partitioned message rows based on the provided components.

Parameters

NameTypeDescription
componentsMessageActionRowComponentBuilder[]The array of MessageActionRowComponentBuilder objects.

Returns

PaginatedMessageComponentUnion[]

An array of APIActionRowComponent<APIMessageActionRowComponent> objects.

Defined in

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


isActionButton

isActionButton(action): action is PaginatedMessageActionButton

Checks if the given action is a paginated message action button.

Parameters

NameTypeDescription
actionPaginatedMessageActionThe action to check.

Returns

action is PaginatedMessageActionButton

True if the action is a paginated message action button, false otherwise.

Defined in

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


isActionChannelMenu

isActionChannelMenu(action): action is PaginatedMessageActionChannelMenu

Checks if the given action is a paginated message action channel menu.

Parameters

NameTypeDescription
actionPaginatedMessageActionThe action to check.

Returns

action is PaginatedMessageActionChannelMenu

True if the action is a paginated message action channel menu, false otherwise.

Defined in

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


isActionLink(action): action is LinkButtonComponentData

Checks if the given action is a paginated message action link.

Parameters

NameTypeDescription
actionPaginatedMessageActionThe action to check.

Returns

action is LinkButtonComponentData

True if the action is a paginated message action link, false otherwise.

Defined in

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


isActionMentionableMenu

isActionMentionableMenu(action): action is PaginatedMessageActionMentionableMenu

Checks if the given action is a paginated message action mentionable menu.

Parameters

NameTypeDescription
actionPaginatedMessageActionThe action to check.

Returns

action is PaginatedMessageActionMentionableMenu

True if the action is a paginated message action mentionable menu, false otherwise.

Defined in

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


isActionRoleMenu

isActionRoleMenu(action): action is PaginatedMessageActionRoleMenu

Checks if the given action is a paginated message action role menu.

Parameters

NameTypeDescription
actionPaginatedMessageActionThe action to check.

Returns

action is PaginatedMessageActionRoleMenu

True if the action is a paginated message action role menu, false otherwise.

Defined in

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


isActionStringMenu

isActionStringMenu(action): action is PaginatedMessageActionStringMenu

Checks if the given action is a paginated message action string menu.

Parameters

NameTypeDescription
actionPaginatedMessageActionThe action to check.

Returns

action is PaginatedMessageActionStringMenu

True if the action is a paginated message action string menu, false otherwise.

Defined in

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


isActionUserMenu

isActionUserMenu(action): action is PaginatedMessageActionUserMenu

Checks if the given action is a paginated message action user menu.

Parameters

NameTypeDescription
actionPaginatedMessageActionThe action to check.

Returns

action is PaginatedMessageActionUserMenu

True if the action is a paginated message action user menu, false otherwise.

Defined in

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


isAnyInteractableInteraction

isAnyInteractableInteraction(messageOrInteraction): messageOrInteraction is AnyInteractableInteraction

Checks whether the input messageOrInteraction is one of Message or any class that extends BaseInteraction As opposed to isAnyInteraction this also checks that the interaction can actually be interacted with by the user which means that this cannot be an AutocompleteInteraction. That said, this type guard filters the messageOrInteraction down to one of:

  • Interaction
  • ButtonInteraction
  • ChannelSelectMenuInteraction
  • ChatInputCommandInteraction
  • CommandInteraction
  • ContextMenuInteraction
  • MentionableSelectMenuInteraction
  • MessageComponentInteraction
  • MessageContextMenuCommandInteraction
  • ModalSubmitInteraction
  • RoleSelectMenuInteraction
  • SelectMenuInteraction
  • StringSelectMenuInteraction
  • UserContextMenuCommandInteraction
  • UserSelectMenuInteraction

Parameters

NameTypeDescription
messageOrInteractionAPIMessage | BaseInteraction<CacheType> | Message<boolean>The message or interaction that should be checked.

Returns

messageOrInteraction is AnyInteractableInteraction

true if the messageOrInteraction is an instanceof BaseInteraction and does NOT pass Interaction.isAutocomplete(), false otherwise.

Defined in

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


isAnyInteraction

isAnyInteraction(messageOrInteraction): messageOrInteraction is BaseInteraction<CacheType>

Checks whether the input messageOrInteraction is one of Message or any class that extends BaseInteraction. This generally boils down to being one of:

  • Interaction
  • AutocompleteInteraction
  • ButtonInteraction
  • ChannelSelectMenuInteraction
  • ChatInputCommandInteraction
  • CommandInteraction
  • ContextMenuInteraction
  • MentionableSelectMenuInteraction
  • MessageComponentInteraction
  • MessageContextMenuCommandInteraction
  • ModalSubmitInteraction
  • RoleSelectMenuInteraction
  • SelectMenuInteraction
  • StringSelectMenuInteraction
  • UserContextMenuCommandInteraction
  • UserSelectMenuInteraction

Parameters

NameTypeDescription
messageOrInteractionAPIMessage | BaseInteraction<CacheType> | Message<boolean>The message or interaction that should be checked.

Returns

messageOrInteraction is BaseInteraction<CacheType>

true if the messageOrInteraction is an instanceof BaseInteraction, false if it is not.

Defined in

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


isButtonComponentBuilder

isButtonComponentBuilder(component): component is ButtonBuilder

Checks if the given component is a button builder.

Parameters

NameTypeDescription
componentMessageActionRowComponentBuilderThe component to check.

Returns

component is ButtonBuilder

True if the component is a button builder, false otherwise.

Defined in

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


isCategoryChannel

isCategoryChannel(channel): channel is CategoryChannel

Checks whether a given channel is a CategoryChannel This checks for ChannelType.GuildCategory.

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe channel to check

Returns

channel is CategoryChannel

Defined in

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


isDMChannel

isDMChannel(channel): channel is DMChannel | PartialDMChannel

Checks whether a given channel is a DMChannel This checks for ChannelType.DM.

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe channel to check

Returns

channel is DMChannel | PartialDMChannel

Defined in

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


isGroupChannel

isGroupChannel(channel): channel is PartialGroupDMChannel

Checks whether a given channel is a PartialGroupDMChannel This checks for ChannelType.GroupDM.

Parameters

NameTypeDescription
channelChannel | NullishThe channel to check

Returns

channel is PartialGroupDMChannel

Defined in

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


isGuildBasedChannel

isGuildBasedChannel(channel): channel is GuildTextBasedChannelTypes

Checks if a channel comes from a guild. This checks that the channel is not ChannelType.DM.

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe 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:67


isGuildBasedChannelByGuildKey

isGuildBasedChannelByGuildKey(channel): channel is GuildTextBasedChannelTypes

Checks whether or not a channel comes from a guild.

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe channel to check.

Returns

channel is GuildTextBasedChannelTypes

Whether or not the channel is guild-based.

Remark

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

Defined in

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


isGuildMember

isGuildMember(member): member is GuildMember

Checks whether a given member is an instance of GuildMember, and not APIInteractionGuildMember, APIGuildMember, or Nullish

Parameters

NameTypeDescription
memberAPIGuildMember | APIInteractionGuildMember | APIInteractionDataResolvedGuildMember | GuildMember | NullishThe member to check

Returns

member is GuildMember

true if the member is an instance of GuildMember, false otherwise.

Defined in

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


isMessageButtonInteractionData

isMessageButtonInteractionData(interaction): interaction is ButtonComponentData

Checks if the given interaction is a button interaction.

Parameters

NameTypeDescription
interactionActionRowComponentOptionsThe interaction to check.

Returns

interaction is ButtonComponentData

True if the interaction is a button interaction, false otherwise.

Defined in

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


isMessageChannelSelectInteractionData

isMessageChannelSelectInteractionData(interaction): interaction is ChannelSelectMenuComponentData

Checks if the given interaction is a channel select interaction.

Parameters

NameTypeDescription
interactionActionRowComponentOptionsThe interaction to check.

Returns

interaction is ChannelSelectMenuComponentData

True if the interaction is a channel select interaction, false otherwise.

Defined in

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


isMessageInstance

isMessageInstance(message): message is Message<boolean>

Checks whether a given message is an instance of Message, and not APIMessage

Parameters

NameTypeDescription
messageAPIMessage | Message<boolean>The message to check

Returns

message is Message<boolean>

true if the message is an instance of Message, false otherwise.

Defined in

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


isMessageMentionableSelectInteractionData

isMessageMentionableSelectInteractionData(interaction): interaction is MentionableSelectMenuComponentData

Checks if the given interaction is a mentionable select interaction.

Parameters

NameTypeDescription
interactionActionRowComponentOptionsThe interaction to check.

Returns

interaction is MentionableSelectMenuComponentData

True if the interaction is a mentionable select interaction, false otherwise.

Defined in

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


isMessageRoleSelectInteractionData

isMessageRoleSelectInteractionData(interaction): interaction is RoleSelectMenuComponentData

Checks if the given interaction is a role select interaction.

Parameters

NameTypeDescription
interactionActionRowComponentOptionsThe interaction to check.

Returns

interaction is RoleSelectMenuComponentData

True if the interaction is a role select interaction, false otherwise.

Defined in

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


isMessageStringSelectInteractionData

isMessageStringSelectInteractionData(interaction): interaction is StringSelectMenuComponentData

Checks if the given interaction is a string select interaction.

Parameters

NameTypeDescription
interactionActionRowComponentOptionsThe interaction to check.

Returns

interaction is StringSelectMenuComponentData

True if the interaction is a string select interaction, false otherwise.

Defined in

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


isMessageUserSelectInteractionData

isMessageUserSelectInteractionData(interaction): interaction is UserSelectMenuComponentData

Checks if the given interaction is a user select interaction.

Parameters

NameTypeDescription
interactionActionRowComponentOptionsThe interaction to check.

Returns

interaction is UserSelectMenuComponentData

True if the interaction is a user select interaction, false otherwise.

Defined in

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


isNewsChannel

isNewsChannel(channel): channel is NewsChannel

Checks whether a given channel is a NewsChannel. This checks for ChannelType.GuildAnnouncement.

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe channel to check.

Returns

channel is NewsChannel

Defined in

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


isNewsThreadChannel

isNewsThreadChannel(channel): channel is PublicThreadChannel<boolean>

Checks whether a given channel is an Announcement PublicThreadChannel This checks for ChannelType.AnnouncementThread.

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe channel to check.

Returns

channel is PublicThreadChannel<boolean>

Defined in

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


isNsfwChannel

isNsfwChannel(channel): 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

NameTypeDescription
channelNullish | ChannelTypesThe channel to check.

Returns

boolean

Defined in

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


isPrivateThreadChannel

isPrivateThreadChannel(channel): channel is PrivateThreadChannel

Checks whether a given channel is a PrivateThreadChannel This checks for ChannelType.PrivateThread.

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe channel to check.

Returns

channel is PrivateThreadChannel

Defined in

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


isPublicThreadChannel

isPublicThreadChannel(channel): channel is PublicThreadChannel<boolean>

Checks whether a given channel is a PublicThreadChannel This checks for ChannelType.PublicThread.

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe channel to check.

Returns

channel is PublicThreadChannel<boolean>

Defined in

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


isStageChannel

isStageChannel(channel): channel is StageChannel

Checks whether a given channel is a StageChannel This checks for ChannelType.GuildStageVoice.

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe channel to check

Returns

channel is StageChannel

Defined in

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


isTextBasedChannel

isTextBasedChannel(channel): channel is DMChannel | PartialDMChannel | NewsChannel | StageChannel | TextChannel | PrivateThreadChannel | PublicThreadChannel<boolean> | VoiceChannel

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

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe channel to check.

Returns

channel is DMChannel | PartialDMChannel | NewsChannel | StageChannel | TextChannel | PrivateThreadChannel | PublicThreadChannel<boolean> | VoiceChannel

Defined in

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


isTextChannel

isTextChannel(channel): channel is TextChannel

Checks whether a given channel is a TextChannel. This checks for ChannelType.GuildText.

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe channel to check.

Returns

channel is TextChannel

Defined in

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


isThreadChannel

isThreadChannel(channel): channel is ThreadChannel<boolean>

Checks whether a given channel is a ThreadChannel This checks for ChannelTypes.isThread().

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe channel to check.

Returns

channel is ThreadChannel<boolean>

Defined in

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


isVoiceBasedChannel

isVoiceBasedChannel(channel): channel is VoiceBasedChannel

Checks whether a given channel is a VoiceBasedChannel. This checks for Channel.isVoiceBased().

Parameters

NameType
channelChannel | Nullish

Returns

channel is VoiceBasedChannel

Defined in

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


isVoiceChannel

isVoiceChannel(channel): channel is VoiceChannel

Checks whether a given channel is a VoiceChannel This checks for ChannelType.GuildVoice.

Parameters

NameTypeDescription
channelNullish | ChannelTypesThe channel to check

Returns

channel is VoiceChannel

Defined in

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


safelyReplyToInteraction

safelyReplyToInteraction<T>(parameters): Promise<void>

Safely replies to a message or interaction. This is primarily to save duplicated code in the main PaginatedMessage class

Type parameters

NameType
Textends "edit" | "reply"

Parameters

NameTypeDescription
parametersSafeReplyToInteractionParameters<T>The parameters to create a safe reply to interaction parameters

Returns

Promise<void>

Defined in

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