Skip to content

Commit

Permalink
fix missing user in resolved member
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed May 2, 2023
1 parent ccbf79c commit e9b9dd1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions discord/interaction_application_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,22 @@ type SlashCommandResolved struct {
Attachments map[snowflake.ID]Attachment `json:"attachments,omitempty"`
}

func (r *SlashCommandResolved) UnmarshalJSON(data []byte) error {
type slashCommandResolved SlashCommandResolved
var v slashCommandResolved
if err := json.Unmarshal(data, &v); err != nil {
return err
}
*r = SlashCommandResolved(v)
for id, member := range r.Members {
if user, ok := r.Users[id]; ok {
member.User = user
r.Members[id] = member
}
}
return nil
}

type ContextCommandInteractionData interface {
ApplicationCommandInteractionData
TargetID() snowflake.ID
Expand Down

0 comments on commit e9b9dd1

Please sign in to comment.