Get webhook message endpoint (#948)

* Get interaction response message by interaction token

* Rename methods
This commit is contained in:
Xpl0itR 2021-06-17 22:19:10 +01:00 committed by GitHub
parent f5bb723db8
commit e72c457cb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
@ -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.