From 7c6b901a4c725b04ae3c89f9a46ba428ae95161f Mon Sep 17 00:00:00 2001 From: Icemic Date: Sat, 6 Nov 2021 21:21:10 +0800 Subject: [PATCH] add `logOut` method --- raw/src/requests/log_out.rs | 20 ++++++++++++++++++++ raw/src/requests/mod.rs | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 raw/src/requests/log_out.rs diff --git a/raw/src/requests/log_out.rs b/raw/src/requests/log_out.rs new file mode 100644 index 0000000000..0e284261ad --- /dev/null +++ b/raw/src/requests/log_out.rs @@ -0,0 +1,20 @@ +use crate::requests::*; + +/// Use this method to log out from the cloud Bot API server before launching the bot locally. +/// You must log out the bot before running it locally, +/// therwise there is no guarantee that the bot will receive updates. +/// After a successful call, you can immediately log in on a local server, +/// but will not be able to log in back to the cloud Bot API server for 10 minutes. +/// Returns True on success. Requires no parameters. +#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize)] +#[must_use = "requests do nothing unless sent"] +pub struct LogOut; + +impl Request for LogOut { + type Type = JsonRequestType; + type Response = JsonIdResponse; + + fn serialize(&self) -> Result { + Self::Type::serialize(RequestUrl::method("logOut"), self) + } +} diff --git a/raw/src/requests/mod.rs b/raw/src/requests/mod.rs index 4d744a2d1a..1d762a2912 100644 --- a/raw/src/requests/mod.rs +++ b/raw/src/requests/mod.rs @@ -19,6 +19,7 @@ pub mod get_updates; pub mod get_user_profile_photos; pub mod kick_chat_member; pub mod leave_chat; +pub mod log_out; pub mod pin_chat_message; pub mod send_audio; pub mod send_chat_action; @@ -55,6 +56,7 @@ pub use self::get_updates::*; pub use self::get_user_profile_photos::*; pub use self::kick_chat_member::*; pub use self::leave_chat::*; +pub use self::log_out::*; pub use self::pin_chat_message::*; pub use self::send_audio::*; pub use self::send_chat_action::*;