pull/131/head
Alexander 8 years ago
parent 4f4aab2175
commit 58a3112bd8
  1. 10
      bot.go
  2. 2
      types.go

@ -423,6 +423,14 @@ func (bot *BotAPI) GetUpdates(config UpdateConfig) ([]Update, error) {
var updates []Update var updates []Update
json.Unmarshal(resp.Result, &updates) json.Unmarshal(resp.Result, &updates)
// Every update contains raw JSON which
// can include information about other
// updates. This is because response is
// single for all. Be aware.
for _, v := range updates {
v.RawUpdateJSON = string(resp.Result)
}
bot.debugLog("getUpdates", v, updates) bot.debugLog("getUpdates", v, updates)
return updates, nil return updates, nil
@ -515,7 +523,7 @@ func (bot *BotAPI) ListenForWebhook(pattern string) UpdatesChannel {
var update Update var update Update
json.Unmarshal(bytes, &update) json.Unmarshal(bytes, &update)
update.RawUpdateJson = string(bytes) update.RawUpdateJSON = string(bytes)
ch <- update ch <- update
}) })

@ -37,7 +37,7 @@ type Update struct {
CallbackQuery *CallbackQuery `json:"callback_query"` CallbackQuery *CallbackQuery `json:"callback_query"`
ShippingQuery *ShippingQuery `json:"shipping_query"` ShippingQuery *ShippingQuery `json:"shipping_query"`
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query"` PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query"`
RawUpdateJson string RawUpdateJSON string
} }
// UpdatesChannel is the channel for getting updates. // UpdatesChannel is the channel for getting updates.