aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-09 20:16:39 -0800
committerAustin Hellyer <[email protected]>2016-11-09 20:16:39 -0800
commit71b88539afd56dffbd9d1bf098830a73bb3581f1 (patch)
treec8e31be64656a04b79eb4e908cc9cf1659d98d0f /src
parentMap op codes via a macro (diff)
downloadserenity-71b88539afd56dffbd9d1bf098830a73bb3581f1.tar.xz
serenity-71b88539afd56dffbd9d1bf098830a73bb3581f1.zip
Add REST error code enum
Diffstat (limited to 'src')
-rw-r--r--src/constants.rs87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/constants.rs b/src/constants.rs
index 785ee59..c16c11c 100644
--- a/src/constants.rs
+++ b/src/constants.rs
@@ -11,6 +11,93 @@ pub const GATEWAY_VERSION: u8 = 6;
pub const USER_AGENT: &'static str = concat!("DiscordBot (https://github.com/zeyla/serenity, ", env!("CARGO_PKG_VERSION"), ")");
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
+pub enum ErrorCode {
+ BotsCannotUse,
+ CannotSendEmptyMessage,
+ CannotSendMessagesInVoice,
+ CannotSendMessagesToUser,
+ ChannelVerificationTooHigh,
+ EditByOtherAuthor,
+ EmbedDisabled,
+ InvalidAccountType,
+ InvalidAuthToken,
+ InvalidBulkDeleteCount,
+ InvalidDMChannelAction,
+ InvalidOauthState,
+ InvalidPinChannel,
+ MaxFriendsReached,
+ MaxGuildsReached,
+ MaxPinsReached,
+ MaxRolesReached,
+ MissingAccess,
+ MissingPermissions,
+ NoteTooLong,
+ Oauth2ApplicationLacksBot,
+ Oauth2ApplicationLimitReached,
+ OnlyBotsCanUse,
+ ReactionBlocked,
+ TooManyReactions,
+ Unauthorized,
+ UnknownAccount,
+ UnknownApplication,
+ UnknownChannel,
+ UnknownGuild,
+ UnknownEmoji,
+ UnknownIntegration,
+ UnknownInvite,
+ UnknownMember,
+ UnknownMessage,
+ UnknownOverwrite,
+ UnknownProvider,
+ UnknownRole,
+ UnknownToken,
+ UnknownUser,
+}
+
+map_nums! { ErrorCode;
+ BotsCannotUse 20001,
+ CannotSendEmptyMessage 50006,
+ CannotSendMessagesInVoice 50008,
+ CannotSendMessagesToUser 50007,
+ ChannelVerificationTooHigh 50009,
+ EditByOtherAuthor 50005,
+ EmbedDisabled 50004,
+ InvalidAccountType 50002,
+ InvalidAuthToken 50014,
+ InvalidBulkDeleteCount 50016,
+ InvalidDMChannelAction 50003,
+ InvalidOauthState 50012,
+ InvalidPinChannel 50019,
+ MaxFriendsReached 30002,
+ MaxGuildsReached 30001,
+ MaxPinsReached 30003,
+ MaxRolesReached 30005,
+ MissingAccess 50001,
+ MissingPermissions 500013,
+ NoteTooLong 50015,
+ Oauth2ApplicationLacksBot 50010,
+ Oauth2ApplicationLimitReached 50011,
+ OnlyBotsCanUse 20002,
+ ReactionBlocked 90001,
+ TooManyReactions 30010,
+ Unauthorized 40001,
+ UnknownAccount 10001,
+ UnknownApplication 10002,
+ UnknownChannel 10003,
+ UnknownEmoji 10014,
+ UnknownGuild 10004,
+ UnknownIntegration 10005,
+ UnknownInvite 10006,
+ UnknownMember 10007,
+ UnknownMessage 10008,
+ UnknownOverwrite 10009,
+ UnknownProvider 10010,
+ UnknownRole 10011,
+ UnknownToken 10012,
+ UnknownUser 10013,
+}
+
+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum OpCode {
Event,
Heartbeat,