Skip to content

Commit

Permalink
fix missing user in target member
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed May 2, 2023
1 parent e9b9dd1 commit 779858b
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 @@ -611,6 +611,22 @@ type UserCommandResolved struct {
Members map[snowflake.ID]ResolvedMember `json:"members,omitempty"`
}

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

var (
_ ApplicationCommandInteractionData = (*MessageCommandInteractionData)(nil)
_ ContextCommandInteractionData = (*MessageCommandInteractionData)(nil)
Expand Down

0 comments on commit 779858b

Please sign in to comment.