add DeleteMessage config

Signed-off-by: Jianqiu Zhang <zhangjianqiu13@gmail.com>
pull/165/head
Jianqiu Zhang 7 years ago
parent e2916e08ad
commit 19dcb0037c
No known key found for this signature in database
GPG Key ID: B012733142D79E59
  1. 16
      configs.go
  2. 7
      helpers.go

@ -697,6 +697,22 @@ type EditMessageTextConfig struct {
DisableWebPagePreview bool
}
type DeleteMessageConfig struct {
ChatID int64 `json:"chat_id"`
MessageID int `json:"message_id"`
}
func (config DeleteMessageConfig) values() (url.Values, error) {
v := url.Values{}
v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
v.Add("message_id", strconv.FormatInt(int64(config.MessageID), 10))
return v, nil
}
func (config DeleteMessageConfig) method() string {
return "deleteMessage"
}
func (config EditMessageTextConfig) values() (url.Values, error) {
v, err := config.BaseEdit.values()
if err != nil {

@ -19,6 +19,13 @@ func NewMessage(chatID int64, text string) MessageConfig {
}
}
func NewDeleteMessage(chatID int64, messageID int) DeleteMessageConfig {
return DeleteMessageConfig{
ChatID: chatID,
MessageID: messageID,
}
}
// NewMessageToChannel creates a new Message that is sent to a channel
// by username.
//