UNPKG

@sapphire/discord-utilities

Version:

Discord specific utilities for your JavaScript/TypeScript bots

988 lines (982 loc) • 35.7 kB
import { APIApplicationCommandInteraction, APIApplicationCommandAutocompleteInteraction, APIModalSubmitInteraction, APIApplicationCommandInteractionDataOption, APIInteractionDataResolvedChannel, APIUser, APIInteractionDataResolvedGuildMember, APIRole, APIAttachment, APIMessage, ApplicationCommandOptionType } from 'discord-api-types/v10'; /** * Utility class for resolving command interaction options while working with the raw API. * Based on {@linkplain https://github.com/discordjs/discord.js/blob/main/packages/discord.js/src/structures/CommandInteractionOptionResolver.js} */ declare class InteractionOptionResolver { private readonly interaction; /** * The interaction options array */ private readonly data; /** * The interaction resolved data */ private readonly resolved; /** * Bottom-level options for the interaction * If there is a subcommand (or subcommand and group), this represents the options for the subcommand. */ private readonly hoistedOptions; /** * The name of the subcommand group */ private readonly group; /** * The name of the subcommand */ private readonly subcommand; constructor(interaction: APIApplicationCommandInteraction | APIApplicationCommandAutocompleteInteraction | APIModalSubmitInteraction); /** * Gets an option by its name * @param name The name of the option * @param required Whether to throw an error if the option is not found */ get<Required extends boolean = false>(name: string, required?: Required): RequiredIf<Required, APIApplicationCommandInteractionDataOption>; /** * Gets the selected subcommand * @param required Whether to throw an error if there is no subcommand */ getSubcommand<Required extends boolean = false>(required?: Required): RequiredIf<Required, string>; /** * Gets the selected subcommand group * @param required Whether to throw an error if there is no subcommand group */ getSubcommandGroup<Required extends boolean = false>(required?: Required): RequiredIf<Required, string>; /** * Gets a boolean option * @param name The name of the option * @param required Whether to throw an error if the option is not found */ getBoolean<Required extends boolean = false>(name: string, required?: Required): RequiredIf<Required, boolean>; /** * Gets a channel option * @param name The name of the option * @param required Whether to throw an error if the option is not found */ getChannel<Required extends boolean = false>(name: string, required?: Required): RequiredIf<Required, APIInteractionDataResolvedChannel>; /** * Gets a string option * @param name The name of the option * @param required Whether to throw an error if the option is not found */ getString<Required extends boolean = false>(name: string, required?: Required): RequiredIf<Required, string>; /** * Gets an integer option * @param name The name of the option * @param required Whether to throw an error if the option is not found */ getInteger<Required extends boolean = false>(name: string, required?: Required): RequiredIf<Required, number>; /** * Gets a number option * @param name The name of the option * @param required Whether to throw an error if the option is not found */ getNumber<Required extends boolean = false>(name: string, required?: Required): RequiredIf<Required, number>; /** * Gets a user option * @param name The name of the option * @param required Whether to throw an error if the option is not found */ getUser<Required extends boolean = false>(name: string, required?: Required): RequiredIf<Required, APIUser>; /** * Gets a member option * @param name The name of the option * @param required Whether to throw an error if the option is not found */ getMember<Required extends boolean = false>(name: string, required?: Required): RequiredIf<Required, APIInteractionDataResolvedGuildMember>; /** * Gets a role option * @param name The name of the option * @param required Whether to throw an error if the option is not found */ getRole<Required extends boolean = false>(name: string, required?: Required): RequiredIf<Required, APIRole>; /** * Gets an attachment option * @param name The name of the option * @param required Whether to throw an error if the option is not found */ getAttachment<Required extends boolean = false>(name: string, required?: Required): RequiredIf<Required, APIAttachment>; /** * Gets a mentionable option * @param name The name of the option * @param required Whether to throw an error if the option is not found */ getMentionable<Required extends boolean = false>(name: string, required?: Required): RequiredIf<Required, APIUser | APIInteractionDataResolvedGuildMember | APIRole>; /** * Gets the target user for a context menu interaction */ getTargetUser(): APIUser; /** * Gets the target member for a context menu interaction * @param required Whether to throw an error if the member data is not present */ getTargetMember<Required extends boolean = false>(required?: Required): RequiredIf<Required, APIInteractionDataResolvedGuildMember>; /** * Gets the target message for a context menu interaction */ getTargetMessage(): APIMessage; /** * Gets the focused option for an autocomplete interaction */ getFocusedOption(): { name: string; type: ApplicationCommandOptionType.Integer; value: number; } | { name: string; type: ApplicationCommandOptionType.Number; value: number; } | { name: string; type: ApplicationCommandOptionType.String; value: string; }; private getTypedOption; } type If<Value extends boolean, TrueResult, FalseResult> = Value extends true ? TrueResult : Value extends false ? FalseResult : TrueResult | FalseResult; type RequiredIf<Value extends boolean, ValueType, FallbackType = null> = If<Value, ValueType, ValueType | FallbackType>; /** * Namespace containing limits related to Discord channels. */ declare const ChannelLimits: { /** * Maximum characters allowed in a channel description. */ readonly MaximumDescriptionLength: 1024; /** * Maximum characters allowed in a channel name. */ readonly MaximumNameLength: 100; /** * Maximum viewers allowed per screen share. * @deprecated Use `VoiceChannelLimits.MaximumViewersPerScreenShare` instead. */ readonly MaximumViewersPerScreenShare: 50; }; /** * Namespace containing limits related to Discord voice channels. */ declare const VoiceChannelLimits: { /** * Maximum viewers allowed per screen share. */ MaximumViewersPerScreenShare: number; /** * Maximum user limit of voice channel. */ MaximumUserLimit: number; }; /** * Namespace containing limits related to Discord stage channels. */ declare const StageChannelLimits: { /** * Maximum user limit of stage channel. */ MaximumUserLimit: number; }; /** * Namespace containing limits related to Discord text channels. */ declare const TextChannelLimits: { /** * Maximum pins allowed in a text channel. */ readonly MaximumMessagePins: 50; }; /** * Namespace containing limits related to Discord threads. */ declare const ThreadLimits: { /** * Minimum number of threads to return from the threads API. */ readonly MinimumThreadsToFetch: 1; /** * Maximum number of threads to return from the threads API. */ readonly MaximumThreadsToFetch: 100; }; /** * Namespace containing limits related to Discord embeds. */ declare const EmbedLimits: { /** * Maximum characters allowed in the author field of an embed. */ readonly MaximumAuthorNameLength: 256; /** * Maximum characters allowed in an embed description. */ readonly MaximumDescriptionLength: 4096; /** * Maximum characters allowed in the name of a field in an embed. */ readonly MaximumFieldNameLength: 256; /** * Maximum fields allowed in an embed. */ readonly MaximumFields: 25; /** * Maximum characters allowed in the value of a field in an embed. */ readonly MaximumFieldValueLength: 1024; /** * Maximum characters allowed in a footer of an embed. */ readonly MaximumFooterLength: 2048; /** * Maximum characters allowed in the title of an embed. */ readonly MaximumTitleLength: 256; /** * Maximum characters allowed in an embed, in total. */ readonly MaximumTotalCharacters: 6000; }; /** * Namespace containing limits related to Discord emojis. */ declare const EmojiLimits: { /** * Maximum characters allowed in a custom guild emoji. */ readonly MaximumEmojiNameLength: 32; /** * Maximum size allowed for a custom guild emoji. * Size is in bytes, and corresponds to 256KB. */ readonly MaximumEmojiSize: 256000; }; /** * Namespace containing limits related to Discord guilds. */ declare const GuildLimits: { /** * Maximum channels allowed per guild, including category channels. */ readonly MaximumChannels: 500; /** * Maximum roles allowed in a guild. */ readonly MaximumRoles: 250; /** * Maximum scheduled or active events allowed in a guild. */ readonly MaximumScheduledOrActiveEvents: 100; /** * Minimum number of user guilds to return from the user guilds API. */ readonly MinimumUserGuildsToFetch: 1; /** * Maximum number of user guilds to return from the user guilds API. */ readonly MaximumUserGuildsToFetch: 200; /** * Maximum static emojis allowed in a guild. */ readonly MaximumStaticEmojis: 50; /** * Maximum animated emojis allowed in a guild. */ readonly MaximumAnimatedEmojis: 50; /** * Maximum emojis (static and animated) allowed in a guild. */ readonly MaximumEmojis: 100; /** * Maximum stickers allowed in a guild. */ readonly MaximumStickers: 5; }; /** * Namespace containing limits related to premium Discord guilds. */ declare const PremiumGuildLimits: { readonly TierOne: { /** * Maximum static emojis allowed in a guild. */ readonly MaximumStaticEmojis: 100; /** * Maximum animated emojis allowed in a guild. */ readonly MaximumAnimatedEmojis: 100; /** * Maximum emojis (static and animated) allowed in a guild. */ readonly MaximumEmojis: 200; /** * Maximum stickers allowed in a guild. */ readonly MaximumStickers: 15; }; readonly TierTwo: { /** * Maximum static emojis allowed in a guild. */ readonly MaximumStaticEmojis: 150; /** * Maximum animated emojis allowed in a guild. */ readonly MaximumAnimatedEmojis: 150; /** * Maximum emojis (static and animated) allowed in a guild. */ readonly MaximumEmojis: 300; /** * Maximum stickers allowed in a guild. */ readonly MaximumStickers: 30; }; readonly TierThree: { /** * Maximum static emojis allowed in a guild. */ readonly MaximumStaticEmojis: 250; /** * Maximum animated emojis allowed in a guild. */ readonly MaximumAnimatedEmojis: 250; /** * Maximum emojis (static and animated) allowed in a guild. */ readonly MaximumEmojis: 500; /** * Maximum stickers allowed in a guild. */ readonly MaximumStickers: 60; }; }; /** * Namespace containing limits related to Discord guild scheduled events. */ declare const GuildScheduledEventLimits: { /** * Maximum number of users to return from the guild scheduled event users API. */ readonly MaximumUsersToFetch: 100; }; /** * Namespace containing limits related to Discord guild members. */ declare const GuildMemberLimits: { /** * Maximum characters allowed in the display name of a guild member. */ readonly MaximumDisplayNameLength: 32; /** * Minimum number of members to return from the guild members API. */ readonly MinimumMembersToFetch: 1; /** * Maximum number of members to return from the guild members API. */ readonly MaximumMembersToFetch: 1000; }; /** * Namespace containing limits related to Discord guild bans. */ declare const GuildBansLimits: { /** * Minimum number of bans to return from the guild bans API. */ readonly MinimumBansToFetch: 1; /** * Maximum number of bans to return from the guild bans API. */ readonly MaximumBansToFetch: 1000; }; /** * Namespace containing limits related to Discord interactions. */ declare const InteractionLimits: { /** * Maximum buttons allowed in a single action row. */ readonly MaximumButtonsPerActionRow: 5; /** * Maximum select menus allowed in a single action row. */ readonly MaximumSelectMenusPerActionRow: 1; /** * Maximum text inputs allowed in a single action row. */ readonly MaximumTextInputsPerActionRow: 1; /** * Maximum options allowed in a single select menu. */ readonly MaximumOptionsInSelectMenus: 25; }; /** * Namespace containing limits related to Discord application commands (slash commands). */ declare const ApplicationCommandLimits: { /** * Maximum characters allowed in an application command name. */ readonly MaximumNameCharacters: 32; /** * Maximum characters allowed in an application command description. */ readonly MaximumDescriptionCharacters: 100; /** * Maximum options allowed in an application command. */ readonly MaximumOptionsLength: 25; /** * Maximum combined characters allowed in the name, description, and value properties of an application command, its options (including subcommands and groups), and choices. */ readonly MaximumCombinedCharacters: 4000; }; /** * Namespace containing limits related to Choices of Discord Application Commands. */ declare const ApplicationCommandOptionLimits: { /** * Maximum characters allowed in the name of an option of an application command. */ readonly MaximumNameCharacters: 32; /** * Maximum characters allowed in the description of an option of an application command. */ readonly MaximumDescriptionCharacters: 100; /** * Maximum length of choices allowed in the option of an application command. */ readonly MaximumChoicesLength: 25; /** * Maximum length of string allowed in the string option of an application command. */ readonly MaximumStringLength: 6000; }; /** * Namespace containing limits related to Permissions of Discord Application Commands. */ declare const ApplicationCommandPermissionLimits: { /** * Maximum length of permissions allowed in the option of an application command. */ readonly MaximumPermissionsLength: 100; }; /** * Namespace containing limits related to Message Buttons. */ declare const ButtonLimits: { /** * Maximum characters allowed in a button label. */ readonly MaximumLabelCharacters: 80; /** * Maximum characters allowed in a button custom ID. */ readonly MaximumCustomIdCharacters: 100; }; /** * Namespace containing limits related to Select Menus. */ declare const SelectMenuLimits: { /** * Maximum characters allowed in a select menu custom ID. */ readonly MaximumCustomIdCharacters: 100; /** * Maximum amount of options allowed in a select menu. */ readonly MaximumOptionsLength: 25; /** * Maximum characters allowed in a select menu placeholder. */ readonly MaximumPlaceholderCharacters: 150; /** * Maximum "minimum" values allowed in a select menu. */ readonly MaximumMinValuesSize: 25; /** * Maximum "maximum" values allowed in a select menu. */ readonly MaximumMaxValuesSize: 25; /** * Maximum characters allowed in a select menu option's name. */ readonly MaximumLengthOfNameOfOption: 100; /** * Maximum characters allowed in a select menu option's description. */ readonly MaximumLengthOfDescriptionOfOption: 100; /** * Maximum characters allowed in a select menu option's value. */ readonly MaximumLengthOfValueOfOption: 100; }; /** * Namespace containing limits related to Discord messages. */ declare const MessageLimits: { /** * Maximum embeds allowed in a single message. */ readonly MaximumEmbeds: 10; /** * Maximum action rows allowed in a single message. */ readonly MaximumActionRows: 5; /** * Maximum characters allowed in a single message for a user. */ readonly MaximumLength: 2000; /** * Maximum characters allowed in a single message for a nitro user. */ readonly MaximumNitroLength: 4000; /** * Maximum numbers of reactions allowed for a message. */ readonly MaximumReactions: 20; /** * Maximum 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. */ readonly MaximumUploadSize: 25000000; /** * Maximum upload size for a Nitro Basic user, in any guild or in DMs. * Size is in bytes, and corresponds to 50MB. */ readonly MaximumNitroBasicUploadSize: 50000000; /** * Maximum upload size for a Nitro user, in any guild or in DMs. * Size is in bytes, and corresponds to 500MB. */ readonly MaximumNitroUploadSize: 500000000; /** * 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. */ readonly MaximumUploadSizeInGuild: readonly [25000000, 25000000, 50000000, 100000000]; /** * Minimum number of messages to return from the channel messages API. */ readonly MinimumMessagesToFetch: 1; /** * Maximum number of messages to return from the channel messages API. */ readonly MaximumMessagesToFetch: 100; /** * Maximum request size when sending a messages. * Size is in bytes, and corresponds to 25MB. */ readonly MaximumRequestSize: 25000000; /** * Minimum number of messages to delete in a single bulk delete request. */ readonly MinimumMessagesToBulkDelete: 2; /** * Maximum number of messages to delete in a single bulk delete request. */ readonly MaximumMessagesToBulkDelete: 100; }; /** * Namespace containing limits related to Discord message reactions. */ declare const ReactionLimits: { /** * Minimum number of reactions to fetch from the message reactions API. */ MinimumReactionToFetch: number; /** * Maximum number of reactions to fetch from the message reactions API. */ MaximumReactionsToFetch: number; }; /** * Namespace containing limits related to built-in moderation features. */ declare const ModerationLimits: { /** * Maximum duration of a guild timeout, in seconds (corresponds to 28 days). */ readonly MaximumTimeoutDuration: 2419200; }; /** * Namespace containing limits related to Discord roles. */ declare const RoleLimits: { /** * Maximum characters allowed in a role name. */ readonly MaximumNameLength: 100; }; /** * Namespace containing limits related to Discord users and Direct Messages. */ declare const UserLimits: { /** * Maximum numbers of users in a DM group. */ readonly MaximumUsersPerDMGroup: 10; /** * Maximum characters allowed in a user's biography (the "About Me" section). */ readonly MaximumBiographyLength: 190; }; /** * Namespace container limits related to Discord autocomplete interactions. */ declare const AutoCompleteLimits: { /** * Maximum options allowed in a single autocomplete response. */ readonly MaximumAmountOfOptions: 25; /** * Maximum characters allowed in a select menu option's name. */ readonly MaximumLengthOfNameOfOption: 100; }; /** * Namespace containing limits related to Discord Modals. */ declare const ModalLimits: { /** * Maximum characters allowed in a modal custom ID. */ readonly MaximumCustomIdCharacters: 100; /** * Maximum characters allowed in a modal title. */ readonly MaximumTitleCharacters: 45; /** * Maximum components allowed in a modal. */ readonly MaximumComponents: 5; }; /** * Namespace containing limits related to Discord Modal Text Input component. */ declare const TextInputLimits: { /** * Maximum characters allowed in a text input custom ID. */ readonly MaximumCustomIdCharacters: 100; /** * Maximum characters allowed in a text input label. */ readonly MaximumLabelCharacters: 45; /** * Maximum characters allowed in a text input placeholder. */ readonly MaximumPlaceholderCharacters: 100; /** * Maximum characters allowed in a text input value. */ readonly MaximumValueCharacters: 4000; }; /** * Namespace containing limits related to Discord Application Role Connections. */ declare const ApplicationRoleConnectionLimits: { /** * Maximum application role connection metadata records an application can have. */ readonly MaximumMetadataRecords: 5; /** * Maximum characters allowed in metadata values. */ readonly MaximumMetadataValueLength: 100; /** * Maximum characters allowed in a platform name. */ readonly MaximumPlatformNameLength: 50; /** * Maximum characters allowed in a platform username. */ readonly MaximumPlatformUsernameLength: 100; }; /** * Namespace containing limits related to Discord Guild Audit Logs. */ declare const GuildAuditLogsLimits: { /** * Minimum number of entries to return from the guild audit log API. */ readonly MinimumEntriesToFetch: 1; /** * Maximum number of entries to return from the guild audit log API. */ readonly MaximumEntriesToFetch: 100; }; /** * Namespace containing limits related to Discord Auto Moderation Rules. */ declare const AutoModerationRuleLimits: { /** * Maximum number of exempt roles a rule can have. */ readonly MaximumExemptRoles: 20; /** * Maximum number of exempt channels a rule can have. */ readonly MaximumExemptChannels: 50; }; /** * Namespace containing limits related to Discord Auto Moderation Triggers. */ declare const TriggerTypeLimits: { /** * Maximum number of keyword triggers a guild can have. */ readonly MaximumKeywordTriggersPerGuild: 6; /** * Maximum number of mention spam triggers a guild can have. */ readonly MaximumSpamTriggersPerGuild: 1; /** * Maximum number of keyword triggers a channel can have. */ readonly MaximumKeywordPresetTriggersPerChannel: 1; /** * Maximum number of mention spam triggers a channel can have. */ readonly MaximumMentionSpamTriggersPerChannel: 1; }; /** * Namespace containing limits related to Discord Auto Moderation Trigger Metadata. */ declare const TriggerMetadataLimits: { /** * Maximum number of substrings which will be searched for in content. */ readonly MaximumKeywordFilters: 1000; /** * Maximum number of characters allowed in a keyword filter. */ readonly MaximumKeywordFilterLength: 60; /** * Maximum number of regular expression patterns which will be matched against content. */ readonly MaximumRegexPatterns: 10; /** * Maximum number of characters allowed in a regular expression pattern. */ readonly MaximumCharactersPerRegexPattern: 260; /** * Maximum number of substrings which should not trigger the keyword rule. */ readonly MaximumKeywordAllowListLength: 100; /** * Maximum characters per keyword that should not trigger the keyword rule. */ readonly MaximumKeywordAllowListKeywordLength: 60; /** * Maximum characters per keyword should not trigger the keyword preset rule. */ readonly MaximumKeywordPresetAllowListKeywordPresetLength: 60; /** * Maximum number of substrings which should not trigger the keyword preset rule. */ readonly MaximumKeywordPresetAllowListLength: 1000; /** * Maximum number of unique role and user mentions allowed per message. */ readonly MaximumMentionSpamTotalMentions: 50; }; /** * Namespace containing limits related to Discord Auto Moderation Action Metadata. */ declare const ActionMetadataLimits: { /** * Maximum timeout duration in seconds. */ readonly MaximumTimeoutDurationSeconds: 2419200; /** * Maximum number of characters allowed in a custom block message. */ readonly MaximumCustomBlockMessageLength: 150; }; /** * Namespace containing limits related to Discord Message Allowed Mentions. */ declare const AllowedMentionsLimits: { /** * Maximum number of users allowed in an allowed mentions object. */ readonly MaximumUsers: 100; /** * Maximum number of roles allowed in an allowed mentions object. */ readonly MaximumRoles: 100; }; /** * Namespace containing limits related to Discord Channel Invites. */ declare const ChannelInviteLimits: { /** * Maximum age of an invite in seconds. */ readonly MaximumAgeSeconds: 604800; /** * Maximum number of uses allowed for an invite. */ readonly MaximumUses: 100; }; /** * Namespace containing limits related to Discord Guild Integrations. */ declare const GuildIntegrationLimits: { /** * Maximum number of integrations returned from the guild integrations API. Needs a more description name than "MaximumIntegrations". */ readonly MaximumIntegrationsToFetch: 50; }; /** * Namespace containing limits related to Discord Stickers. */ declare const StickerLimits: { /** * Maximum number of characters allowed in the autocomplete/suggestion tags for the sticker. */ MaximumTagsLength: number; /** * Maximum size allowed for a sticker. * Size is in bytes, and corresponds to 512KB. */ MaximumStickerSize: number; }; /** * 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`. */ declare const ChannelMentionRegex: 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`. */ declare const ChannelMessageRegex: 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`. */ declare const DiscordHostnameRegex: 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`. */ declare const DiscordInviteLinkRegex: 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`. */ declare const EmojiRegex: RegExp; /** * Regex that matches any animated or non-animated custom Discord emoji. * Unlike {@link EmojiRegex} It can be a substring of a larger string. * @raw `/<a?:\w{2,32}:\d{17,20}>/` */ declare const FormattedCustomEmoji: RegExp; /** * Regex that can capture any animated or non-animated custom Discord emoji. * Similar to {@link FormattedCustomEmoji} and unlike {@link 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`. */ declare const FormattedCustomEmojiWithGroups: RegExp; /** * Regex that matches any URL starting with `http` or `https` * @raw `/^https?:\/\//` * @remark for WebSocket URLs see {@link WebSocketUrlRegex} */ declare const HttpUrlRegex: 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`. */ declare const MessageLinkRegex: 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 {@link FormattedCustomEmoji}. * @raw `/a?:\w{2,32}:\d{17,20}/` */ declare 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 {@link 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`. */ declare const ParsedCustomEmojiWithGroups: 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`. */ declare const RoleMentionRegex: 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`. */ declare const SnowflakeRegex: 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. */ declare const TokenRegex: 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`. */ declare const UserOrMemberMentionRegex: RegExp; /** * Regex that matches any WebSocket URL starting with `ws` or `wss` * @raw `/^wss?:\/\//` * @remark for regular HTTP URLs see {@link HttpUrlRegex} */ declare const WebSocketUrlRegex: 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 {@link HttpUrlRegex} */ declare const WebhookRegex: RegExp; /** * Regex that can capture a Twemoji (Twitter Emoji) * @raw {@linkplain https://github.com/jdecked/twemoji-parser/blob/main/src/lib/regex.js See official source code} */ declare const TwemojiRegex: RegExp; /** * Creates a fresh instance of the Twemoji regex, which is useful if you don't want to worry about the effects of a global regex and the lastIndex * @returns A clone of the Twemoji regex */ declare function createTwemojiRegex(): RegExp; export { ActionMetadataLimits, AllowedMentionsLimits, ApplicationCommandLimits, ApplicationCommandOptionLimits, ApplicationCommandPermissionLimits, ApplicationRoleConnectionLimits, AutoCompleteLimits, AutoModerationRuleLimits, ButtonLimits, ChannelInviteLimits, ChannelLimits, ChannelMentionRegex, ChannelMessageRegex, DiscordHostnameRegex, DiscordInviteLinkRegex, EmbedLimits, EmojiLimits, EmojiRegex, FormattedCustomEmoji, FormattedCustomEmojiWithGroups, GuildAuditLogsLimits, GuildBansLimits, GuildIntegrationLimits, GuildLimits, GuildMemberLimits, GuildScheduledEventLimits, HttpUrlRegex, InteractionLimits, InteractionOptionResolver, MessageLimits, MessageLinkRegex, ModalLimits, ModerationLimits, ParsedCustomEmoji, ParsedCustomEmojiWithGroups, PremiumGuildLimits, ReactionLimits, RoleLimits, RoleMentionRegex, SelectMenuLimits, SnowflakeRegex, StageChannelLimits, StickerLimits, TextChannelLimits, TextInputLimits, ThreadLimits, TokenRegex, TriggerMetadataLimits, TriggerTypeLimits, TwemojiRegex, UserLimits, UserOrMemberMentionRegex, VoiceChannelLimits, WebSocketUrlRegex, WebhookRegex, createTwemojiRegex };