Skip to content

Commit

Permalink
Merge pull request #55 from tucher/master
Browse files Browse the repository at this point in the history
Fixed BaseEdit.values
  • Loading branch information
Syfaro committed Aug 1, 2016
2 parents 4f996f7 + a1204e7 commit a7f48eb
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions configs.go
Expand Up @@ -166,13 +166,16 @@ type BaseEdit struct {
func (edit BaseEdit) values() (url.Values, error) {
v := url.Values{}

if edit.ChannelUsername != "" {
v.Add("chat_id", edit.ChannelUsername)
if edit.InlineMessageID == "" {
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 {
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 {
data, err := json.Marshal(edit.ReplyMarkup)
Expand Down

0 comments on commit a7f48eb

Please sign in to comment.