From eb70c17733f3795f1cc40cd9b8db6c774deb20c0 Mon Sep 17 00:00:00 2001 From: Aditya Diwakar Date: Wed, 5 Aug 2020 18:54:12 -0400 Subject: [PATCH] Add support for retrieving Webhook ID --- restapi.go | 6 ++++-- structs.go | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/restapi.go b/restapi.go index 7eaee29..a0e85f8 100644 --- a/restapi.go +++ b/restapi.go @@ -1810,7 +1810,7 @@ func (s *Session) ChannelMessageCrosspost(channelID, messageID string) (st *Mess // ChannelNewsFollow follows a news channel in the targetID // channelID : The ID of a News Channel // 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) @@ -1818,7 +1818,9 @@ func (s *Session) ChannelNewsFollow(channelID, targetID string) (err error) { WebhookChannelID string `json:"webhook_channel_id"` }{targetID} - _, err = s.RequestWithBucketID("POST", endpoint, data, endpoint) + body, err := s.RequestWithBucketID("POST", endpoint, data, endpoint) + + err = unmarshal(body, &st) return } diff --git a/structs.go b/structs.go index aefda59..2590a8b 100644 --- a/structs.go +++ b/structs.go @@ -316,6 +316,11 @@ type ChannelEdit struct { 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 type PermissionOverwrite struct { ID string `json:"id"`