Struct tg_flows::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>where T: DeserializeOwned,

source

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

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 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>,

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<T> Erasable for T

§

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

Unerase this erased pointer. Read more
§

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
§

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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more