all repos — telegram-bot-api @ 74b3b6300b477782c82f919ba96bcaeaed43c1d6

Golang bindings for the Telegram Bot API

Merge pull request #352 from ros-tel/delete-channel-msg

Delete a message in a channel
Syfaro syfaro@huefox.com
Tue, 21 Jul 2020 01:31:00 -0500
commit

74b3b6300b477782c82f919ba96bcaeaed43c1d6

parent

8717c40e7c9301c4c26082be7f39af21304ed606

1 files changed, 9 insertions(+), 3 deletions(-)

jump to
M configs.goconfigs.go

@@ -1138,8 +1138,9 @@ }

// 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) 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