Skip to content

Commit

Permalink
fix: add a workaround for discord/discord-api-docs#6730
Browse files Browse the repository at this point in the history
  • Loading branch information
FedorLap2006 committed Mar 21, 2024
1 parent 5f9e70e commit b56655e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion interactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ type interaction Interaction

type rawInteraction struct {
interaction
Data json.RawMessage `json:"data"`
Data json.RawMessage `json:"data"`
AuthorizingIntegrationOwners map[ApplicationIntegrationType]json.Number `json:"authorizing_integration_owners"`
}

// UnmarshalJSON is a method for unmarshalling JSON object to Interaction.
Expand All @@ -274,6 +275,13 @@ func (i *Interaction) UnmarshalJSON(raw []byte) error {

*i = Interaction(tmp.interaction)

// TODO: remove when https://github.com/discord/discord-api-docs/issues/6730 is fixed.
authIntegrationOwners := make(map[ApplicationIntegrationType]string)
for k, v := range tmp.AuthorizingIntegrationOwners {
authIntegrationOwners[k] = v.String()
}
i.AuthorizingIntegrationOwners = authIntegrationOwners

switch tmp.Type {
case InteractionApplicationCommand, InteractionApplicationCommandAutocomplete:
v := ApplicationCommandInteractionData{}
Expand Down

0 comments on commit b56655e

Please sign in to comment.