diff --git a/rest/interactions.go b/rest/interactions.go index 11598d30..7397d6c0 100644 --- a/rest/interactions.go +++ b/rest/interactions.go @@ -15,7 +15,7 @@ func NewInteractions(client Client) Interactions { type Interactions interface { GetInteractionResponse(applicationID snowflake.ID, interactionToken string, opts ...RequestOpt) (*discord.Message, error) CreateInteractionResponse(interactionID snowflake.ID, interactionToken string, interactionResponse discord.InteractionResponse, opts ...RequestOpt) error - CreateInteractionResponseWithCallback(interactionID snowflake.ID, interactionToken string, interactionResponse discord.InteractionResponse, withCallback bool, opts ...RequestOpt) (*discord.InteractionCallbackResponse, error) + CreateInteractionResponseWithCallback(interactionID snowflake.ID, interactionToken string, interactionResponse discord.InteractionResponse, opts ...RequestOpt) (*discord.InteractionCallbackResponse, error) UpdateInteractionResponse(applicationID snowflake.ID, interactionToken string, messageUpdate discord.MessageUpdate, opts ...RequestOpt) (*discord.Message, error) DeleteInteractionResponse(applicationID snowflake.ID, interactionToken string, opts ...RequestOpt) error @@ -36,18 +36,21 @@ func (s *interactionImpl) GetInteractionResponse(interactionID snowflake.ID, int // CreateInteractionResponse calls CreateInteractionResponseWithCallback with `withCallback: false`. // The signature of this function might be adjusted in the future. -func (s *interactionImpl) CreateInteractionResponse(interactionID snowflake.ID, interactionToken string, interactionResponse discord.InteractionResponse, opts ...RequestOpt) (err error) { - _, err = s.CreateInteractionResponseWithCallback(interactionID, interactionToken, interactionResponse, false, opts...) - return +func (s *interactionImpl) CreateInteractionResponse(interactionID snowflake.ID, interactionToken string, interactionResponse discord.InteractionResponse, opts ...RequestOpt) error { + body, err := interactionResponse.ToBody() + if err != nil { + return err + } + return s.client.Do(CreateInteractionResponse.Compile(nil, interactionID, interactionToken), body, nil, opts...) } -func (s *interactionImpl) CreateInteractionResponseWithCallback(interactionID snowflake.ID, interactionToken string, interactionResponse discord.InteractionResponse, withCallback bool, opts ...RequestOpt) (callback *discord.InteractionCallbackResponse, err error) { +func (s *interactionImpl) CreateInteractionResponseWithCallback(interactionID snowflake.ID, interactionToken string, interactionResponse discord.InteractionResponse, opts ...RequestOpt) (callback *discord.InteractionCallbackResponse, err error) { body, err := interactionResponse.ToBody() if err != nil { return nil, err } values := discord.QueryValues{ - "with_response": withCallback, + "with_response": true, } err = s.client.Do(CreateInteractionResponse.Compile(values, interactionID, interactionToken), body, &callback, opts...) return