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

Delete a message in a channel
bot-api-6.1
Syfaro 2020-07-21 01:31:00 -05:00 committed by GitHub
commit 74b3b6300b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -1138,6 +1138,7 @@ type PreCheckoutConfig struct {
// DeleteMessageConfig contains information of a message in a chat to delete.
type DeleteMessageConfig struct {
ChannelUsername string
ChatID int64
MessageID int
}
@ -1149,7 +1150,12 @@ func (config DeleteMessageConfig) method() string {
func (config DeleteMessageConfig) values() (url.Values, error) {
v := url.Values{}
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