mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-22 06:45:37 +01:00
Comment all the deprecated stuff
This commit is contained in:
parent
1df08f02c7
commit
0a36537aa5
3 changed files with 97 additions and 90 deletions
|
@ -1,6 +1,8 @@
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
|
|
||||||
mod api;
|
// TODO: commented due to WIP changes.
|
||||||
|
// See https://github.com/telebofr/telebofr/issues/81.
|
||||||
|
//mod api;
|
||||||
mod download;
|
mod download;
|
||||||
|
|
||||||
/// A Telegram bot used to build requests.
|
/// A Telegram bot used to build requests.
|
||||||
|
|
|
@ -4,7 +4,6 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use futures::{stream, Stream, StreamExt};
|
use futures::{stream, Stream, StreamExt};
|
||||||
|
|
||||||
use pin_project::pin_project;
|
use pin_project::pin_project;
|
||||||
|
|
||||||
use crate::{bot::Bot, types::Update, RequestError};
|
use crate::{bot::Bot, types::Update, RequestError};
|
||||||
|
@ -140,7 +139,11 @@ pub fn polling<'a>(bot: &'a Bot) -> impl Updater<Error = RequestError> + 'a {
|
||||||
let stream = stream::unfold((bot, 0), |(bot, mut offset)| {
|
let stream = stream::unfold((bot, 0), |(bot, mut offset)| {
|
||||||
async move {
|
async move {
|
||||||
// this match converts Result<Vec<_>, _> -> Vec<Result<_, _>>
|
// this match converts Result<Vec<_>, _> -> Vec<Result<_, _>>
|
||||||
let updates = match bot.get_updates().offset(offset).send().await {
|
// 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 {
|
||||||
Ok(updates) => {
|
Ok(updates) => {
|
||||||
if let Some(upd) = updates.last() {
|
if let Some(upd) = updates.last() {
|
||||||
offset = upd.id + 1;
|
offset = upd.id + 1;
|
||||||
|
|
|
@ -1,95 +1,97 @@
|
||||||
//! API requests.
|
//! API requests.
|
||||||
|
|
||||||
pub use answer_callback_query::*;
|
// TODO: commented due to WIP changes.
|
||||||
pub use answer_pre_checkout_query::*;
|
// See https://github.com/telebofr/telebofr/issues/81.
|
||||||
pub use answer_shipping_query::*;
|
//pub use answer_callback_query::*;
|
||||||
pub use delete_chat_photo::*;
|
//pub use answer_pre_checkout_query::*;
|
||||||
pub use delete_chat_sticker_set::*;
|
//pub use answer_shipping_query::*;
|
||||||
pub use edit_message_live_location::*;
|
//pub use delete_chat_photo::*;
|
||||||
pub use export_chat_invite_link::*;
|
//pub use delete_chat_sticker_set::*;
|
||||||
pub use forward_message::*;
|
//pub use edit_message_live_location::*;
|
||||||
pub use get_chat::*;
|
//pub use export_chat_invite_link::*;
|
||||||
pub use get_chat_administrators::*;
|
//pub use forward_message::*;
|
||||||
pub use get_chat_member::*;
|
//pub use get_chat::*;
|
||||||
pub use get_chat_members_count::*;
|
//pub use get_chat_administrators::*;
|
||||||
pub use get_file::*;
|
//pub use get_chat_member::*;
|
||||||
pub use get_me::*;
|
//pub use get_chat_members_count::*;
|
||||||
pub use get_updates::*;
|
//pub use get_file::*;
|
||||||
pub use get_user_profile_photos::*;
|
//pub use get_me::*;
|
||||||
pub use kick_chat_member::*;
|
//pub use get_updates::*;
|
||||||
pub use leave_chat::*;
|
//pub use get_user_profile_photos::*;
|
||||||
pub use pin_chat_message::*;
|
//pub use kick_chat_member::*;
|
||||||
pub use promote_chat_member::*;
|
//pub use leave_chat::*;
|
||||||
pub use restrict_chat_member::*;
|
//pub use pin_chat_message::*;
|
||||||
pub use send_animation::*;
|
//pub use promote_chat_member::*;
|
||||||
pub use send_audio::*;
|
//pub use restrict_chat_member::*;
|
||||||
pub use send_chat_action::*;
|
//pub use send_animation::*;
|
||||||
pub use send_contact::*;
|
//pub use send_audio::*;
|
||||||
pub use send_document::*;
|
//pub use send_chat_action::*;
|
||||||
pub use send_location::*;
|
//pub use send_contact::*;
|
||||||
pub use send_media_group::*;
|
//pub use send_document::*;
|
||||||
pub use send_message::*;
|
//pub use send_location::*;
|
||||||
pub use send_photo::*;
|
//pub use send_media_group::*;
|
||||||
pub use send_poll::*;
|
//pub use send_message::*;
|
||||||
pub use send_venue::*;
|
//pub use send_photo::*;
|
||||||
pub use send_video::*;
|
//pub use send_poll::*;
|
||||||
pub use send_video_note::*;
|
//pub use send_venue::*;
|
||||||
pub use send_voice::*;
|
//pub use send_video::*;
|
||||||
pub use set_chat_description::*;
|
//pub use send_video_note::*;
|
||||||
pub use set_chat_permissions::*;
|
//pub use send_voice::*;
|
||||||
pub use set_chat_photo::*;
|
//pub use set_chat_description::*;
|
||||||
pub use set_chat_sticker_set::*;
|
//pub use set_chat_permissions::*;
|
||||||
pub use set_chat_title::*;
|
//pub use set_chat_photo::*;
|
||||||
pub use stop_message_live_location::*;
|
//pub use set_chat_sticker_set::*;
|
||||||
pub use unban_chat_member::*;
|
//pub use set_chat_title::*;
|
||||||
pub use unpin_chat_message::*;
|
//pub use stop_message_live_location::*;
|
||||||
|
//pub use unban_chat_member::*;
|
||||||
|
//pub use unpin_chat_message::*;
|
||||||
|
|
||||||
mod form_builder;
|
mod form_builder;
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
mod answer_callback_query;
|
//mod answer_callback_query;
|
||||||
mod answer_pre_checkout_query;
|
//mod answer_pre_checkout_query;
|
||||||
mod answer_shipping_query;
|
//mod answer_shipping_query;
|
||||||
mod delete_chat_photo;
|
//mod delete_chat_photo;
|
||||||
mod delete_chat_sticker_set;
|
//mod delete_chat_sticker_set;
|
||||||
mod edit_message_live_location;
|
//mod edit_message_live_location;
|
||||||
mod export_chat_invite_link;
|
//mod export_chat_invite_link;
|
||||||
mod forward_message;
|
//mod forward_message;
|
||||||
mod get_chat;
|
//mod get_chat;
|
||||||
mod get_chat_administrators;
|
//mod get_chat_administrators;
|
||||||
mod get_chat_member;
|
//mod get_chat_member;
|
||||||
mod get_chat_members_count;
|
//mod get_chat_members_count;
|
||||||
mod get_file;
|
//mod get_file;
|
||||||
mod get_me;
|
//mod get_me;
|
||||||
mod get_updates;
|
//mod get_updates;
|
||||||
mod get_user_profile_photos;
|
//mod get_user_profile_photos;
|
||||||
mod kick_chat_member;
|
//mod kick_chat_member;
|
||||||
mod leave_chat;
|
//mod leave_chat;
|
||||||
mod pin_chat_message;
|
//mod pin_chat_message;
|
||||||
mod promote_chat_member;
|
//mod promote_chat_member;
|
||||||
mod restrict_chat_member;
|
//mod restrict_chat_member;
|
||||||
mod send_animation;
|
//mod send_animation;
|
||||||
mod send_audio;
|
//mod send_audio;
|
||||||
mod send_chat_action;
|
//mod send_chat_action;
|
||||||
mod send_contact;
|
//mod send_contact;
|
||||||
mod send_document;
|
//mod send_document;
|
||||||
mod send_location;
|
//mod send_location;
|
||||||
mod send_media_group;
|
//mod send_media_group;
|
||||||
mod send_message;
|
//mod send_message;
|
||||||
mod send_photo;
|
//mod send_photo;
|
||||||
mod send_poll;
|
//mod send_poll;
|
||||||
mod send_venue;
|
//mod send_venue;
|
||||||
mod send_video;
|
//mod send_video;
|
||||||
mod send_video_note;
|
//mod send_video_note;
|
||||||
mod send_voice;
|
//mod send_voice;
|
||||||
mod set_chat_description;
|
//mod set_chat_description;
|
||||||
mod set_chat_permissions;
|
//mod set_chat_permissions;
|
||||||
mod set_chat_photo;
|
//mod set_chat_photo;
|
||||||
mod set_chat_sticker_set;
|
//mod set_chat_sticker_set;
|
||||||
mod set_chat_title;
|
//mod set_chat_title;
|
||||||
mod stop_message_live_location;
|
//mod stop_message_live_location;
|
||||||
mod unban_chat_member;
|
//mod unban_chat_member;
|
||||||
mod unpin_chat_message;
|
//mod unpin_chat_message;
|
||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use serde::de::DeserializeOwned;
|
use serde::de::DeserializeOwned;
|
||||||
|
@ -101,7 +103,7 @@ pub type ResponseResult<T> = Result<T, crate::RequestError>;
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait Request {
|
pub trait Request {
|
||||||
/// A type of response.
|
/// A type of response.
|
||||||
type Output: DeserializeOwned;
|
type Output: DeserializeOwned; // TODO: do we need this bound _here_?
|
||||||
|
|
||||||
/// Send this request.
|
/// Send this request.
|
||||||
async fn send_boxed(self) -> ResponseResult<Self::Output>;
|
async fn send_boxed(self) -> ResponseResult<Self::Output>;
|
||||||
|
|
Loading…
Add table
Reference in a new issue