Module: discord.js-utilities/src
Classes
- LazyPaginatedMessage
- MessageBuilder
- MessagePrompter
- MessagePrompterBaseStrategy
- MessagePrompterConfirmStrategy
- MessagePrompterMessageStrategy
- MessagePrompterNumberStrategy
- MessagePrompterReactionStrategy
- PaginatedFieldMessageEmbed
- PaginatedMessage
- PaginatedMessageEmbedFields
Interfaces
- IMessagePrompterConfirmStrategyOptions
- IMessagePrompterExplicitConfirmReturn
- IMessagePrompterExplicitMessageReturn
- IMessagePrompterExplicitNumberReturn
- IMessagePrompterExplicitReturnBase
- IMessagePrompterNumberStrategyOptions
- IMessagePrompterReactionStrategyOptions
- IMessagePrompterStrategyOptions
- PaginatedMessageActionButton
- PaginatedMessageActionContext
- PaginatedMessageActionLink
- PaginatedMessageActionMenu
- PaginatedMessageInternationalizationContext
- PaginatedMessageOptions
- SafeReplyToInteractionParameters
- StrategyFilters
- StrategyOptions
- StrategyReturns
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: Omit
<ArgumentTypes
<PartialTextBasedChannelFields
["send"
]>[0
], "flags"
>
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
PaginatedMessageAction
Ƭ PaginatedMessageAction: PaginatedMessageActionButton
| PaginatedMessageActionLink
| PaginatedMessageActionMenu
Defined in
PaginatedMessageEmbedResolvable
Ƭ PaginatedMessageEmbedResolvable: MessageOptions
["embeds"
]
Defined in
PaginatedMessageMessageOptionsUnion
Ƭ PaginatedMessageMessageOptionsUnion: Omit
<MessageOptions
, "flags"
> | WebhookEditMessageOptions
Defined in
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
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
Name | Type |
---|---|
pageIndex | number |
internationalizationContext | PaginatedMessageInternationalizationContext |
Returns
Awaitable
<Omit
<MessageSelectOptionData
, "value"
>>
Defined in
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
Name | Type |
---|---|
targetUser | User |
interactionUser | User |
internationalizationContext | PaginatedMessageInternationalizationContext |
Returns
Awaitable
<Parameters
<MessageComponentInteraction
["reply"
]>[0
]>
Defined in
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
ApplicationCommandLimits
• Const
ApplicationCommandLimits: Object
Namespace containing limits related to Discord application commands (slash commands).
Type declaration
Name | Type | Description |
---|---|---|
MaximumDescriptionCharacters | 100 | Maximum characters allowed in an application command description. |
MaximumNameCharacters | 32 | Maximum characters allowed in an application command name. |
MaximumOptionsLength | 25 | Maximum options allowed in an application command. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:110
ApplicationCommandOptionLimits
• Const
ApplicationCommandOptionLimits: Object
Namespace containing limits related to Choices of Discord Application Commands.
Type declaration
Name | Type | Description |
---|---|---|
MaximumChoicesLength | 25 | Maximum length of choices allowed in the option of an application command. |
MaximumDescriptionCharacters | 100 | Maximum characters allowed in the description of an option of an application command. |
MaximumNameCharacters | 32 | Maximum characters allowed in the name of an option of an application command. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:127
AutoCompleteLimits
• Const
AutoCompleteLimits: Object
Namespace container limits related to Discord autocomplete interactions.
Type declaration
Name | Type | Description |
---|---|---|
MaximumAmountOfOptions | 20 | Maximum options allowed in a single autocomplete response. |
MaximumLengthOfNameOfOption | 100 | Maximum characters allowed in a select menu option's name. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:257
ButtonLimits
• Const
ButtonLimits: Object
Namespace containing limits related to Message Buttons.
Type declaration
Name | Type | Description |
---|---|---|
MaximumCustomIdCharacters | 100 | Maximum characters allowed in a button custom ID. |
MaximumLabelCharacters | 80 | Maximum characters allowed in a button lable. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:144
ChannelLimits
• Const
ChannelLimits: Object
Namespace containing limits related to Discord channels.
Type declaration
Name | Type | Description |
---|---|---|
MaximumDescriptionLength | 1024 | Maximum characters allowed in a channel description. |
MaximumNameLength | 100 | Maximum characters allowed in a channel name. |
MaximumViewersPerScreenShare | 50 | Maximum viewers allowed per screen share. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:4
ChannelMentionRegex
• Const
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
• 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,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
• 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/lib/regexes.d.ts:23
DiscordInviteLinkRegex
• Const
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
• Const
EmbedLimits: Object
Namespace containing limits related to Discord embeds.
Type declaration
Name | Type | Description |
---|---|---|
MaximumAuthorNameLength | 256 | Maximum characters allowed in the author field of an embed. |
MaximumDescriptionLength | 4096 | Maximum characters allowed in an embed description. |
MaximumFieldNameLength | 256 | Maximum characters allowed in the name of a field in an embed. |
MaximumFieldValueLength | 1024 | Maximum characters allowed in the avlue of a field in an embed. |
MaximumFields | 25 | Maximum fields allowed in an embed. |
MaximumFooterLength | 2048 | Maximum characters allowed in a footer of an embed. |
MaximumTitleLength | 256 | Maximum characters allowed in the title of an embed. |
MaximumTotalCharacters | 6000 | Maximum characters allowed in an embed, in total. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:21
EmojiLimits
• Const
EmojiLimits: Object
Namespace containing limits related to Discord emojis.
Type declaration
Name | Type | Description |
---|---|---|
MaximumEmojiNameLength | 32 | Maximum characters allowed in a custom guild emoji. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:58
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/lib/regexes.d.ts:37
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,18}>/
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:43
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,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
• Const
GuildLimits: Object
Namespace containing limits related to Discord guilds.
Type declaration
Name | Type | Description |
---|---|---|
MaximumChannels | 500 | Maximum channels allowed per guild, including category channels. |
MaximumRoles | 250 | Maximum roles allowed in a guild. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:67
GuildMemberLimits
• Const
GuildMemberLimits: Object
Namespace containing limits related to Discord guild members.
Type declaration
Name | Type | Description |
---|---|---|
MaximumDisplayNameLength | 32 | Maximum characters allowed in the display name of a guild member. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:80
HttpUrlRegex
• Const
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
• Const
InteractionLimits: Object
Namespace containing limits related to Discord interactions.
Type declaration
Name | Type | Description |
---|---|---|
MaximumButtonsPerActionRow | 5 | Maximum buttons allowed in a single action row. |
MaximumOptionsInSelectMenus | 25 | Maximum options allowed in a single select menu. |
MaximumSelectMenusPerActionRow | 1 | Maximum select menus allowed in a single action row. |
MaximumTextInputsPerActionRow | 1 | Maximum text inputs allowed in a single action row. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:89
MessageLimits
• Const
MessageLimits: Object
Namespace containing limits related to Discord messages.
Type declaration
Name | Type | Description |
---|---|---|
MaximumActionRows | 5 | Maximum action rows allowed in a single message. |
MaximumEmbeds | 10 | Maximum embeds allowed in a single message. |
MaximumLength | 2000 | Maximum characters allowed in a single message for a user. |
MaximumNitroLength | 4000 | Maximum characters allowed in a single message for a nitro user. |
MaximumNitroUploadSize | 100000000 | Maximum upload size for a nitro user, in any guild or in DMs. Size is in bytes, and correspond to 10MB. |
MaximumReactions | 20 | Maximum numbers of reactions allowed for a message. |
MaximumUploadSize | 8000000 | Maximum upload size for a free user in a guild of tier 1 or below, or in DMs. Size is in bytes, and correspond to 8MB. |
MaximumUploadSizeInGuild | readonly [8000000 , 8000000 , 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 8MB, 8MB, 50MB, and 100MB. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:186
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,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
ModalLimits
• Const
ModalLimits: Object
Namespace containing limits related to Discord Modals.
Type declaration
Name | Type | Description |
---|---|---|
MaximumComponents | 5 | Maximum components allowed in a modal. |
MaximumCustomIdCharacters | 100 | Maximum characters allowed in a modal custom ID. |
MaximumTitleCharacters | 45 | Maximum characters allowed in a modal title. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:270
ModerationLimits
• Const
ModerationLimits: Object
Namespace containing limits related to built-in moderation features.
Type declaration
Name | Type | Description |
---|---|---|
MaximumTimeoutDuration | 2419200 | Maximum duration of a guild timeout, in seconds (corresponds to 28 days). |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:226
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,18}/
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:73
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,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
• Const
RoleLimits: Object
Namespace containing limits related to Discord roles.
Type declaration
Name | Type | Description |
---|---|---|
MaximumNameLength | 100 | Maximum characters allowed in a role name. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:235
RoleMentionRegex
• Const
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
SelectMenuLimits
• Const
SelectMenuLimits: Object
Namespace containing limits related to Select Menus.
Type declaration
Name | Type | Description |
---|---|---|
MaximumCustomIdCharacters | 100 | Maximum characters allowed in a select menu custom ID. |
MaximumLengthOfNameOfOption | 100 | Maximum characters allowed in a select menu option's name. |
MaximumMaxValuesSize | 25 | Maximum "maximum" values allowed in a select menu. |
MaximumMinValuesSize | 25 | Maximum "minimum" values allowed in a select menu. |
MaximumOptionsLength | 25 | Maximum amount of options allowed in a select menu. |
MaximumPlaceholderCharacters | 100 | Maximum characters allowed in a select menu placeholder. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:157
SnowflakeRegex
• Const
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
TextInputLimits
• Const
TextInputLimits: Object
Namespace containing limits related to Discord Modal Text Input component.
Type declaration
Name | Type | Description |
---|---|---|
MaximumCustomIdCharacters | 100 | Maximum characters allowed in a text input custom ID. |
MaximumLabelCharacters | 45 | Maximum characters allowed in a text input label. |
MaximumPlaceholderCharacters | 100 | Maximum characters allowed in a text input placeholder. |
MaximumValueCharacters | 4000 | Maximum characters allowed in a text input value. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:287
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/lib/regexes.d.ts:106
TwemojiRegex
• Const
TwemojiRegex: RegExp
Regex that can capture a Twemoji (Twitter Emoji)
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/regexes.d.ts:111
UserLimits
• Const
UserLimits: Object
Namespace containing limits related to Discord users and Direct Messages.
Type declaration
Name | Type | Description |
---|---|---|
MaximumBiographyLength | 190 | Maximum characters allowed in a user's biography (the "About Me" section). |
MaximumUsersPerDMGroup | 10 | Maximum numbers of users in a DM group. |
Defined in
node_modules/@sapphire/discord-utilities/dist/lib/limits.d.ts:244
UserOrMemberMentionRegex
• Const
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:117
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/lib/regexes.d.ts:123
WebhookRegex
• Const
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:132
Functions
actionIsButtonOrMenu
▸ actionIsButtonOrMenu(action
): action is PaginatedMessageActionButton | PaginatedMessageActionMenu
Parameters
Name | Type |
---|---|
action | PaginatedMessageAction |
Returns
action is PaginatedMessageActionButton | PaginatedMessageActionMenu
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/utils.ts:36
canJoinVoiceChannel
▸ canJoinVoiceChannel(channel
): boolean
Determines whether the client can join the given voice based channel.
Parameters
Name | Type | Description |
---|---|---|
channel | Nullish | VoiceBasedChannel | The 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:101
canReact
▸ canReact(channel
): boolean
Determines whether or not we can send react to messages in a given channel.
Parameters
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The 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 read messages in a given channel.
Parameters
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The 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
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The 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
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The 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
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The 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
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The 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
Name | Type |
---|---|
components | (MessageButton | MessageSelectMenu )[] |
Returns
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/utils.ts:55
isCategoryChannel
▸ isCategoryChannel(channel
): channel is CategoryChannel
Checks whether a given channel is a {@link CategoryChannel}
Parameters
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The channel to check |
Returns
channel is CategoryChannel
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:25
isDMChannel
▸ isDMChannel(channel
): channel is DMChannel | PartialDMChannel
Checks whether a given channel is a {@link DMChannel}
Parameters
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The channel to check |
Returns
channel is DMChannel | PartialDMChannel
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:33
isGroupChannel
▸ isGroupChannel(channel
): channel is PartialGroupDMChannel
Checks whether a given channel is a {@link PartialGroupDMChannel}
Parameters
Name | Type | Description |
---|---|---|
channel | PartialDMChannel | Channel | Nullish | The channel to check |
Returns
channel is PartialGroupDMChannel
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:41
isGuildBasedChannel
▸ isGuildBasedChannel(channel
): channel is GuildTextBasedChannelTypes
Checks if a channel comes from a guild.
Parameters
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The 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:50
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
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The 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:60
isGuildMember
▸ isGuildMember(member
): member is GuildMember
Checks whether a given member is an instance of {@link GuildMember}, and not {@link APIInteractionGuildMember}, {@link APIGuildMember}, or Nullish
Parameters
Name | Type | Description |
---|---|---|
member | GuildMember | Nullish | APIGuildMember | APIInteractionGuildMember | The 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:198
isMessageButtonComponent
▸ isMessageButtonComponent(component
): component is MessageButton
Parameters
Name | Type |
---|---|
component | MessageButton | MessageSelectMenu |
Returns
component is MessageButton
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/utils.ts:51
isMessageButtonInteraction
▸ isMessageButtonInteraction(interaction
): interaction is InteractionButtonOptions
Parameters
Name | Type |
---|---|
interaction | InteractionButtonOptions | MessageSelectMenuOptions |
Returns
interaction is InteractionButtonOptions
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/utils.ts:45
isMessageInstance
▸ isMessageInstance(message
): message is Message<boolean>
Checks whether a given message is an instance of {@link Message}, and not {@link APIMessage}
Parameters
Name | Type | Description |
---|---|---|
message | Message <boolean > | APIMessage | 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:189
isNewsChannel
▸ isNewsChannel(channel
): channel is NewsChannel
Checks whether a given channel is a {@link NewsChannel}.
Parameters
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The channel to check. |
Returns
channel is NewsChannel
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:68
isNewsThreadChannel
▸ isNewsThreadChannel(channel
): channel is ThreadChannel
Checks whether a given channel is a News {@link ThreadChannel}
Parameters
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The channel to check. |
Returns
channel is ThreadChannel
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:117
isNsfwChannel
▸ isNsfwChannel(channel
): boolean
Checks whether a given channel allows NSFW content or not
Parameters
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The channel to check. |
Returns
boolean
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:161
isPrivateThreadChannel
▸ isPrivateThreadChannel(channel
): channel is ThreadChannel
Checks whether a given channel is a Private {@link ThreadChannel}
Parameters
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The channel to check. |
Returns
channel is ThreadChannel
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:133
isPublicThreadChannel
▸ isPublicThreadChannel(channel
): channel is ThreadChannel
Checks whether a given channel is a Public {@link ThreadChannel}
Parameters
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The channel to check. |
Returns
channel is ThreadChannel
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:125
isStageChannel
▸ isStageChannel(channel
): channel is StageChannel
Checks whether a given channel is a {@link StageChannel}
Parameters
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The channel to check |
Returns
channel is StageChannel
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:101
isStoreChannel
▸ isStoreChannel(channel
): channel is StoreChannel
Checks whether a given channel is a {@link StoreChannel}
deprecated
See Self-serve Game Selling Deprecation for more information.
Parameters
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The channel to check |
Returns
channel is StoreChannel
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:77
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
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The channel to check. |
Returns
channel is DMChannel | PartialDMChannel | NewsChannel | TextChannel | ThreadChannel
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:141
isTextChannel
▸ isTextChannel(channel
): channel is TextChannel
Checks whether a given channel is a {@link TextChannel}.
Parameters
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The channel to check. |
Returns
channel is TextChannel
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:85
isThreadChannel
▸ isThreadChannel(channel
): channel is ThreadChannel
Checks whether a given channel is a {@link ThreadChannel}
Parameters
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The channel to check. |
Returns
channel is ThreadChannel
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:109
isVoiceBasedChannel
▸ isVoiceBasedChannel(channel
): channel is BaseGuildVoiceChannel
Checks whether a given channel is a {@link BaseGuildVoiceChannel}.
Parameters
Name | Type |
---|---|
channel | Channel | Nullish |
Returns
channel is BaseGuildVoiceChannel
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:151
isVoiceChannel
▸ isVoiceChannel(channel
): channel is VoiceChannel
Checks whether a given channel is a {@link VoiceChannel}
Parameters
Name | Type | Description |
---|---|---|
channel | ChannelTypes | Nullish | The channel to check |
Returns
channel is VoiceChannel
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:93
runsOnInteraction
▸ runsOnInteraction(messageOrInteraction
): messageOrInteraction is CommandInteraction<CacheType> | ContextMenuInteraction<CacheType> | SelectMenuInteraction<CacheType> | ButtonInteraction<CacheType>
Checks whether the PaginatedMessage runs on an {@link CommandInteraction}, {@link ContextMenuInteraction}, {@link SelectMenuInteraction} or {@link Message}
Parameters
Name | Type | Description |
---|---|---|
messageOrInteraction | Message <boolean > | APIMessage | CommandInteraction <CacheType > | ContextMenuInteraction <CacheType > | SelectMenuInteraction <CacheType > | ButtonInteraction <CacheType > | The message or interaction that the PaginatedMessage runs on |
Returns
messageOrInteraction is CommandInteraction<CacheType> | ContextMenuInteraction<CacheType> | SelectMenuInteraction<CacheType> | ButtonInteraction<CacheType>
true
if the PaginatedMessage runs on an an {@link CommandInteraction}, {@link ContextMenuInteraction} or {@link SelectMenuInteraction}, false
if it runs on a {@link Message}
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/utils.ts:30
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
Name | Type |
---|---|
T | extends "reply" | "edit" |
Parameters
Name | Type | Description |
---|---|---|
parameters | SafeReplyToInteractionParameters <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:81