Fix todo: use get_updates in polling

This commit is contained in:
Waffle 2019-11-27 16:14:37 +03:00
parent 4f77f8f371
commit e673335e1f

View file

@ -138,12 +138,7 @@ where
pub fn polling<'a>(bot: &'a Bot) -> impl Updater<Error = RequestError> + 'a {
let stream = stream::unfold((bot, 0), |(bot, mut offset)| {
async move {
// this match converts Result<Vec<_>, _> -> Vec<Result<_, _>>
// TODO: for now `get_updates` are removed, but when we implement it
// back, we need to fix this code.
// See https://github.com/telebofr/telebofr/issues/81.
let updates: Result<Vec<Update>, RequestError> = todo!();
let updates = match /* bot.get_updates().offset(offset).send().await */ updates {
let updates = match bot.get_updates().offset(offset).send().await {
Ok(updates) => {
if let Some(upd) = updates.last() {
offset = upd.id + 1;