From 86a3d94b4ba4e5318466cd56f738d18ca039fcdb Mon Sep 17 00:00:00 2001 From: ros-tel Date: Sun, 19 Jul 2020 10:11:27 +0500 Subject: [PATCH] Delete a message in a channel --- configs.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/configs.go b/configs.go index a7052dd..4bd2c33 100644 --- a/configs.go +++ b/configs.go @@ -1138,8 +1138,9 @@ type PreCheckoutConfig struct { // DeleteMessageConfig contains information of a message in a chat to delete. type DeleteMessageConfig struct { - ChatID int64 - MessageID int + ChannelUsername string + ChatID int64 + MessageID int } func (config DeleteMessageConfig) method() string { @@ -1149,7 +1150,12 @@ func (config DeleteMessageConfig) method() string { func (config DeleteMessageConfig) values() (url.Values, error) { v := url.Values{} - v.Add("chat_id", strconv.FormatInt(config.ChatID, 10)) + if config.ChannelUsername == "" { + v.Add("chat_id", strconv.FormatInt(config.ChatID, 10)) + } else { + v.Add("chat_id", config.ChannelUsername) + } + v.Add("message_id", strconv.Itoa(config.MessageID)) return v, nil