Skip to main content

ErrorCode

Enum ErrorCode 

Source
#[non_exhaustive]
pub enum ErrorCode {
Show 246 variants GeneralError, UnknownAccount, UnknownApplication, UnknownChannel, UnknownGuild, UnknownIntegration, UnknownInvite, UnknownMember, UnknownMessage, UnknownPermissionOverwrite, UnknownProvider, UnknownRole, UnknownToken, UnknownUser, UnknownEmoji, UnknownWebhook, UnknownWebhookService, UnknownSession, UnknownAsset, UnknownBan, UnknownSku, UnknownStoreListing, UnknownEntitlement, UnknownBuild, UnknownLobby, UnknownBranch, UnknownStoreDirectoryLayout, UnknownRedistributable, UnknownGiftCode, UnknownStream, UnknownPremiumServerSubscribeCooldown, UnknownGuildTemplate, UnknownDiscoverableServerCategory, UnknownSticker, UnknownStickerPack, UnknownInteraction, UnknownApplicationCommand, UnknownVoiceState, UnknownApplicationCommandPermissions, UnknownStageInstance, UnknownGuildMemberVerificationForm, UnknownGuildWelcomeScreen, UnknownGuildScheduledEvent, UnknownGuildScheduledEventUser, UnknownTag, UnknownSound, UnknownInviteTargetUsersJob, UnknownInviteTargetUsers, BotsCannotUseThisEndpoint, OnlyBotsCanUseThisEndpoint, ExplicitContentCannotBeSentToTheDesiredRecipient, NotAuthorizedToPerformThisActionOnThisApplication, ThisActionRequiresAPremiumSubscription, ActionCannotBePerformedDueToSlowmodeRateLimit, OnlyTheOwnerOfThisAccountCanPerformThisAction, AnnouncementEditLimitExceeded, UnderMinimumAge, ChannelWriteRateLimit, ServerWriteRateLimit, StageTopicServerNameServerDescriptionOrChannelNamesContainDisallowedWords, GuildPremiumSubscriptionLevelTooLow, MaximumNumberOfGuildsReached, MaximumNumberOfFriendsReached, MaximumNumberOfPinsReachedForTheChannel, MaximumNumberOfRecipientsReached, MaximumNumberOfGuildRolesReached, MaximumNumberOfWebhooksReached, MaximumNumberOfEmojisReached, MaximumNumberOfReactionsReached, MaximumNumberOfGroupDmsReached, MaximumNumberOfGuildChannelsReached, MaximumNumberOfAttachmentsInAMessageReached, MaximumNumberOfInvitesReached, MaximumNumberOfAnimatedEmojisReached, MaximumNumberOfServerMembersReached, MaximumNumberOfServerCategoriesReached, GuildAlreadyHasTemplate, MaximumNumberOfApplicationCommandsReached, MaximumThreadParticipantsReached, MaximumDailyApplicationCommandCreatesReached, MaximumNumberOfNonGuildMemberBansHasBeenExceeded, MaximumNumberOfBanFetchesHasBeenReached, MaximumNumberOfUncompletedGuildScheduledEventsReached, MaximumNumberOfStickersReached, MaximumNumberOfPruneRequestsHasBeenReached, MaximumNumberOfGuildWidgetSettingsUpdatesHasBeenReached, MaximumNumberOfSoundboardSoundsReached, MaximumNumberOfEditsToMessagesOlderThanOneHourReached, MaximumNumberOfPinnedThreadsInForumHasBeenReached, MaximumNumberOfTagsInForumHasBeenReached, BitrateIsTooHighForChannelOfThisType, MaximumNumberOfPremiumEmojisReached, MaximumNumberOfWebhooksPerGuildReached, MaximumNumberOfChannelPermissionOverwritesReached, TheChannelsForThisGuildAreTooLarge, InviteTargetUsersLimitReached, Unauthorized, VerifyYourAccount, OpeningDirectMessagesTooFast, SendMessagesHasBeenTemporarilyDisabled, RequestEntityTooLarge, FeatureTemporarilyDisabledServerSide, UserBannedFromThisGuild, OnlyOneChannelCanHaveAParentIdModifiedAtATime, ConnectionHasBeenRevoked, OnlyConsumableSkusCanBeConsumed, YouCanOnlyDeleteSandboxEntitlements, TargetUserIsNotConnectedToVoice, ThisMessageWasAlreadyCrossposted, ApplicationCommandWithThatNameAlreadyExists, ApplicationInteractionFailedToSend, CannotSendAMessageInAForumChannel, InteractionHasAlreadyBeenAcknowledged, TagNamesMustBeUnique, ServiceResourceIsBeingRateLimited, ThereAreNoTagsAvailableThatCanBeSetByNonModerators, TagRequiredToCreateAForumPostInThisChannel, AnEntitlementHasAlreadyBeenGrantedForThisResource, ThisInteractionHasHitTheMaximumNumberOfFollowUpMessages, InviteTargetUsersAlreadyBeingProcessed, InviteTargetUsersFileNotProcessed, CloudflareIsBlockingYourRequest, MissingAccess, InvalidAccountType, CannotExecuteActionOnDmChannel, GuildWidgetDisabled, CannotEditMessageAuthoredByAnotherUser, CannotSendAnEmptyMessage, CannotSendMessagesToThisUser, CannotSendMessagesInNonTextChannel, ChannelVerificationLevelTooHighForYouToGainAccess, OAuth2ApplicationDoesNotHaveBot, OAuth2ApplicationLimitReached, InvalidOAuth2State, MissingPermissions, InvalidToken, NoteWasTooLong, ProvidedTooFewOrTooManyMessagesToDelete, InvalidMfaLevel, MessageCanOnlyBePinnedInTheChannelItWasSentIn, InviteCodeInvalidOrTaken, CannotExecuteActionOnSystemMessage, CannotExecuteActionOnThisChannelType, InvalidOAuth2AccessToken, MissingRequiredOAuth2Scope, InvalidWebhookToken, InvalidRole, InvalidRecipients, OneOfTheMessagesProvidedWasTooOldForBulkDelete, InvalidFormBodyOrContentType, InviteAcceptedToGuildWithoutTheBotBeingIn, InvalidActivityAction, InvalidApiVersion, FileUploadedExceedsMaximumSize, InvalidFileUploaded, CannotSelfRedeemThisGift, InvalidGuild, InvalidSku, InvalidRequestOrigin, InvalidMessageType, PaymentSourceRequiredToRedeemGift, CannotModifyASystemWebhook, CannotDeleteChannelRequiredForCommunityGuilds, CannotEditStickersWithinMessage, InvalidStickerSent, InvalidActionOnArchivedThread, InvalidThreadNotificationSettings, ParameterEarlierThanCreation, CommunityServerChannelsMustBeTextChannels, TheEntityTypeOfTheEventIsDifferentFromTheEntityYouAreTryingToStartTheEventFor, ServerNotAvailableInYourLocation, ServerNeedsMonetizationEnabledToPerformThisAction, ServerNeedsMoreBoostsToPerformThisAction, RequestBodyContainsInvalidJson, ProvidedFileIsInvalid, ProvidedFileTypeIsInvalid, ProvidedFileDurationExceedsMaximumLength, OwnerCannotBePendingMember, OwnershipCannotBeMovedToABotUser, FailedToResizeAssetBelowTheMaximumSize, CannotMixSubscriptionAndNonSubscriptionRolesForAnEmoji, CannotConvertBetweenPremiumEmojiAndNormalEmoji, UploadedFileNotFound, SpecifiedEmojiIsInvalid, VoiceMessagesDoNotSupportAdditionalContent, VoiceMessagesMustHaveASingleAudioAttachment, VoiceMessagesMustHaveSupportingMetadata, VoiceMessagesCannotBeEdited, CannotDeleteGuildSubscriptionIntegration, CannotSendVoiceEffectWhenUserIsServerMutedDeafenedOrSuppressed, YouCannotSendVoiceMessagesInThisChannel, TheUserAccountMustFirstBeVerified, ProvidedFileDoesNotHaveAValidDuration, CannotSendMessagesToThisUserDueToHavingNoMutualGuilds, YouDoNotHavePermissionToSendThisSticker, TwoFactorAuthenticationIsRequired, NoUsersWithDiscordTagExist, ReactionWasBlocked, UserCannotUseBurstReactions, IndexNotYetAvailable, ApplicationNotYetAvailable, ApiResourceOverloaded, TheStageIsAlreadyOpen, CannotReplyWithoutPermissionToReadMessageHistory, ThreadAlreadyCreatedForMessage, ThreadLocked, MaximumActiveThreads, MaximumActiveAnnouncementThreads, CannotReferenceAMessageWithoutPermissionToReadMessageHistory, NsfwChannelMessageReferenceNotAllowed, CannotForwardMessageWithUnreadableContent, InvalidJsonForUploadedLottieFile, UploadedLottiesCannotContainRasterizedImages, StickerMaximumFramerateExceeded, StickerFrameCountExceedsMaximumOf1000Frames, LottieAnimationMaximumDimensionsExceeded, StickerFramerateIsTooSmallOrTooLarge, StickerAnimationDurationExceedsMaximumOf5Seconds, CannotUpdateAFinishedEvent, FailedToCreateStageNeededForStageEvent, MessageWasBlockedByAutomaticModeration, TitleWasBlockedByAutomaticModeration, WebhooksPostedToForumChannelsMustHaveAThreadNameOrThreadId, WebhooksPostedToForumChannelsCannotHaveBothAThreadNameAndThreadId, WebhooksCanOnlyCreateThreadsInForumChannels, WebhookServicesCannotBeUsedInForumChannels, MessageBlockedByHarmfulLinksFilter, AccessToJoiningNewServersHasBeenLimitedForTheUser, CannotEnableOnboardingRequirementsAreNotMet, CannotUpdateOnboardingWhileBelowRequirements, AccessToFileUploadsHasBeenLimitedForThisGuild, FailedToBanUsers, PollVotingBlocked, PollExpired, InvalidChannelTypeForPollCreation, CannotEditAPollMessage, CannotUseAnEmojiIncludedWithThePoll, CannotExpireANonPollMessage, ProvisionalAccountsPermissionNotGranted, IdTokenJwtExpired, IdTokenJwtIssuerMismatch, IdTokenJwtAudienceMismatch, IdTokenJwtIssuedTooLongAgo, FailedToGenerateUniqueUsername, InvalidClientSecret, Unknown(u32),
}
Expand description

The JSON error code of an error response: what went wrong, in more detail than the HTTP status (D-097).

Variants are named like discord-api-types’ RESTJSONErrorCodes (D-098), with acronyms written as words (UnknownSku); rustdoc search also finds them by their original name and by their number. Codes added by Discord later decode as Unknown.

discord.js counterpart: RESTJSONErrorCodes.

§Examples

use djs_model::rest::ErrorCode;

let code: ErrorCode = serde_json::from_str("50013").unwrap();
assert_eq!(code, ErrorCode::MissingPermissions);
assert_eq!(code.value(), 50013);
assert_eq!(ErrorCode::from(10008), ErrorCode::UnknownMessage);
assert!(ErrorCode::from(1).is_unknown());

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

GeneralError

0: A general error, e.g. a malformed request body.

§

UnknownAccount

10001: The account was not found.

§

UnknownApplication

10002: The application was not found.

§

UnknownChannel

10003: The channel was not found.

§

UnknownGuild

10004: The guild was not found.

§

UnknownIntegration

10005: The integration was not found.

§

UnknownInvite

10006: The invite was not found.

§

UnknownMember

10007: The guild member was not found.

§

UnknownMessage

10008: The message was not found.

§

UnknownPermissionOverwrite

10009: The permission overwrite was not found.

§

UnknownProvider

10010: The provider was not found.

§

UnknownRole

10011: The role was not found.

§

UnknownToken

10012: The token was not found.

§

UnknownUser

10013: The user was not found.

§

UnknownEmoji

10014: The emoji was not found.

§

UnknownWebhook

10015: The webhook was not found.

§

UnknownWebhookService

10016: The webhook service was not found.

§

UnknownSession

10020: The session was not found.

§

UnknownAsset

10021: The asset was not found.

§

UnknownBan

10026: The ban was not found.

§

UnknownSku

10027: The SKU was not found.

§

UnknownStoreListing

10028: The store listing was not found.

§

UnknownEntitlement

10029: The entitlement was not found.

§

UnknownBuild

10030: The build was not found.

§

UnknownLobby

10031: The lobby was not found.

§

UnknownBranch

10032: The branch was not found.

§

UnknownStoreDirectoryLayout

10033: The store directory layout was not found.

§

UnknownRedistributable

10036: The redistributable was not found.

§

UnknownGiftCode

10038: The gift code was not found.

§

UnknownStream

10049: The stream was not found.

§

UnknownPremiumServerSubscribeCooldown

10050: The premium server subscription cooldown was not found.

§

UnknownGuildTemplate

10057: The guild template was not found.

§

UnknownDiscoverableServerCategory

10059: The discoverable server category was not found.

§

UnknownSticker

10060: The sticker was not found.

§

UnknownStickerPack

10061: The sticker pack was not found.

§

UnknownInteraction

10062: The interaction was not found.

§

UnknownApplicationCommand

10063: The application command was not found.

§

UnknownVoiceState

10065: The voice state was not found.

§

UnknownApplicationCommandPermissions

10066: The application command permissions was not found.

§

UnknownStageInstance

10067: The stage instance was not found.

§

UnknownGuildMemberVerificationForm

10068: The member verification form was not found.

§

UnknownGuildWelcomeScreen

10069: The welcome screen was not found.

§

UnknownGuildScheduledEvent

10070: The scheduled event was not found.

§

UnknownGuildScheduledEventUser

10071: The scheduled event user was not found.

§

UnknownTag

10087: The forum tag was not found.

§

UnknownSound

10097: The soundboard sound was not found.

§

UnknownInviteTargetUsersJob

10124: The invite exists but no job for its target users was found.

§

UnknownInviteTargetUsers

10129: The invite exists but has no target users.

§

BotsCannotUseThisEndpoint

20001: This endpoint is not available to bots.

§

OnlyBotsCanUseThisEndpoint

20002: This endpoint is only available to bots.

§

ExplicitContentCannotBeSentToTheDesiredRecipient

20009: Explicit content cannot be sent to the recipient(s).

§

NotAuthorizedToPerformThisActionOnThisApplication

20012: The current user may not perform this action on the application.

§

ThisActionRequiresAPremiumSubscription

20015: The action needs a premium subscription.

§

ActionCannotBePerformedDueToSlowmodeRateLimit

20016: The channel’s slowmode does not allow the action yet.

§

OnlyTheOwnerOfThisAccountCanPerformThisAction

20018: Only the account’s owner can perform this action.

§

AnnouncementEditLimitExceeded

20022: The message cannot be edited because of the announcement rate limits.

§

UnderMinimumAge

20024: The user is below the minimum age.

§

ChannelWriteRateLimit

20028: The channel’s write rate limit was hit.

§

ServerWriteRateLimit

20029: The server’s write rate limit was hit.

§

StageTopicServerNameServerDescriptionOrChannelNamesContainDisallowedWords

20031: The Stage topic, server name, server description or a channel name contains disallowed words.

§

GuildPremiumSubscriptionLevelTooLow

20035: The guild’s boost level is too low.

§

MaximumNumberOfGuildsReached

30001: The limit of guilds the user is in (100) was reached.

§

MaximumNumberOfFriendsReached

30002: The limit of friends (1000) was reached.

§

MaximumNumberOfPinsReachedForTheChannel

30003: The limit of pinned messages in the channel (250) was reached.

§

MaximumNumberOfRecipientsReached

30004: The limit of group DM recipients (10) was reached.

§

MaximumNumberOfGuildRolesReached

30005: The limit of roles in the guild (250) was reached.

§

MaximumNumberOfWebhooksReached

30007: The limit of webhooks in the channel (15) was reached.

§

MaximumNumberOfEmojisReached

30008: The limit of emojis in the guild was reached.

§

MaximumNumberOfReactionsReached

30010: The limit of different reactions on the message (20) was reached.

§

MaximumNumberOfGroupDmsReached

30011: The limit of group DMs (10) was reached.

§

MaximumNumberOfGuildChannelsReached

30013: The limit of channels in the guild (500) was reached.

§

MaximumNumberOfAttachmentsInAMessageReached

30015: The limit of attachments in one message (10) was reached.

§

MaximumNumberOfInvitesReached

30016: The limit of invites (1000) was reached.

§

MaximumNumberOfAnimatedEmojisReached

30018: The limit of animated emojis in the guild was reached.

§

MaximumNumberOfServerMembersReached

30019: The limit of members in the guild was reached.

§

MaximumNumberOfServerCategoriesReached

30030: The limit of server categories (5) was reached.

§

GuildAlreadyHasTemplate

30031: The guild already has a template.

§

MaximumNumberOfApplicationCommandsReached

30032: The limit of application commands was reached.

§

MaximumThreadParticipantsReached

30033: The limit of thread participants (1000) was reached.

§

MaximumDailyApplicationCommandCreatesReached

30034: The limit of application commands created per day (200) was reached.

§

MaximumNumberOfNonGuildMemberBansHasBeenExceeded

30035: The limit of bans of users who are not members was reached.

§

MaximumNumberOfBanFetchesHasBeenReached

30037: The limit of ban list fetches was reached.

§

MaximumNumberOfUncompletedGuildScheduledEventsReached

30038: The limit of scheduled events that have not ended (100) was reached.

§

MaximumNumberOfStickersReached

30039: The limit of stickers in the guild was reached.

§

MaximumNumberOfPruneRequestsHasBeenReached

30040: Too many prune requests; try again later.

§

MaximumNumberOfGuildWidgetSettingsUpdatesHasBeenReached

30042: Too many guild widget settings updates; try again later.

§

MaximumNumberOfSoundboardSoundsReached

30045: The limit of soundboard sounds was reached.

§

MaximumNumberOfEditsToMessagesOlderThanOneHourReached

30046: Too many edits to messages older than one hour; try again later.

§

MaximumNumberOfPinnedThreadsInForumHasBeenReached

30047: The limit of pinned threads in the forum channel was reached.

§

MaximumNumberOfTagsInForumHasBeenReached

30048: The limit of tags in the forum channel was reached.

§

BitrateIsTooHighForChannelOfThisType

30052: The bitrate is too high for this type of channel.

§

MaximumNumberOfPremiumEmojisReached

30056: The limit of premium (subscription) emojis (25) was reached.

§

MaximumNumberOfWebhooksPerGuildReached

30058: The limit of webhooks in the guild (1000) was reached.

§

MaximumNumberOfChannelPermissionOverwritesReached

30060: The limit of permission overwrites on the channel (1000) was reached.

§

TheChannelsForThisGuildAreTooLarge

30061: The guild’s channels are too large.

§

InviteTargetUsersLimitReached

30084: The guild’s limit of invite target users was reached.

§

Unauthorized

40001: Unauthorized: send a valid token.

§

VerifyYourAccount

40002: The account must be verified first.

§

OpeningDirectMessagesTooFast

40003: Direct messages are being opened too quickly.

§

SendMessagesHasBeenTemporarilyDisabled

40004: Sending messages is temporarily disabled.

§

RequestEntityTooLarge

40005: The request is too large; send something smaller.

§

FeatureTemporarilyDisabledServerSide

40006: This feature is temporarily disabled on Discord’s side.

§

UserBannedFromThisGuild

40007: The user is banned from this guild.

§

OnlyOneChannelCanHaveAParentIdModifiedAtATime

40009: The parent_id of only one channel can be changed at a time.

§

ConnectionHasBeenRevoked

40012: The connection was revoked.

§

OnlyConsumableSkusCanBeConsumed

40018: Only consumable SKUs can be consumed.

§

YouCanOnlyDeleteSandboxEntitlements

40019: Only test (sandbox) entitlements can be deleted.

§

TargetUserIsNotConnectedToVoice

40032: The target user is not in a voice channel.

§

ThisMessageWasAlreadyCrossposted

40033: The message was already crossposted (published).

§

ApplicationCommandWithThatNameAlreadyExists

40041: An application command with this name already exists.

§

ApplicationInteractionFailedToSend

40043: The application interaction could not be sent.

§

CannotSendAMessageInAForumChannel

40058: Messages cannot be sent in a forum channel (create a post instead).

§

InteractionHasAlreadyBeenAcknowledged

40060: The interaction was already acknowledged (responded to).

§

TagNamesMustBeUnique

40061: Forum tag names must be unique.

§

ServiceResourceIsBeingRateLimited

40062: The service resource is rate limited.

§

ThereAreNoTagsAvailableThatCanBeSetByNonModerators

40066: No forum tags are available that non-moderators can set.

§

TagRequiredToCreateAForumPostInThisChannel

40067: Creating a post in this forum channel requires a tag.

§

AnEntitlementHasAlreadyBeenGrantedForThisResource

40074: An entitlement was already granted for this resource.

§

ThisInteractionHasHitTheMaximumNumberOfFollowUpMessages

40094: The interaction already has the maximum number of follow-up messages.

§

InviteTargetUsersAlreadyBeingProcessed

40114: The invite’s target users are already being processed.

§

InviteTargetUsersFileNotProcessed

40115: The invite’s target users file was not processed yet.

§

CloudflareIsBlockingYourRequest

40333: Cloudflare blocked the request; a proper User-Agent often fixes it.

§

MissingAccess

50001: The bot has no access to the resource (e.g. it cannot see the channel).

§

InvalidAccountType

50002: The account type is not valid for this action.

§

CannotExecuteActionOnDmChannel

50003: The action is not possible in a DM channel.

§

GuildWidgetDisabled

50004: The guild’s widget is disabled.

§

CannotEditMessageAuthoredByAnotherUser

50005: Messages of other users cannot be edited.

§

CannotSendAnEmptyMessage

50006: A message cannot be empty.

§

CannotSendMessagesToThisUser

50007: The user does not accept messages from the bot (e.g. DMs are closed).

§

CannotSendMessagesInNonTextChannel

50008: Messages can only be sent in text-based channels.

§

ChannelVerificationLevelTooHighForYouToGainAccess

50009: The channel’s verification level is too high for the user.

§

OAuth2ApplicationDoesNotHaveBot

50010: The OAuth2 application has no bot.

§

OAuth2ApplicationLimitReached

50011: The limit of OAuth2 applications was reached.

§

InvalidOAuth2State

50012: The OAuth2 state is invalid.

§

MissingPermissions

50013: The bot lacks the permissions for this action.

§

InvalidToken

50014: The authentication token is invalid.

§

NoteWasTooLong

50015: The note is too long.

§

ProvidedTooFewOrTooManyMessagesToDelete

50016: Bulk deletes take between 2 and 100 messages.

§

InvalidMfaLevel

50017: The MFA level is invalid.

§

MessageCanOnlyBePinnedInTheChannelItWasSentIn

50019: A message can only be pinned in its own channel.

§

InviteCodeInvalidOrTaken

50020: The invite code is invalid or already taken.

§

CannotExecuteActionOnSystemMessage

50021: The action is not possible on a system message.

§

CannotExecuteActionOnThisChannelType

50024: The action is not possible on this type of channel.

§

InvalidOAuth2AccessToken

50025: The OAuth2 access token is invalid.

§

MissingRequiredOAuth2Scope

50026: A required OAuth2 scope is missing.

§

InvalidWebhookToken

50027: The webhook token is invalid.

§

InvalidRole

50028: The role is invalid.

§

InvalidRecipients

50033: The recipient(s) are invalid.

§

OneOfTheMessagesProvidedWasTooOldForBulkDelete

50034: A message is too old to be bulk deleted (two weeks at most).

§

InvalidFormBodyOrContentType

50035: The form body (JSON or multipart) or the Content-Type is invalid; the field errors tell which fields.

§

InviteAcceptedToGuildWithoutTheBotBeingIn

50036: An invite was accepted to a guild the application’s bot is not in.

§

InvalidActivityAction

50039: The activity action is invalid.

§

InvalidApiVersion

50041: The API version is invalid.

§

FileUploadedExceedsMaximumSize

50045: The uploaded file is larger than allowed.

§

InvalidFileUploaded

50046: The uploaded file is invalid.

§

CannotSelfRedeemThisGift

50054: The gift cannot be redeemed by its own sender.

§

InvalidGuild

50055: The guild is invalid.

§

InvalidSku

50057: The SKU is invalid.

§

InvalidRequestOrigin

50067: The request origin is invalid.

§

InvalidMessageType

50068: The message type is invalid.

§

PaymentSourceRequiredToRedeemGift

50070: Redeeming the gift requires a payment source.

§

CannotModifyASystemWebhook

50073: System webhooks cannot be modified.

§

CannotDeleteChannelRequiredForCommunityGuilds

50074: Community guilds need this channel, so it cannot be deleted.

§

CannotEditStickersWithinMessage

50080: The stickers of a message cannot be edited.

§

InvalidStickerSent

50081: The sticker is invalid.

§

InvalidActionOnArchivedThread

50083: The thread is archived, so the operation (e.g. editing a message or adding a member) is not possible.

§

InvalidThreadNotificationSettings

50084: The thread notification settings are invalid.

§

ParameterEarlierThanCreation

50085: The before value is earlier than the thread’s creation.

§

CommunityServerChannelsMustBeTextChannels

50086: Channels of community servers must be text channels.

§

TheEntityTypeOfTheEventIsDifferentFromTheEntityYouAreTryingToStartTheEventFor

50091: The event’s entity type differs from the entity it is being started for.

§

ServerNotAvailableInYourLocation

50095: The server is not available in the user’s location.

§

ServerNeedsMonetizationEnabledToPerformThisAction

50097: The server needs monetization enabled for this action.

§

ServerNeedsMoreBoostsToPerformThisAction

50101: The server needs more boosts for this action.

§

RequestBodyContainsInvalidJson

50109: The request body is not valid JSON.

§

ProvidedFileIsInvalid

50110: The file is invalid.

§

ProvidedFileTypeIsInvalid

50123: The file type is invalid.

§

ProvidedFileDurationExceedsMaximumLength

50124: The file is longer than the maximum duration (5.2 seconds).

§

OwnerCannotBePendingMember

50131: The owner cannot be a pending member.

§

OwnershipCannotBeMovedToABotUser

50132: A bot user cannot become the owner.

§

FailedToResizeAssetBelowTheMaximumSize

50138: The asset could not be resized below the maximum size (262 144).

§

CannotMixSubscriptionAndNonSubscriptionRolesForAnEmoji

50144: An emoji cannot mix subscription and non-subscription roles.

§

CannotConvertBetweenPremiumEmojiAndNormalEmoji

50145: An emoji cannot be converted between premium and normal.

§

UploadedFileNotFound

50146: The uploaded file was not found.

§

SpecifiedEmojiIsInvalid

50151: The emoji is invalid.

§

VoiceMessagesDoNotSupportAdditionalContent

50159: A voice message cannot have other content.

§

VoiceMessagesMustHaveASingleAudioAttachment

50160: A voice message needs exactly one audio attachment.

§

VoiceMessagesMustHaveSupportingMetadata

50161: A voice message needs its metadata (duration and waveform).

§

VoiceMessagesCannotBeEdited

50162: Voice messages cannot be edited.

§

CannotDeleteGuildSubscriptionIntegration

50163: The guild subscription integration cannot be deleted.

§

CannotSendVoiceEffectWhenUserIsServerMutedDeafenedOrSuppressed

50167: No voice effect can be sent while the user is server muted, deafened or suppressed.

§

YouCannotSendVoiceMessagesInThisChannel

50173: Voice messages cannot be sent in this channel.

§

TheUserAccountMustFirstBeVerified

50178: The user account must be verified first.

§

ProvidedFileDoesNotHaveAValidDuration

50192: The file has no valid duration.

§

CannotSendMessagesToThisUserDueToHavingNoMutualGuilds

50278: The user shares no guild with the bot, so it cannot message them.

§

YouDoNotHavePermissionToSendThisSticker

50600: The bot may not send this sticker.

§

TwoFactorAuthenticationIsRequired

60003: The operation requires two-factor authentication.

§

NoUsersWithDiscordTagExist

80004: No user with this Discord tag exists.

§

ReactionWasBlocked

90001: The reaction was blocked.

§

UserCannotUseBurstReactions

90002: The user cannot use super (burst) reactions.

§

IndexNotYetAvailable

110000: The index is not available yet; try again later.

§

ApplicationNotYetAvailable

110001: The application is not available yet; try again later.

§

ApiResourceOverloaded

130000: The API resource is overloaded; try again a little later.

§

TheStageIsAlreadyOpen

150006: The Stage is already open.

§

CannotReplyWithoutPermissionToReadMessageHistory

160002: Replying requires the permission to read the message history.

§

ThreadAlreadyCreatedForMessage

160004: This message already has a thread.

§

ThreadLocked

160005: The thread is locked.

§

MaximumActiveThreads

160006: The limit of active threads was reached.

§

MaximumActiveAnnouncementThreads

160007: The limit of active announcement threads was reached.

§

CannotReferenceAMessageWithoutPermissionToReadMessageHistory

160009: Referencing a message requires the permission to read the message history.

§

NsfwChannelMessageReferenceNotAllowed

160010: Messages of NSFW channels cannot be referenced here.

§

CannotForwardMessageWithUnreadableContent

160014: A message whose content the user cannot read cannot be forwarded.

§

InvalidJsonForUploadedLottieFile

170001: The uploaded Lottie file is not valid JSON.

§

UploadedLottiesCannotContainRasterizedImages

170002: An uploaded Lottie cannot contain raster images (e.g. PNG or JPEG).

§

StickerMaximumFramerateExceeded

170003: The sticker’s frame rate is above the maximum.

§

StickerFrameCountExceedsMaximumOf1000Frames

170004: The sticker has more than 1000 frames.

§

LottieAnimationMaximumDimensionsExceeded

170005: The Lottie animation is larger than the maximum dimensions.

§

StickerFramerateIsTooSmallOrTooLarge

170006: The sticker’s frame rate is too low or too high.

§

StickerAnimationDurationExceedsMaximumOf5Seconds

170007: The sticker’s animation is longer than 5 seconds.

§

CannotUpdateAFinishedEvent

180000: A finished event cannot be updated.

§

FailedToCreateStageNeededForStageEvent

180002: The Stage for the Stage event could not be created.

§

MessageWasBlockedByAutomaticModeration

200000: AutoMod blocked the message.

§

TitleWasBlockedByAutomaticModeration

200001: AutoMod blocked the title.

§

WebhooksPostedToForumChannelsMustHaveAThreadNameOrThreadId

220001: A webhook message in a forum channel needs a thread_name or a thread_id.

§

WebhooksPostedToForumChannelsCannotHaveBothAThreadNameAndThreadId

220002: A webhook message in a forum channel cannot have both a thread_name and a thread_id.

§

WebhooksCanOnlyCreateThreadsInForumChannels

220003: Webhooks can only create threads in forum channels.

§

WebhookServicesCannotBeUsedInForumChannels

220004: Webhook services cannot be used in forum channels.

§

MessageBlockedByHarmfulLinksFilter

240000: The harmful links filter blocked the message.

§

AccessToJoiningNewServersHasBeenLimitedForTheUser

340015: The user is limited from joining new servers.

§

CannotEnableOnboardingRequirementsAreNotMet

350000: Onboarding cannot be enabled: its requirements are not met.

§

CannotUpdateOnboardingWhileBelowRequirements

350001: Onboarding cannot be updated while it is below the requirements.

§

AccessToFileUploadsHasBeenLimitedForThisGuild

400001: File uploads are limited for this guild.

§

FailedToBanUsers

500000: The users could not be banned.

§

PollVotingBlocked

520000: Voting in the poll is blocked.

§

PollExpired

520001: The poll has expired.

§

InvalidChannelTypeForPollCreation

520002: Polls cannot be created in this type of channel.

§

CannotEditAPollMessage

520003: A poll message cannot be edited.

§

CannotUseAnEmojiIncludedWithThePoll

520004: An emoji that is part of the poll cannot be used.

§

CannotExpireANonPollMessage

520006: Only poll messages can be expired.

§

ProvisionalAccountsPermissionNotGranted

530000: The application may not use provisional accounts.

§

IdTokenJwtExpired

530001: The ID token (JWT) has expired; get a new one from the identity provider.

§

IdTokenJwtIssuerMismatch

530002: The ID token’s issuer does not match the configured one.

§

IdTokenJwtAudienceMismatch

530003: The ID token’s audience does not match the OIDC configuration; fix the configuration or use a token issued to the application.

§

IdTokenJwtIssuedTooLongAgo

530004: The ID token was issued more than a week ago; get a new one from the identity provider.

§

FailedToGenerateUniqueUsername

530006: No unique username could be generated in time; retrying usually works.

§

InvalidClientSecret

530007: The client secret is invalid; check it or create a new one.

§

Unknown(u32)

A value that this version of the library does not know about.

Discord may add new values at any time. They are preserved here so that no information is lost and deserialization never fails because of them. Prefer ErrorCode::from over constructing this variant directly.

Implementations§

Source§

impl ErrorCode

Source

pub const fn value(self) -> u32

Returns the raw integer value Discord uses for this variant.

discord.js counterpart: the enum’s numeric value in discord-api-types.

Source

pub const fn is_unknown(self) -> bool

Returns true if this is a value the library does not know about.

discord.js counterpart: none (discord.js passes unknown numbers through).

Source

pub const fn from_value(value: u32) -> Self

Converts a raw value into the matching variant, or Self::Unknown.

discord.js counterpart: none (discord.js passes unknown numbers through).

Trait Implementations§

Source§

impl Clone for ErrorCode

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ErrorCode

Source§

impl Debug for ErrorCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ErrorCode

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ErrorCode

Source§

impl From<ErrorCode> for u32

Source§

fn from(value: ErrorCode) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for ErrorCode

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl Hash for ErrorCode

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for ErrorCode

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for ErrorCode

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for ErrorCode

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for ErrorCode

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.