Convert more constants to absolute values

See 843c765ae3 for reasoning.
This commit is contained in:
Carson Hoffman 2021-05-29 17:55:43 -04:00
parent f36553e31f
commit f5bb723db8
No known key found for this signature in database
GPG key ID: 05B660CB452C657F
5 changed files with 90 additions and 103 deletions

View file

@ -28,15 +28,15 @@ type ApplicationCommandOptionType uint8
// Application command option types. // Application command option types.
const ( const (
ApplicationCommandOptionSubCommand = ApplicationCommandOptionType(iota + 1) ApplicationCommandOptionSubCommand ApplicationCommandOptionType = 1
ApplicationCommandOptionSubCommandGroup ApplicationCommandOptionSubCommandGroup ApplicationCommandOptionType = 2
ApplicationCommandOptionString ApplicationCommandOptionString ApplicationCommandOptionType = 3
ApplicationCommandOptionInteger ApplicationCommandOptionInteger ApplicationCommandOptionType = 4
ApplicationCommandOptionBoolean ApplicationCommandOptionBoolean ApplicationCommandOptionType = 5
ApplicationCommandOptionUser ApplicationCommandOptionUser ApplicationCommandOptionType = 6
ApplicationCommandOptionChannel ApplicationCommandOptionChannel ApplicationCommandOptionType = 7
ApplicationCommandOptionRole ApplicationCommandOptionRole ApplicationCommandOptionType = 8
ApplicationCommandOptionMentionable ApplicationCommandOptionMentionable ApplicationCommandOptionType = 9
) )
// ApplicationCommandOption represents an option/subcommand/subcommands group. // ApplicationCommandOption represents an option/subcommand/subcommands group.
@ -63,8 +63,8 @@ type InteractionType uint8
// Interaction types // Interaction types
const ( const (
InteractionPing = InteractionType(iota + 1) InteractionPing InteractionType = 1
InteractionApplicationCommand InteractionApplicationCommand InteractionType = 2
) )
// Interaction represents an interaction event created via a slash command. // Interaction represents an interaction event created via a slash command.

View file

@ -21,23 +21,23 @@ type MessageType int
// Block contains the valid known MessageType values // Block contains the valid known MessageType values
const ( const (
MessageTypeDefault MessageType = iota MessageTypeDefault MessageType = 0
MessageTypeRecipientAdd MessageTypeRecipientAdd MessageType = 1
MessageTypeRecipientRemove MessageTypeRecipientRemove MessageType = 2
MessageTypeCall MessageTypeCall MessageType = 3
MessageTypeChannelNameChange MessageTypeChannelNameChange MessageType = 4
MessageTypeChannelIconChange MessageTypeChannelIconChange MessageType = 5
MessageTypeChannelPinnedMessage MessageTypeChannelPinnedMessage MessageType = 6
MessageTypeGuildMemberJoin MessageTypeGuildMemberJoin MessageType = 7
MessageTypeUserPremiumGuildSubscription MessageTypeUserPremiumGuildSubscription MessageType = 8
MessageTypeUserPremiumGuildSubscriptionTierOne MessageTypeUserPremiumGuildSubscriptionTierOne MessageType = 9
MessageTypeUserPremiumGuildSubscriptionTierTwo MessageTypeUserPremiumGuildSubscriptionTierTwo MessageType = 10
MessageTypeUserPremiumGuildSubscriptionTierThree MessageTypeUserPremiumGuildSubscriptionTierThree MessageType = 11
MessageTypeChannelFollowAdd MessageTypeChannelFollowAdd MessageType = 12
MessageTypeGuildDiscoveryDisqualified = iota + 1 MessageTypeGuildDiscoveryDisqualified MessageType = 14
MessageTypeGuildDiscoveryRequalified MessageTypeGuildDiscoveryRequalified MessageType = 15
MessageTypeReply = iota + 4 MessageTypeReply MessageType = 19
MessageTypeApplicationCommand MessageTypeApplicationCommand MessageType = 20
) )
// A Message stores all data related to a specific Discord message. // A Message stores all data related to a specific Discord message.
@ -149,11 +149,11 @@ type MessageFlags int
// Valid MessageFlags values // Valid MessageFlags values
const ( const (
MessageFlagsCrossPosted MessageFlags = 1 << iota MessageFlagsCrossPosted MessageFlags = 1 << 0
MessageFlagsIsCrossPosted MessageFlagsIsCrossPosted MessageFlags = 1 << 1
MessageFlagsSupressEmbeds MessageFlagsSupressEmbeds MessageFlags = 1 << 2
MessageFlagsSourceMessageDeleted MessageFlagsSourceMessageDeleted MessageFlags = 1 << 3
MessageFlagsUrgent MessageFlagsUrgent MessageFlags = 1 << 4
) )
// File stores info about files you e.g. send in messages. // File stores info about files you e.g. send in messages.
@ -357,23 +357,10 @@ type MessageActivityType int
// Constants for the different types of Message Activity // Constants for the different types of Message Activity
const ( const (
MessageActivityTypeJoin MessageActivityType = iota + 1 MessageActivityTypeJoin MessageActivityType = 1
MessageActivityTypeSpectate MessageActivityTypeSpectate MessageActivityType = 2
MessageActivityTypeListen MessageActivityTypeListen MessageActivityType = 3
MessageActivityTypeJoinRequest MessageActivityTypeJoinRequest MessageActivityType = 5
)
// MessageFlag describes an extra feature of the message
type MessageFlag int
// Constants for the different bit offsets of Message Flags
const (
// This message has been published to subscribed channels (via Channel Following)
MessageFlagCrossposted MessageFlag = 1 << iota
// This message originated from a message in another channel (via Channel Following)
MessageFlagIsCrosspost
// Do not include any embeds when serializing this message
MessageFlagSuppressEmbeds
) )
// MessageApplication is sent with Rich Presence-related chat embeds // MessageApplication is sent with Rich Presence-related chat embeds

View file

@ -18,8 +18,8 @@ type MembershipState int
// Constants for the different stages of the MembershipState // Constants for the different stages of the MembershipState
const ( const (
MembershipStateInvited MembershipState = iota + 1 MembershipStateInvited MembershipState = 1
MembershipStateAccepted MembershipStateAccepted MembershipState = 2
) )
// A TeamMember struct stores values for a single Team Member, extending the normal User data - note that the user field is partial // A TeamMember struct stores values for a single Team Member, extending the normal User data - note that the user field is partial

View file

@ -159,8 +159,8 @@ type ExpireBehavior int
// Block of valid ExpireBehaviors // Block of valid ExpireBehaviors
const ( const (
ExpireBehaviorRemoveRole ExpireBehavior = iota ExpireBehaviorRemoveRole ExpireBehavior = 0
ExpireBehaviorKick ExpireBehaviorKick ExpireBehavior = 1
) )
// IntegrationAccount is integration account information // IntegrationAccount is integration account information
@ -218,7 +218,7 @@ type TargetUserType int
// Block contains known TargetUserType values // Block contains known TargetUserType values
const ( const (
TargetUserTypeStream TargetUserType = iota TargetUserTypeStream TargetUserType = 1
) )
// ChannelType is the type of a Channel // ChannelType is the type of a Channel
@ -226,13 +226,13 @@ type ChannelType int
// Block contains known ChannelType values // Block contains known ChannelType values
const ( const (
ChannelTypeGuildText ChannelType = iota ChannelTypeGuildText ChannelType = 0
ChannelTypeDM ChannelTypeDM ChannelType = 1
ChannelTypeGuildVoice ChannelTypeGuildVoice ChannelType = 2
ChannelTypeGroupDM ChannelTypeGroupDM ChannelType = 3
ChannelTypeGuildCategory ChannelTypeGuildCategory ChannelType = 4
ChannelTypeGuildNews ChannelTypeGuildNews ChannelType = 5
ChannelTypeGuildStore ChannelTypeGuildStore ChannelType = 6
) )
// A Channel holds all data related to an individual Discord channel. // A Channel holds all data related to an individual Discord channel.
@ -330,8 +330,8 @@ type PermissionOverwriteType int
// The possible permission overwrite types. // The possible permission overwrite types.
const ( const (
PermissionOverwriteTypeRole PermissionOverwriteType = iota PermissionOverwriteTypeRole PermissionOverwriteType = 0
PermissionOverwriteTypeMember PermissionOverwriteTypeMember PermissionOverwriteType = 1
) )
// A PermissionOverwrite holds permission overwrite data for a Channel // A PermissionOverwrite holds permission overwrite data for a Channel
@ -388,11 +388,11 @@ type VerificationLevel int
// Constants for VerificationLevel levels from 0 to 4 inclusive // Constants for VerificationLevel levels from 0 to 4 inclusive
const ( const (
VerificationLevelNone VerificationLevel = iota VerificationLevelNone VerificationLevel = 0
VerificationLevelLow VerificationLevelLow VerificationLevel = 1
VerificationLevelMedium VerificationLevelMedium VerificationLevel = 2
VerificationLevelHigh VerificationLevelHigh VerificationLevel = 3
VerificationLevelVeryHigh VerificationLevelVeryHigh VerificationLevel = 4
) )
// ExplicitContentFilterLevel type definition // ExplicitContentFilterLevel type definition
@ -400,9 +400,9 @@ type ExplicitContentFilterLevel int
// Constants for ExplicitContentFilterLevel levels from 0 to 2 inclusive // Constants for ExplicitContentFilterLevel levels from 0 to 2 inclusive
const ( const (
ExplicitContentFilterDisabled ExplicitContentFilterLevel = iota ExplicitContentFilterDisabled ExplicitContentFilterLevel = 0
ExplicitContentFilterMembersWithoutRoles ExplicitContentFilterMembersWithoutRoles ExplicitContentFilterLevel = 1
ExplicitContentFilterAllMembers ExplicitContentFilterAllMembers ExplicitContentFilterLevel = 2
) )
// MfaLevel type definition // MfaLevel type definition
@ -410,8 +410,8 @@ type MfaLevel int
// Constants for MfaLevel levels from 0 to 1 inclusive // Constants for MfaLevel levels from 0 to 1 inclusive
const ( const (
MfaLevelNone MfaLevel = iota MfaLevelNone MfaLevel = 0
MfaLevelElevated MfaLevelElevated MfaLevel = 1
) )
// PremiumTier type definition // PremiumTier type definition
@ -419,10 +419,10 @@ type PremiumTier int
// Constants for PremiumTier levels from 0 to 3 inclusive // Constants for PremiumTier levels from 0 to 3 inclusive
const ( const (
PremiumTierNone PremiumTier = iota PremiumTierNone PremiumTier = 0
PremiumTier1 PremiumTier1 PremiumTier = 1
PremiumTier2 PremiumTier2 PremiumTier = 2
PremiumTier3 PremiumTier3 PremiumTier = 3
) )
// A Guild holds all data related to a specific Discord Guild. Guilds are also // A Guild holds all data related to a specific Discord Guild. Guilds are also
@ -618,8 +618,8 @@ type MessageNotifications int
// Block containing known MessageNotifications values // Block containing known MessageNotifications values
const ( const (
MessageNotificationsAllMessages MessageNotifications = iota MessageNotificationsAllMessages MessageNotifications = 0
MessageNotificationsOnlyMentions MessageNotificationsOnlyMentions MessageNotifications = 1
) )
// SystemChannelFlag is the type of flags in the system channel (see SystemChannelFlag* consts) // SystemChannelFlag is the type of flags in the system channel (see SystemChannelFlag* consts)
@ -628,8 +628,8 @@ type SystemChannelFlag int
// Block containing known SystemChannelFlag values // Block containing known SystemChannelFlag values
const ( const (
SystemChannelFlagsSuppressJoin SystemChannelFlag = 1 << iota SystemChannelFlagsSuppressJoin SystemChannelFlag = 1 << 0
SystemChannelFlagsSuppressPremium SystemChannelFlagsSuppressPremium SystemChannelFlag = 1 << 1
) )
// IconURL returns a URL to the guild's icon. // IconURL returns a URL to the guild's icon.
@ -1199,11 +1199,11 @@ type ActivityType int
// Valid ActivityType values // Valid ActivityType values
const ( const (
ActivityTypeGame ActivityType = iota ActivityTypeGame ActivityType = 0
ActivityTypeStreaming ActivityTypeStreaming ActivityType = 1
ActivityTypeListening ActivityTypeListening ActivityType = 2
// ActivityTypeWatching // not valid in this use case? // ActivityTypeWatching // not valid in this use case?
ActivityTypeCustom = 4 ActivityTypeCustom ActivityType = 4
) )
// Identify is sent during initial handshake with the discord gateway. // Identify is sent during initial handshake with the discord gateway.
@ -1372,21 +1372,21 @@ type Intent int
// Constants for the different bit offsets of intents // Constants for the different bit offsets of intents
const ( const (
IntentsGuilds Intent = 1 << iota IntentsGuilds Intent = 1 << 0
IntentsGuildMembers IntentsGuildMembers Intent = 1 << 1
IntentsGuildBans IntentsGuildBans Intent = 1 << 2
IntentsGuildEmojis IntentsGuildEmojis Intent = 1 << 3
IntentsGuildIntegrations IntentsGuildIntegrations Intent = 1 << 4
IntentsGuildWebhooks IntentsGuildWebhooks Intent = 1 << 5
IntentsGuildInvites IntentsGuildInvites Intent = 1 << 6
IntentsGuildVoiceStates IntentsGuildVoiceStates Intent = 1 << 7
IntentsGuildPresences IntentsGuildPresences Intent = 1 << 8
IntentsGuildMessages IntentsGuildMessages Intent = 1 << 9
IntentsGuildMessageReactions IntentsGuildMessageReactions Intent = 1 << 10
IntentsGuildMessageTyping IntentsGuildMessageTyping Intent = 1 << 11
IntentsDirectMessages IntentsDirectMessages Intent = 1 << 12
IntentsDirectMessageReactions IntentsDirectMessageReactions Intent = 1 << 13
IntentsDirectMessageTyping IntentsDirectMessageTyping Intent = 1 << 14
IntentsAllWithoutPrivileged = IntentsGuilds | IntentsAllWithoutPrivileged = IntentsGuilds |
IntentsGuildBans | IntentsGuildBans |

View file

@ -21,8 +21,8 @@ type WebhookType int
// Valid WebhookType values // Valid WebhookType values
const ( const (
WebhookTypeIncoming WebhookType = iota WebhookTypeIncoming WebhookType = 1
WebhookTypeChannelFollower WebhookTypeChannelFollower WebhookType = 2
) )
// WebhookParams is a struct for webhook params, used in the WebhookExecute command. // WebhookParams is a struct for webhook params, used in the WebhookExecute command.