Skip to content

Commit

Permalink
Get webhook message endpoint (bwmarrin#948)
Browse files Browse the repository at this point in the history
* Get interaction response message by interaction token

* Rename methods
  • Loading branch information
Xpl0itR authored Jun 17, 2021
1 parent f5bb723 commit e72c457
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions restapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -2236,6 +2236,23 @@ func (s *Session) WebhookExecute(webhookID, token string, wait bool, data *Webho
return
}

// WebhookMessage gets a webhook message.
// webhookID : The ID of a webhook
// token : The auth token for the webhook
// messageID : The ID of message to get
func (s *Session) WebhookMessage(webhookID, token, messageID string) (message *Message, err error) {
uri := EndpointWebhookMessage(webhookID, token, messageID)

body, err := s.RequestWithBucketID("GET", uri, nil, EndpointWebhookToken("", ""))
if err != nil {
return
}

err = json.Unmarshal(body, &message)

return
}

// WebhookMessageEdit edits a webhook message.
// webhookID : The ID of a webhook
// token : The auth token for the webhook
Expand Down Expand Up @@ -2557,6 +2574,13 @@ func (s *Session) InteractionRespond(interaction *Interaction, resp *Interaction
return err
}

// InteractionResponse gets the response to an interaction.
// appID : The application ID.
// interaction : Interaction instance.
func (s *Session) InteractionResponse(appID string, interaction *Interaction) (*Message, error) {
return s.WebhookMessage(appID, interaction.Token, "@original")
}

// InteractionResponseEdit edits the response to an interaction.
// appID : The application ID.
// interaction : Interaction instance.
Expand Down

0 comments on commit e72c457

Please sign in to comment.