From b403c5ab09d64c6b0b64010bfd1e1ccfd5ec3337 Mon Sep 17 00:00:00 2001 From: Dan Brakeley Date: Fri, 19 Nov 2021 14:57:51 -0500 Subject: [PATCH] fix linter errors the linter caught shadowed variables that were preventing errors from being returned properly --- restapi.go | 7 ++++--- state.go | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/restapi.go b/restapi.go index e3817d233..5de4acdeb 100644 --- a/restapi.go +++ b/restapi.go @@ -2536,7 +2536,7 @@ func (s *Session) ApplicationCommands(appID, guildID string) (cmd []*Application // appID : The application ID. // interaction : Interaction instance. // resp : Response message data. -func (s *Session) InteractionRespond(interaction *Interaction, resp *InteractionResponse) (err error) { +func (s *Session) InteractionRespond(interaction *Interaction, resp *InteractionResponse) error { endpoint := EndpointInteractionResponse(interaction.ID, interaction.Token) if resp.Data != nil && len(resp.Data.Files) > 0 { @@ -2546,9 +2546,10 @@ func (s *Session) InteractionRespond(interaction *Interaction, resp *Interaction } _, err = s.request("POST", endpoint, contentType, body, endpoint, 0) - } else { - _, err = s.RequestWithBucketID("POST", endpoint, *resp, endpoint) + return err } + + _, err := s.RequestWithBucketID("POST", endpoint, *resp, endpoint) return err } diff --git a/state.go b/state.go index 2c21b19cd..c02f3a917 100644 --- a/state.go +++ b/state.go @@ -845,8 +845,9 @@ func (s *State) OnInterface(se *Session, i interface{}) (err error) { err = s.GuildRemove(t.Guild) case *GuildMemberAdd: + var guild *Guild // Updates the MemberCount of the guild. - guild, err := s.Guild(t.Member.GuildID) + guild, err = s.Guild(t.Member.GuildID) if err != nil { return err } @@ -861,8 +862,9 @@ func (s *State) OnInterface(se *Session, i interface{}) (err error) { err = s.MemberAdd(t.Member) } case *GuildMemberRemove: + var guild *Guild // Updates the MemberCount of the guild. - guild, err := s.Guild(t.Member.GuildID) + guild, err = s.Guild(t.Member.GuildID) if err != nil { return err }