Skip to content

Commit

Permalink
fix error shadowing in InteractionRespond (#1030)
Browse files Browse the repository at this point in the history
  • Loading branch information
danbrakeley committed Apr 14, 2022
1 parent 4d72c30 commit 2b35977
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions restapi.go
Expand Up @@ -2806,7 +2806,7 @@ func (s *Session) ApplicationCommandPermissionsBatchEdit(appID, guildID string,
// InteractionRespond creates the response to an interaction.
// 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 {
Expand All @@ -2816,9 +2816,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
}

Expand Down
6 changes: 4 additions & 2 deletions state.go
Expand Up @@ -979,8 +979,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
}
Expand All @@ -995,8 +996,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
}
Expand Down

0 comments on commit 2b35977

Please sign in to comment.