Skip to main content

@sapphire/discord.js-utilities

Classes

ClassDescription
InteractionOptionResolverUtility class for resolving command interaction options while working with the raw API.
LazyPaginatedMessageThis is a LazyPaginatedMessage. Instead of resolving all pages that are functions on PaginatedMessage.run will resolve when requested.
MessageBuilderA message builder class, it implements the MessageCreateOptions interface.
MessagePrompterThis is a MessagePrompter, a utility that sends a message, prompting for user input. The prompt can resolve to any kind of input.
MessagePrompterBaseStrategy-
MessagePrompterConfirmStrategy-
MessagePrompterMessageStrategy-
MessagePrompterNumberStrategy-
MessagePrompterReactionStrategy-
PaginatedFieldMessageEmbedThis is a utility of PaginatedMessage, except it exclusively adds pagination inside a field of an embed.
PaginatedMessageThis is a PaginatedMessage, a utility to paginate messages (usually embeds).
PaginatedMessageEmbedFieldsThis is a utility of PaginatedMessage, except it exclusively paginates the fields of an embed.

Interfaces

InterfaceDescription
IMessagePrompterConfirmStrategyOptions-
IMessagePrompterExplicitConfirmReturn-
IMessagePrompterExplicitMessageReturn-
IMessagePrompterExplicitNumberReturn-
IMessagePrompterExplicitReturnBase-
IMessagePrompterNumberStrategyOptions-
IMessagePrompterReactionStrategyOptions-
IMessagePrompterStrategyOptions-
PaginatedMessageActionContextThe context to be used in PaginatedMessageActionButton.
PaginatedMessageActionRunRepresents an action that can be run in a paginated message.
PaginatedMessageInternationalizationContextThis is a duplicate of the same interface in @sapphire/plugin-i18next
PaginatedMessageOptionsOptions for configuring a paginated message.
SafeReplyToInteractionParametersRepresents the parameters for safely replying to an interaction.
StrategyFilters-
StrategyOptions-
StrategyReturns-

Type Aliases

Type aliasDescription
AnyInteractableInteractionA union of ChatInputCommandInteraction, UserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, StringSelectMenuInteraction, ButtonInteraction, and ModalSubmitInteraction
AnyInteractionA union of ChatInputCommandInteractionUserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, AutocompleteInteraction, StringSelectMenuInteraction, ButtonInteraction, and ModalSubmitInteraction
ChannelTypeStringThe types of a channel, with the addition of 'UNKNOWN'
ChannelTypesA union of all the various types of channels that Discord.js has
ChatInputOrContextMenuCommandInteractionA union of ChatInputCommandInteraction, UserContextMenuCommandInteraction and MessageContextMenuCommandInteraction. Similar to CommandInteraction class but as a type union.
EmbedResolvableRepresents a resolvable object that can be used to create an embed in Discord.
GuildBasedChannelTypesA union of all the channel types that belong to a guild, including ThreadChannel
GuildTextBasedChannelTypesA union of guild based message channels, including ThreadChannel
MessageBuilderFileResolvable-
MessageBuilderResolvable-
MessagePrompterChannelTypes-
MessagePrompterMessageA type to extend multiple discord types and simplify usage in MessagePrompter
NonModalInteractionA union of ChatInputCommandInteractionUserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, AutocompleteInteraction, StringSelectMenuInteraction and ButtonInteraction
NonThreadGuildBasedChannelTypesA union of all the channel types that belong to a guild, not including ThreadChannel
NonThreadGuildTextBasedChannelTypesA union of guild based message channels, not including ThreadChannel
PaginatedMessageActionRepresents an action that can be performed in a paginated message.
PaginatedMessageActionButtonTo utilize buttons you can pass an object with the structure of PaginatedMessageActionButton to PaginatedMessage actions.
PaginatedMessageActionChannelMenuTo utilize Channel Select Menus you can pass an object with the structure of PaginatedMessageActionChannelMenu to PaginatedMessage actions.
PaginatedMessageActionLinkTo utilize links you can pass an object with the structure of PaginatedMessageActionLink to PaginatedMessage actions.
PaginatedMessageActionMentionableMenuTo utilize Mentionable Select Menus you can pass an object with the structure of PaginatedMessageActionMentionableMenu to PaginatedMessage actions.
PaginatedMessageActionRoleMenuTo utilize Role Select Menus you can pass an object with the structure of PaginatedMessageActionRoleMenu to PaginatedMessage actions.
PaginatedMessageActionStringMenuTo utilize String Select Menus you can pass an object with the structure of PaginatedMessageActionStringMenu to PaginatedMessage actions.
PaginatedMessageActionUserMenuTo utilize User Select Menus you can pass an object with the structure of PaginatedMessageActionUserMenu to PaginatedMessage actions.
PaginatedMessageComponentUnionRepresents a union type for components in a paginated message.
PaginatedMessageEmbedResolvableRepresents the resolvable type for the embeds property of a paginated message.
PaginatedMessageInteractionUnionRepresents the union type of interactions for a paginated message, excluding the ModalSubmitInteraction.
PaginatedMessageMessageOptionsUnionRepresents the union of options for a paginated message.
PaginatedMessagePageThe pages that are used for PaginatedMessage.pages
PaginatedMessageResolvedPageRepresents a resolved page for a paginated message.
PaginatedMessageSelectMenuOptionsFunction-
PaginatedMessageStopReasonsRepresents the possible reasons for stopping a paginated message.
PaginatedMessageWriteableEmbedResolvableA non nullable writeable variant of PaginatedMessageEmbedResolvable.
PaginatedMessageWrongUserInteractionReplyFunction-
TextBasedChannelTypesA union of all the channel types that a message can come from
VoiceBasedChannelTypesA union of all the voice-based channel types that Discord.js has

Variables

VariableDescription
ActionMetadataLimitsNamespace containing limits related to Discord Auto Moderation Action Metadata.
AllowedMentionsLimitsNamespace containing limits related to Discord Message Allowed Mentions.
ApplicationCommandLimitsNamespace containing limits related to Discord application commands (slash commands).
ApplicationCommandOptionLimitsNamespace containing limits related to Choices of Discord Application Commands.
ApplicationCommandPermissionLimitsNamespace containing limits related to Permissions of Discord Application Commands.
ApplicationRoleConnectionLimitsNamespace containing limits related to Discord Application Role Connections.
AutoCompleteLimitsNamespace container limits related to Discord autocomplete interactions.
AutoModerationRuleLimitsNamespace containing limits related to Discord Auto Moderation Rules.
ButtonLimitsNamespace containing limits related to Message Buttons.
ChannelInviteLimitsNamespace containing limits related to Discord Channel Invites.
ChannelLimitsNamespace containing limits related to Discord channels.
ChannelMentionRegexRegex that can capture the ID in Discord Channel mentions
ChannelMessageRegexRegex that can capture the channel and message IDs in a channelId-messageId pattern
DiscordHostnameRegexRegex that matches links on the known Discord host names
DiscordInviteLinkRegexRegex that can can capture the code of Discord invite links
EmbedLimitsNamespace containing limits related to Discord embeds.
EmojiLimitsNamespace containing limits related to Discord emojis.
EmojiRegexRegex that can capture the ID of any animated or non-animated custom Discord emoji
FormattedCustomEmojiRegex that matches any animated or non-animated custom Discord emoji.
FormattedCustomEmojiWithGroupsRegex that can capture any animated or non-animated custom Discord emoji.
GuildAuditLogsLimitsNamespace containing limits related to Discord Guild Audit Logs.
GuildBansLimitsNamespace containing limits related to Discord guild bans.
GuildIntegrationLimitsNamespace containing limits related to Discord Guild Integrations.
GuildLimitsNamespace containing limits related to Discord guilds.
GuildMemberLimitsNamespace containing limits related to Discord guild members.
GuildScheduledEventLimitsNamespace containing limits related to Discord guild scheduled events.
HttpUrlRegexRegex that matches any URL starting with http or https
InteractionLimitsNamespace containing limits related to Discord interactions.
MessageLimitsNamespace containing limits related to Discord messages.
MessageLinkRegexRegex that can capture the Guild, Channel, and Message ID based on a shareable Discord message link.
ModalLimitsNamespace containing limits related to Discord Modals.
ModerationLimitsNamespace containing limits related to built-in moderation features.
ParsedCustomEmojiRegex that matches any animated or non-animated custom Discord emoji *without the wrapping <...> symbols.
ParsedCustomEmojiWithGroupsRegex that matches any animated or non-animated custom Discord emoji *without the wrapping <...> symbols.
PremiumGuildLimitsNamespace containing limits related to premium Discord guilds.
ReactionLimitsNamespace containing limits related to Discord message reactions.
RoleLimitsNamespace containing limits related to Discord roles.
RoleMentionRegexRegex that can capture the ID in Discord Role mentions
SelectMenuLimitsNamespace containing limits related to Select Menus.
SnowflakeRegexRegex that can capture any Discord Snowflake ID
StageChannelLimitsNamespace containing limits related to Discord stage channels.
StickerLimitsNamespace containing limits related to Discord Stickers.
TextChannelLimitsNamespace containing limits related to Discord text channels.
TextInputLimitsNamespace containing limits related to Discord Modal Text Input component.
ThreadLimitsNamespace containing limits related to Discord threads.
TokenRegexRegex that can capture a Discord Token
TriggerMetadataLimitsNamespace containing limits related to Discord Auto Moderation Trigger Metadata.
TriggerTypeLimitsNamespace containing limits related to Discord Auto Moderation Triggers.
TwemojiRegexRegex that can capture a Twemoji (Twitter Emoji)
UserLimitsNamespace containing limits related to Discord users and Direct Messages.
UserOrMemberMentionRegexRegex that can capture the ID of a user in Discord user mentions
VoiceChannelLimitsNamespace containing limits related to Discord voice channels.
WebSocketUrlRegexRegex that matches any WebSocket URL starting with ws or wss
WebhookRegexRegex that captures the Webhook ID and token from a Discord Webhook URL.

Functions

FunctionDescription
actionIsButtonOrMenuChecks if a PaginatedMessageAction is a button or menu.
actionIsLinkButtonChecks if a PaginatedMessageAction is a button with ButtonStyle.Link style link.
canJoinVoiceChannelDetermines whether the client can join the given voice based channel.
canReactDetermines whether or not we can send react to messages in a given channel.
canReadMessagesDetermines whether or not we can read messages in a given channel.
canRemoveAllReactionsDetermines whether or not we can remove reactions from messages in a given channel.
canSendAttachmentsDetermines whether or not we can send attachments in a given channel.
canSendEmbedsDetermines whether or not we can send embeds in a given channel.
canSendMessagesDetermines whether or not we can send messages in a given channel.
createPartitionedMessageRowCreates partitioned message rows based on the provided components.
isActionButtonChecks if the given action is a paginated message action button.
isActionChannelMenuChecks if the given action is a paginated message action channel menu.
isActionLinkChecks if the given action is a paginated message action link.
isActionMentionableMenuChecks if the given action is a paginated message action mentionable menu.
isActionRoleMenuChecks if the given action is a paginated message action role menu.
isActionStringMenuChecks if the given action is a paginated message action string menu.
isActionUserMenuChecks if the given action is a paginated message action user menu.
isAnyInteractableInteractionChecks whether the input messageOrInteraction is one of Message or any class that extends BaseInteraction
isAnyInteractionChecks whether the input messageOrInteraction is one of Message or any class that
isButtonComponentBuilderChecks if the given component is a button builder.
isCategoryChannelChecks whether a given channel is a CategoryChannel
isDMChannelChecks whether a given channel is a DMChannel
isGroupChannelChecks whether a given channel is a PartialGroupDMChannel
isGuildBasedChannelChecks if a channel comes from a guild.
isGuildBasedChannelByGuildKeyChecks whether or not a channel comes from a guild.
isGuildMemberChecks whether a given member is an instance of GuildMember, and not APIInteractionGuildMember, APIGuildMember, or Nullish
isMessageButtonInteractionDataChecks if the given interaction is a button interaction.
isMessageChannelSelectInteractionDataChecks if the given interaction is a channel select interaction.
isMessageInstanceChecks whether a given message is an instance of Message, and not APIMessage
isMessageMentionableSelectInteractionDataChecks if the given interaction is a mentionable select interaction.
isMessageRoleSelectInteractionDataChecks if the given interaction is a role select interaction.
isMessageStringSelectInteractionDataChecks if the given interaction is a string select interaction.
isMessageUserSelectInteractionDataChecks if the given interaction is a user select interaction.
isNewsChannelChecks whether a given channel is a NewsChannel.
isNewsThreadChannelChecks whether a given channel is an Announcement PublicThreadChannel
isNsfwChannelChecks whether a given channel allows NSFW content or not
isPrivateThreadChannelChecks whether a given channel is a PrivateThreadChannel
isPublicThreadChannelChecks whether a given channel is a PublicThreadChannel
isStageChannelChecks whether a given channel is a StageChannel
isTextBasedChannelChecks whether a given channel is a TextBasedChannelTypes. This means it has a send method.
isTextChannelChecks whether a given channel is a TextChannel.
isThreadChannelChecks whether a given channel is a ThreadChannel
isVoiceBasedChannelChecks whether a given channel is a VoiceBasedChannel.
isVoiceChannelChecks whether a given channel is a VoiceChannel
safelyReplyToInteractionSafely replies to a message or interaction. This is primarily to save duplicated code in the main PaginatedMessage class