From b370d232aa064c431f11360a7ff8dedca8e9e05d Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 19 Mar 2024 14:00:39 +0100 Subject: [PATCH] Declare missing types for iota consts (#344) * Declare type for iota consts * lol remove these because the handler won't work * I do not take responsibility for this proof: https://i.imgur.com/7t1FPtJ.png --- discord/application.go | 2 +- discord/application_command.go | 2 +- discord/application_command_permission.go | 2 +- discord/channel.go | 2 +- discord/component.go | 6 +++--- handler/mux.go | 18 +++++++++--------- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/discord/application.go b/discord/application.go index d3045bae8..fd8db6aa0 100644 --- a/discord/application.go +++ b/discord/application.go @@ -250,7 +250,7 @@ type TeamMember struct { type MembershipState int const ( - MembershipStateInvited = iota + 1 + MembershipStateInvited MembershipState = iota + 1 MembershipStateAccepted ) diff --git a/discord/application_command.go b/discord/application_command.go index a0e06b78f..1f149bec7 100644 --- a/discord/application_command.go +++ b/discord/application_command.go @@ -11,7 +11,7 @@ import ( type ApplicationCommandType int const ( - ApplicationCommandTypeSlash = iota + 1 + ApplicationCommandTypeSlash ApplicationCommandType = iota + 1 ApplicationCommandTypeUser ApplicationCommandTypeMessage ) diff --git a/discord/application_command_permission.go b/discord/application_command_permission.go index 58c023921..75277a3ec 100644 --- a/discord/application_command_permission.go +++ b/discord/application_command_permission.go @@ -12,7 +12,7 @@ type ApplicationCommandPermissionType int // types of ApplicationCommandPermissionType const ( - ApplicationCommandPermissionTypeRole = iota + 1 + ApplicationCommandPermissionTypeRole ApplicationCommandPermissionType = iota + 1 ApplicationCommandPermissionTypeUser ApplicationCommandPermissionTypeChannel ) diff --git a/discord/channel.go b/discord/channel.go index 3abec1d1b..0249b690c 100644 --- a/discord/channel.go +++ b/discord/channel.go @@ -1308,7 +1308,7 @@ type PartialChannel struct { type VideoQualityMode int const ( - VideoQualityModeAuto = iota + 1 + VideoQualityModeAuto VideoQualityMode = iota + 1 VideoQualityModeFull ) diff --git a/discord/component.go b/discord/component.go index ff4742d38..b8c0dd3e8 100644 --- a/discord/component.go +++ b/discord/component.go @@ -12,7 +12,7 @@ type ComponentType int // Supported ComponentType(s) const ( - ComponentTypeActionRow = iota + 1 + ComponentTypeActionRow ComponentType = iota + 1 ComponentTypeButton ComponentTypeStringSelectMenu ComponentTypeTextInput @@ -229,7 +229,7 @@ type ButtonStyle int // Supported ButtonStyle(s) const ( - ButtonStylePrimary = iota + 1 + ButtonStylePrimary ButtonStyle = iota + 1 ButtonStyleSecondary ButtonStyleSuccess ButtonStyleDanger @@ -459,6 +459,6 @@ func (c TextInputComponent) WithValue(value string) TextInputComponent { type TextInputStyle int const ( - TextInputStyleShort = iota + 1 + TextInputStyleShort TextInputStyle = iota + 1 TextInputStyleParagraph ) diff --git a/handler/mux.go b/handler/mux.go index 5887d4022..90e78781f 100644 --- a/handler/mux.go +++ b/handler/mux.go @@ -205,7 +205,7 @@ func (r *Mux) SlashCommand(pattern string, h SlashCommandHandler) { pattern: pattern, handler: h, t: discord.InteractionTypeApplicationCommand, - t2: []int{discord.ApplicationCommandTypeSlash}, + t2: []int{int(discord.ApplicationCommandTypeSlash)}, }) } @@ -216,7 +216,7 @@ func (r *Mux) UserCommand(pattern string, h UserCommandHandler) { pattern: pattern, handler: h, t: discord.InteractionTypeApplicationCommand, - t2: []int{discord.ApplicationCommandTypeUser}, + t2: []int{int(discord.ApplicationCommandTypeUser)}, }) } @@ -227,7 +227,7 @@ func (r *Mux) MessageCommand(pattern string, h MessageCommandHandler) { pattern: pattern, handler: h, t: discord.InteractionTypeApplicationCommand, - t2: []int{discord.ApplicationCommandTypeMessage}, + t2: []int{int(discord.ApplicationCommandTypeMessage)}, }) } @@ -258,7 +258,7 @@ func (r *Mux) ButtonComponent(pattern string, h ButtonComponentHandler) { pattern: pattern, handler: h, t: discord.InteractionTypeComponent, - t2: []int{discord.ComponentTypeButton}, + t2: []int{int(discord.ComponentTypeButton)}, }) } @@ -270,11 +270,11 @@ func (r *Mux) SelectMenuComponent(pattern string, h SelectMenuComponentHandler) handler: h, t: discord.InteractionTypeComponent, t2: []int{ - discord.ComponentTypeStringSelectMenu, - discord.ComponentTypeUserSelectMenu, - discord.ComponentTypeRoleSelectMenu, - discord.ComponentTypeMentionableSelectMenu, - discord.ComponentTypeChannelSelectMenu, + int(discord.ComponentTypeStringSelectMenu), + int(discord.ComponentTypeUserSelectMenu), + int(discord.ComponentTypeRoleSelectMenu), + int(discord.ComponentTypeMentionableSelectMenu), + int(discord.ComponentTypeChannelSelectMenu), }, }) }