Convert more constants to absolute values
See 843c765ae3
for reasoning.
This commit is contained in:
parent
f36553e31f
commit
f5bb723db8
5 changed files with 90 additions and 103 deletions
|
@ -28,15 +28,15 @@ type ApplicationCommandOptionType uint8
|
|||
|
||||
// Application command option types.
|
||||
const (
|
||||
ApplicationCommandOptionSubCommand = ApplicationCommandOptionType(iota + 1)
|
||||
ApplicationCommandOptionSubCommandGroup
|
||||
ApplicationCommandOptionString
|
||||
ApplicationCommandOptionInteger
|
||||
ApplicationCommandOptionBoolean
|
||||
ApplicationCommandOptionUser
|
||||
ApplicationCommandOptionChannel
|
||||
ApplicationCommandOptionRole
|
||||
ApplicationCommandOptionMentionable
|
||||
ApplicationCommandOptionSubCommand ApplicationCommandOptionType = 1
|
||||
ApplicationCommandOptionSubCommandGroup ApplicationCommandOptionType = 2
|
||||
ApplicationCommandOptionString ApplicationCommandOptionType = 3
|
||||
ApplicationCommandOptionInteger ApplicationCommandOptionType = 4
|
||||
ApplicationCommandOptionBoolean ApplicationCommandOptionType = 5
|
||||
ApplicationCommandOptionUser ApplicationCommandOptionType = 6
|
||||
ApplicationCommandOptionChannel ApplicationCommandOptionType = 7
|
||||
ApplicationCommandOptionRole ApplicationCommandOptionType = 8
|
||||
ApplicationCommandOptionMentionable ApplicationCommandOptionType = 9
|
||||
)
|
||||
|
||||
// ApplicationCommandOption represents an option/subcommand/subcommands group.
|
||||
|
@ -63,8 +63,8 @@ type InteractionType uint8
|
|||
|
||||
// Interaction types
|
||||
const (
|
||||
InteractionPing = InteractionType(iota + 1)
|
||||
InteractionApplicationCommand
|
||||
InteractionPing InteractionType = 1
|
||||
InteractionApplicationCommand InteractionType = 2
|
||||
)
|
||||
|
||||
// Interaction represents an interaction event created via a slash command.
|
||||
|
|
65
message.go
65
message.go
|
@ -21,23 +21,23 @@ type MessageType int
|
|||
|
||||
// Block contains the valid known MessageType values
|
||||
const (
|
||||
MessageTypeDefault MessageType = iota
|
||||
MessageTypeRecipientAdd
|
||||
MessageTypeRecipientRemove
|
||||
MessageTypeCall
|
||||
MessageTypeChannelNameChange
|
||||
MessageTypeChannelIconChange
|
||||
MessageTypeChannelPinnedMessage
|
||||
MessageTypeGuildMemberJoin
|
||||
MessageTypeUserPremiumGuildSubscription
|
||||
MessageTypeUserPremiumGuildSubscriptionTierOne
|
||||
MessageTypeUserPremiumGuildSubscriptionTierTwo
|
||||
MessageTypeUserPremiumGuildSubscriptionTierThree
|
||||
MessageTypeChannelFollowAdd
|
||||
MessageTypeGuildDiscoveryDisqualified = iota + 1
|
||||
MessageTypeGuildDiscoveryRequalified
|
||||
MessageTypeReply = iota + 4
|
||||
MessageTypeApplicationCommand
|
||||
MessageTypeDefault MessageType = 0
|
||||
MessageTypeRecipientAdd MessageType = 1
|
||||
MessageTypeRecipientRemove MessageType = 2
|
||||
MessageTypeCall MessageType = 3
|
||||
MessageTypeChannelNameChange MessageType = 4
|
||||
MessageTypeChannelIconChange MessageType = 5
|
||||
MessageTypeChannelPinnedMessage MessageType = 6
|
||||
MessageTypeGuildMemberJoin MessageType = 7
|
||||
MessageTypeUserPremiumGuildSubscription MessageType = 8
|
||||
MessageTypeUserPremiumGuildSubscriptionTierOne MessageType = 9
|
||||
MessageTypeUserPremiumGuildSubscriptionTierTwo MessageType = 10
|
||||
MessageTypeUserPremiumGuildSubscriptionTierThree MessageType = 11
|
||||
MessageTypeChannelFollowAdd MessageType = 12
|
||||
MessageTypeGuildDiscoveryDisqualified MessageType = 14
|
||||
MessageTypeGuildDiscoveryRequalified MessageType = 15
|
||||
MessageTypeReply MessageType = 19
|
||||
MessageTypeApplicationCommand MessageType = 20
|
||||
)
|
||||
|
||||
// A Message stores all data related to a specific Discord message.
|
||||
|
@ -149,11 +149,11 @@ type MessageFlags int
|
|||
|
||||
// Valid MessageFlags values
|
||||
const (
|
||||
MessageFlagsCrossPosted MessageFlags = 1 << iota
|
||||
MessageFlagsIsCrossPosted
|
||||
MessageFlagsSupressEmbeds
|
||||
MessageFlagsSourceMessageDeleted
|
||||
MessageFlagsUrgent
|
||||
MessageFlagsCrossPosted MessageFlags = 1 << 0
|
||||
MessageFlagsIsCrossPosted MessageFlags = 1 << 1
|
||||
MessageFlagsSupressEmbeds MessageFlags = 1 << 2
|
||||
MessageFlagsSourceMessageDeleted MessageFlags = 1 << 3
|
||||
MessageFlagsUrgent MessageFlags = 1 << 4
|
||||
)
|
||||
|
||||
// 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
|
||||
const (
|
||||
MessageActivityTypeJoin MessageActivityType = iota + 1
|
||||
MessageActivityTypeSpectate
|
||||
MessageActivityTypeListen
|
||||
MessageActivityTypeJoinRequest
|
||||
)
|
||||
|
||||
// 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
|
||||
MessageActivityTypeJoin MessageActivityType = 1
|
||||
MessageActivityTypeSpectate MessageActivityType = 2
|
||||
MessageActivityTypeListen MessageActivityType = 3
|
||||
MessageActivityTypeJoinRequest MessageActivityType = 5
|
||||
)
|
||||
|
||||
// MessageApplication is sent with Rich Presence-related chat embeds
|
||||
|
|
|
@ -18,8 +18,8 @@ type MembershipState int
|
|||
|
||||
// Constants for the different stages of the MembershipState
|
||||
const (
|
||||
MembershipStateInvited MembershipState = iota + 1
|
||||
MembershipStateAccepted
|
||||
MembershipStateInvited MembershipState = 1
|
||||
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
|
||||
|
|
98
structs.go
98
structs.go
|
@ -159,8 +159,8 @@ type ExpireBehavior int
|
|||
|
||||
// Block of valid ExpireBehaviors
|
||||
const (
|
||||
ExpireBehaviorRemoveRole ExpireBehavior = iota
|
||||
ExpireBehaviorKick
|
||||
ExpireBehaviorRemoveRole ExpireBehavior = 0
|
||||
ExpireBehaviorKick ExpireBehavior = 1
|
||||
)
|
||||
|
||||
// IntegrationAccount is integration account information
|
||||
|
@ -218,7 +218,7 @@ type TargetUserType int
|
|||
|
||||
// Block contains known TargetUserType values
|
||||
const (
|
||||
TargetUserTypeStream TargetUserType = iota
|
||||
TargetUserTypeStream TargetUserType = 1
|
||||
)
|
||||
|
||||
// ChannelType is the type of a Channel
|
||||
|
@ -226,13 +226,13 @@ type ChannelType int
|
|||
|
||||
// Block contains known ChannelType values
|
||||
const (
|
||||
ChannelTypeGuildText ChannelType = iota
|
||||
ChannelTypeDM
|
||||
ChannelTypeGuildVoice
|
||||
ChannelTypeGroupDM
|
||||
ChannelTypeGuildCategory
|
||||
ChannelTypeGuildNews
|
||||
ChannelTypeGuildStore
|
||||
ChannelTypeGuildText ChannelType = 0
|
||||
ChannelTypeDM ChannelType = 1
|
||||
ChannelTypeGuildVoice ChannelType = 2
|
||||
ChannelTypeGroupDM ChannelType = 3
|
||||
ChannelTypeGuildCategory ChannelType = 4
|
||||
ChannelTypeGuildNews ChannelType = 5
|
||||
ChannelTypeGuildStore ChannelType = 6
|
||||
)
|
||||
|
||||
// A Channel holds all data related to an individual Discord channel.
|
||||
|
@ -330,8 +330,8 @@ type PermissionOverwriteType int
|
|||
|
||||
// The possible permission overwrite types.
|
||||
const (
|
||||
PermissionOverwriteTypeRole PermissionOverwriteType = iota
|
||||
PermissionOverwriteTypeMember
|
||||
PermissionOverwriteTypeRole PermissionOverwriteType = 0
|
||||
PermissionOverwriteTypeMember PermissionOverwriteType = 1
|
||||
)
|
||||
|
||||
// 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
|
||||
const (
|
||||
VerificationLevelNone VerificationLevel = iota
|
||||
VerificationLevelLow
|
||||
VerificationLevelMedium
|
||||
VerificationLevelHigh
|
||||
VerificationLevelVeryHigh
|
||||
VerificationLevelNone VerificationLevel = 0
|
||||
VerificationLevelLow VerificationLevel = 1
|
||||
VerificationLevelMedium VerificationLevel = 2
|
||||
VerificationLevelHigh VerificationLevel = 3
|
||||
VerificationLevelVeryHigh VerificationLevel = 4
|
||||
)
|
||||
|
||||
// ExplicitContentFilterLevel type definition
|
||||
|
@ -400,9 +400,9 @@ type ExplicitContentFilterLevel int
|
|||
|
||||
// Constants for ExplicitContentFilterLevel levels from 0 to 2 inclusive
|
||||
const (
|
||||
ExplicitContentFilterDisabled ExplicitContentFilterLevel = iota
|
||||
ExplicitContentFilterMembersWithoutRoles
|
||||
ExplicitContentFilterAllMembers
|
||||
ExplicitContentFilterDisabled ExplicitContentFilterLevel = 0
|
||||
ExplicitContentFilterMembersWithoutRoles ExplicitContentFilterLevel = 1
|
||||
ExplicitContentFilterAllMembers ExplicitContentFilterLevel = 2
|
||||
)
|
||||
|
||||
// MfaLevel type definition
|
||||
|
@ -410,8 +410,8 @@ type MfaLevel int
|
|||
|
||||
// Constants for MfaLevel levels from 0 to 1 inclusive
|
||||
const (
|
||||
MfaLevelNone MfaLevel = iota
|
||||
MfaLevelElevated
|
||||
MfaLevelNone MfaLevel = 0
|
||||
MfaLevelElevated MfaLevel = 1
|
||||
)
|
||||
|
||||
// PremiumTier type definition
|
||||
|
@ -419,10 +419,10 @@ type PremiumTier int
|
|||
|
||||
// Constants for PremiumTier levels from 0 to 3 inclusive
|
||||
const (
|
||||
PremiumTierNone PremiumTier = iota
|
||||
PremiumTier1
|
||||
PremiumTier2
|
||||
PremiumTier3
|
||||
PremiumTierNone PremiumTier = 0
|
||||
PremiumTier1 PremiumTier = 1
|
||||
PremiumTier2 PremiumTier = 2
|
||||
PremiumTier3 PremiumTier = 3
|
||||
)
|
||||
|
||||
// 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
|
||||
const (
|
||||
MessageNotificationsAllMessages MessageNotifications = iota
|
||||
MessageNotificationsOnlyMentions
|
||||
MessageNotificationsAllMessages MessageNotifications = 0
|
||||
MessageNotificationsOnlyMentions MessageNotifications = 1
|
||||
)
|
||||
|
||||
// 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
|
||||
const (
|
||||
SystemChannelFlagsSuppressJoin SystemChannelFlag = 1 << iota
|
||||
SystemChannelFlagsSuppressPremium
|
||||
SystemChannelFlagsSuppressJoin SystemChannelFlag = 1 << 0
|
||||
SystemChannelFlagsSuppressPremium SystemChannelFlag = 1 << 1
|
||||
)
|
||||
|
||||
// IconURL returns a URL to the guild's icon.
|
||||
|
@ -1199,11 +1199,11 @@ type ActivityType int
|
|||
|
||||
// Valid ActivityType values
|
||||
const (
|
||||
ActivityTypeGame ActivityType = iota
|
||||
ActivityTypeStreaming
|
||||
ActivityTypeListening
|
||||
ActivityTypeGame ActivityType = 0
|
||||
ActivityTypeStreaming ActivityType = 1
|
||||
ActivityTypeListening ActivityType = 2
|
||||
// ActivityTypeWatching // not valid in this use case?
|
||||
ActivityTypeCustom = 4
|
||||
ActivityTypeCustom ActivityType = 4
|
||||
)
|
||||
|
||||
// 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
|
||||
const (
|
||||
IntentsGuilds Intent = 1 << iota
|
||||
IntentsGuildMembers
|
||||
IntentsGuildBans
|
||||
IntentsGuildEmojis
|
||||
IntentsGuildIntegrations
|
||||
IntentsGuildWebhooks
|
||||
IntentsGuildInvites
|
||||
IntentsGuildVoiceStates
|
||||
IntentsGuildPresences
|
||||
IntentsGuildMessages
|
||||
IntentsGuildMessageReactions
|
||||
IntentsGuildMessageTyping
|
||||
IntentsDirectMessages
|
||||
IntentsDirectMessageReactions
|
||||
IntentsDirectMessageTyping
|
||||
IntentsGuilds Intent = 1 << 0
|
||||
IntentsGuildMembers Intent = 1 << 1
|
||||
IntentsGuildBans Intent = 1 << 2
|
||||
IntentsGuildEmojis Intent = 1 << 3
|
||||
IntentsGuildIntegrations Intent = 1 << 4
|
||||
IntentsGuildWebhooks Intent = 1 << 5
|
||||
IntentsGuildInvites Intent = 1 << 6
|
||||
IntentsGuildVoiceStates Intent = 1 << 7
|
||||
IntentsGuildPresences Intent = 1 << 8
|
||||
IntentsGuildMessages Intent = 1 << 9
|
||||
IntentsGuildMessageReactions Intent = 1 << 10
|
||||
IntentsGuildMessageTyping Intent = 1 << 11
|
||||
IntentsDirectMessages Intent = 1 << 12
|
||||
IntentsDirectMessageReactions Intent = 1 << 13
|
||||
IntentsDirectMessageTyping Intent = 1 << 14
|
||||
|
||||
IntentsAllWithoutPrivileged = IntentsGuilds |
|
||||
IntentsGuildBans |
|
||||
|
|
|
@ -21,8 +21,8 @@ type WebhookType int
|
|||
|
||||
// Valid WebhookType values
|
||||
const (
|
||||
WebhookTypeIncoming WebhookType = iota
|
||||
WebhookTypeChannelFollower
|
||||
WebhookTypeIncoming WebhookType = 1
|
||||
WebhookTypeChannelFollower WebhookType = 2
|
||||
)
|
||||
|
||||
// WebhookParams is a struct for webhook params, used in the WebhookExecute command.
|
||||
|
|
Loading…
Reference in a new issue