Fixed BaseEdit.values
chat_id and message_id should be sent only if there is no inline_message_id (and vice versa), according to documentation.bot-api-6.1
parent
4f996f7f27
commit
a1204e7ea1
|
@ -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.InlineMessageID == "" {
|
||||||
if edit.ChannelUsername != "" {
|
if edit.ChannelUsername != "" {
|
||||||
v.Add("chat_id", edit.ChannelUsername)
|
v.Add("chat_id", edit.ChannelUsername)
|
||||||
} else {
|
} else {
|
||||||
v.Add("chat_id", strconv.FormatInt(edit.ChatID, 10))
|
v.Add("chat_id", strconv.FormatInt(edit.ChatID, 10))
|
||||||
}
|
}
|
||||||
v.Add("message_id", strconv.Itoa(edit.MessageID))
|
v.Add("message_id", strconv.Itoa(edit.MessageID))
|
||||||
|
} else {
|
||||||
v.Add("inline_message_id", edit.InlineMessageID)
|
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)
|
||||||
|
|
Loading…
Reference in New Issue