Add support for retrieving Webhook ID

This commit is contained in:
Aditya Diwakar 2020-08-05 18:54:12 -04:00
parent 10195fcfbb
commit eb70c17733
2 changed files with 9 additions and 2 deletions

View file

@ -1810,7 +1810,7 @@ func (s *Session) ChannelMessageCrosspost(channelID, messageID string) (st *Mess
// ChannelNewsFollow follows a news channel in the targetID // ChannelNewsFollow follows a news channel in the targetID
// channelID : The ID of a News Channel // channelID : The ID of a News Channel
// targetID : The ID of a Channel where the News Channel should post to // targetID : The ID of a Channel where the News Channel should post to
func (s *Session) ChannelNewsFollow(channelID, targetID string) (err error) { func (s *Session) ChannelNewsFollow(channelID, targetID string) (st *ChannelFollow, err error) {
endpoint := EndpointChannelFollow(channelID) endpoint := EndpointChannelFollow(channelID)
@ -1818,7 +1818,9 @@ func (s *Session) ChannelNewsFollow(channelID, targetID string) (err error) {
WebhookChannelID string `json:"webhook_channel_id"` WebhookChannelID string `json:"webhook_channel_id"`
}{targetID} }{targetID}
_, err = s.RequestWithBucketID("POST", endpoint, data, endpoint) body, err := s.RequestWithBucketID("POST", endpoint, data, endpoint)
err = unmarshal(body, &st)
return return
} }

View file

@ -316,6 +316,11 @@ type ChannelEdit struct {
RateLimitPerUser int `json:"rate_limit_per_user,omitempty"` RateLimitPerUser int `json:"rate_limit_per_user,omitempty"`
} }
type ChannelFollow struct {
ChannelID string `json:"channel_id"`
WebhookID string `json:"webhook_id"`
}
// A PermissionOverwrite holds permission overwrite data for a Channel // A PermissionOverwrite holds permission overwrite data for a Channel
type PermissionOverwrite struct { type PermissionOverwrite struct {
ID string `json:"id"` ID string `json:"id"`