tg_flows

Struct Telegram

Source
pub struct Telegram { /* private fields */ }

Implementations§

Source§

impl Telegram

Source

pub fn new(token: String) -> Self

Source

pub fn new_with_base_url(token: String, base_url: &'static str) -> Self

Source§

impl Telegram

Source

pub fn request<T>(&self, method: Method, body: &[u8]) -> Result<T>

Source

pub fn request_with_attach<T, S>( &self, method: Method, query: HashMap<S, S>, body: &[u8], ) -> Result<T>

Source§

impl Telegram

Source

pub fn get_me(&self) -> Result<Me>

Source

pub fn log_out(&self) -> Result<True>

Source

pub fn close(&self) -> Result<True>

Source

pub fn send_message<T>(&self, chat_id: ChatId, text: T) -> Result<Message>
where T: Into<String>,

Source

pub fn send_message_with_parse_mode<T>( &self, chat_id: ChatId, text: T, parse_mode: ParseMode, ) -> Result<Message>
where T: Into<String>,

Source

pub fn forward_message( &self, chat_id: ChatId, from_chat_id: ChatId, ) -> Result<Message>

Source

pub fn copy_message( &self, chat_id: ChatId, from_chat_id: ChatId, message_id: MessageId, ) -> Result<Message>

Source

pub fn send_photo(&self, chat_id: ChatId, photo: InputFile) -> Result<Message>

Source

pub fn send_audio(&self, chat_id: ChatId, audio: InputFile) -> Result<Message>

Source

pub fn send_document( &self, chat_id: ChatId, document: InputFile, ) -> Result<Message>

Source

pub fn send_video(&self, chat_id: ChatId, video: InputFile) -> Result<Message>

Source

pub fn send_animation( &self, chat_id: ChatId, animation: InputFile, ) -> Result<Message>

Source

pub fn send_voice(&self, chat_id: ChatId, voice: InputFile) -> Result<Message>

Source

pub fn send_video_note( &self, chat_id: ChatId, video_note: InputFile, ) -> Result<Message>

Source

pub fn send_location( &self, chat_id: ChatId, latitude: f32, longitude: f32, ) -> Result<Message>

Source

pub fn send_venue( &self, chat_id: ChatId, latitude: f32, longitude: f32, title: String, address: String, ) -> Result<Message>

Source

pub fn send_contract( &self, chat_id: ChatId, photo_number: String, first_name: String, ) -> Result<Message>

Source

pub fn send_poll( &self, chat_id: ChatId, question: String, options: Vec<String>, ) -> Result<Message>

Source

pub fn send_dice(&self, chat_id: ChatId) -> Result<Message>

Source

pub fn send_chat_action( &self, chat_id: ChatId, action: String, ) -> Result<Message>

Source

pub fn get_user_profile_photos( &self, user_id: UserId, ) -> Result<UserProfilePhotos>

Source

pub fn get_file(&self, file_id: String) -> Result<File>

Source

pub fn ban_chat_member(&self, chat_id: ChatId, user_id: UserId) -> Result<True>

Source

pub fn unban_chat_member( &self, chat_id: ChatId, user_id: UserId, ) -> Result<True>

Source

pub fn restrict_chat_member( &self, chat_id: ChatId, user_id: UserId, permissions: ChatPermissions, ) -> Result<True>

Source

pub fn promote_chat_member( &self, chat_id: ChatId, user_id: UserId, ) -> Result<True>

Source

pub fn set_chat_administrator_custom_title( &self, chat_id: ChatId, user_id: UserId, custom_title: String, ) -> Result<True>

Source

pub fn ban_chat_sender_chat( &self, chat_id: ChatId, sender_chat_id: i32, ) -> Result<True>

Source

pub fn unban_chat_sender_chat( &self, chat_id: ChatId, sender_chat_id: i32, ) -> Result<True>

Source

pub fn set_chat_permissions( &self, chat_id: ChatId, permissions: ChatPermissions, ) -> Result<True>

Source

pub fn approve_chat_join_request( &self, chat_id: ChatId, user_id: UserId, ) -> Result<True>

Source

pub fn decline_chat_join_request( &self, chat_id: ChatId, user_id: UserId, ) -> Result<True>

Source

pub fn set_chat_photo(&self, chat_id: ChatId, photo: InputFile) -> Result<True>

Source

pub fn delete_chat_photo(&self, chat_id: ChatId) -> Result<True>

Source

pub fn set_chat_title(&self, chat_id: ChatId, title: String) -> Result<True>

Source

pub fn set_chat_description(&self, chat_id: ChatId) -> Result<True>

Source

pub fn pin_chat_message(&self, chat_id: ChatId, message_id: i32) -> Result<True>

Source

pub fn unpin_chat_message(&self, chat_id: ChatId) -> Result<True>

Source

pub fn unpin_all_chat_message(&self, chat_id: ChatId) -> Result<True>

Source

pub fn leave_chat(&self, chat_id: ChatId) -> Result<True>

Source

pub fn get_chat(&self, chat_id: ChatId) -> Result<Chat>

Source

pub fn get_chat_administrators(&self, chat_id: ChatId) -> Result<ChatMember>

Source

pub fn get_chat_member_count(&self, chat_id: ChatId) -> Result<i32>

Source

pub fn get_chat_member( &self, chat_id: ChatId, user_id: UserId, ) -> Result<ChatMember>

Source

pub fn edit_message_text<T>( &self, chat_id: ChatId, message_id: MessageId, text: T, ) -> Result<Message>
where T: Into<String>,

Source

pub fn edit_message_text_with_parse_mode<T>( &self, chat_id: ChatId, message_id: MessageId, text: T, parse_mode: ParseMode, ) -> Result<Message>
where T: Into<String>,

Source

pub fn delete_message( &self, chat_id: ChatId, message_id: MessageId, ) -> Result<True>

Source

pub fn delete_messages( &self, chat_id: ChatId, message_ids: Vec<MessageId>, ) -> Result<True>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Erasable for T

Source§

const ACK_1_1_0: bool = true

Whether this implementor has acknowledged the 1.1.0 update to unerase’s documented implementation requirements. Read more
Source§

unsafe fn unerase(this: NonNull<Erased>) -> NonNull<T>

Unerase this erased pointer. Read more
Source§

fn erase(this: NonNull<Self>) -> NonNull<Erased>

Turn this erasable pointer into an erased pointer. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T