diff --git a/bot.go b/bot.go index d56aaf8..b2d9675 100644 --- a/bot.go +++ b/bot.go @@ -423,6 +423,14 @@ func (bot *BotAPI) GetUpdates(config UpdateConfig) ([]Update, error) { var updates []Update 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) return updates, nil @@ -529,6 +537,7 @@ func (bot *BotAPI) ListenForWebhook(pattern string) UpdatesChannel { var update Update json.Unmarshal(bytes, &update) + update.RawUpdateJSON = string(bytes) ch <- update }) diff --git a/types.go b/types.go index d3c433f..857aa25 100644 --- a/types.go +++ b/types.go @@ -37,6 +37,7 @@ type Update struct { CallbackQuery *CallbackQuery `json:"callback_query"` ShippingQuery *ShippingQuery `json:"shipping_query"` PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query"` + RawUpdateJSON string } // UpdatesChannel is the channel for getting updates.