Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix shadowed variables that were preventing errors from being returned properly #1030

Merged
merged 1 commit into from Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions restapi.go
Expand Up @@ -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 {
Expand All @@ -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
}

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