Skip to content

Commit

Permalink
adjust func so it makes more sense
Browse files Browse the repository at this point in the history
  • Loading branch information
sebm253 committed Aug 28, 2024
1 parent 8d12161 commit 564b8a6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions rest/interactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 564b8a6

Please sign in to comment.