Merge pull request #55 from tucher/master

Fixed BaseEdit.values
bot-api-6.1
Syfaro 2016-08-01 13:36:25 -05:00 committed by GitHub
commit a7f48eb2dd
1 changed files with 8 additions and 5 deletions

View File

@ -166,13 +166,16 @@ type BaseEdit struct {
func (edit BaseEdit) values() (url.Values, error) { func (edit BaseEdit) values() (url.Values, error) {
v := url.Values{} v := url.Values{}
if edit.ChannelUsername != "" { if edit.InlineMessageID == "" {
v.Add("chat_id", edit.ChannelUsername) if edit.ChannelUsername != "" {
v.Add("chat_id", edit.ChannelUsername)
} else {
v.Add("chat_id", strconv.FormatInt(edit.ChatID, 10))
}
v.Add("message_id", strconv.Itoa(edit.MessageID))
} else { } else {
v.Add("chat_id", strconv.FormatInt(edit.ChatID, 10)) v.Add("inline_message_id", edit.InlineMessageID)
} }
v.Add("message_id", strconv.Itoa(edit.MessageID))
v.Add("inline_message_id", edit.InlineMessageID)
if edit.ReplyMarkup != nil { if edit.ReplyMarkup != nil {
data, err := json.Marshal(edit.ReplyMarkup) data, err := json.Marshal(edit.ReplyMarkup)