[][src]Struct telegram_client::listener::Listener

pub struct Listener { /* fields omitted */ }

Telegram client event listener

Methods

impl Listener[src]

pub fn new() -> Self[src]

pub fn on_receive<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &String)) -> TGResult<()> + Send + Sync + 'static, 
[src]

when receive data from tdlib

pub fn on_exception<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &TGError)) + Send + Sync + 'static, 
[src]

when telegram client throw exception

pub fn on_error<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &Error)) -> TGResult<()> + Send + Sync + 'static, 
[src]

An object of this type can be returned on every function call, in case of an error

pub fn on_ok<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &Ok)) -> TGResult<()> + Send + Sync + 'static, 
[src]

An object of this type is returned on a successful function call for certain functions

pub fn on_proxy<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &Proxy)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Contains information about a proxy server

pub fn on_authorization_state<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateAuthorizationState)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The user authorization state has changed

pub fn on_new_message<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateNewMessage)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A new message was received; can also be an outgoing message

pub fn on_message_send_acknowledged<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateMessageSendAcknowledged)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A request to send a message has reached the Telegram server. This doesn't mean that the message will be sent successfully or even that the send message request will be processed. This update will be sent only if the option "use_quick_ack" is set to true. This update may be sent multiple times for the same message

pub fn on_message_send_succeeded<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateMessageSendSucceeded)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A message has been successfully sent

pub fn on_message_send_failed<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateMessageSendFailed)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A message failed to send. Be aware that some messages being sent can be irrecoverably deleted, in which case updateDeleteMessages will be received instead of this update

pub fn on_message_content<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateMessageContent)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The message content has changed

pub fn on_message_edited<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateMessageEdited)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A message was edited. Changes in the message content will come in a separate updateMessageContent

pub fn on_message_views<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateMessageViews)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The view count of the message has changed

pub fn on_message_content_opened<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateMessageContentOpened)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The message content was opened. Updates voice note messages to "listened", video note messages to "viewed" and starts the TTL timer for self-destructing messages

pub fn on_message_mention_read<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateMessageMentionRead)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A message with an unread mention was read

pub fn on_new_chat<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateNewChat)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A new chat has been loaded/created. This update is guaranteed to come before the chat identifier is returned to the client. The chat field changes will be reported through separate updates

pub fn on_chat_title<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatTitle)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The title of a chat was changed

pub fn on_chat_photo<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatPhoto)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A chat photo was changed

pub fn on_chat_last_message<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatLastMessage)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The last message of a chat was changed. If last_message is null then the last message in the chat became unknown. Some new unknown messages might be added to the chat in this case

pub fn on_chat_order<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatOrder)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The order of the chat in the chat list has changed. Instead of this update updateChatLastMessage, updateChatIsPinned or updateChatDraftMessage might be sent

pub fn on_chat_is_pinned<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatIsPinned)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A chat was pinned or unpinned

pub fn on_chat_is_marked_as_unread<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatIsMarkedAsUnread)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A chat was marked as unread or was read

pub fn on_chat_is_sponsored<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatIsSponsored)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A chat's is_sponsored field has changed

pub fn on_chat_default_disable_notification<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatDefaultDisableNotification)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The value of the default disable_notification parameter, used when a message is sent to the chat, was changed

pub fn on_chat_read_inbox<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatReadInbox)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Incoming messages were read or number of unread messages has been changed

pub fn on_chat_read_outbox<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatReadOutbox)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Outgoing messages were read

pub fn on_chat_unread_mention_count<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatUnreadMentionCount)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The chat unread_mention_count has changed

pub fn on_chat_notification_settings<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatNotificationSettings)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Notification settings for a chat were changed

pub fn on_scope_notification_settings<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateScopeNotificationSettings)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Notification settings for some type of chats were updated

pub fn on_chat_pinned_message<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatPinnedMessage)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The chat pinned message was changed

pub fn on_chat_reply_markup<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatReplyMarkup)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The default chat reply markup was changed. Can occur because new messages with reply markup were received or because an old reply markup was hidden by the user

pub fn on_chat_draft_message<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatDraftMessage)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A chat draft has changed. Be aware that the update may come in the currently opened chat but with old content of the draft. If the user has changed the content of the draft, this update shouldn't be applied

pub fn on_chat_online_member_count<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateChatOnlineMemberCount)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The number of online group members has changed. This update with non-zero count is sent only for currently opened chats. There is no guarantee that it will be sent just after the count has changed

pub fn on_notification<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateNotification)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A notification was changed

pub fn on_notification_group<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateNotificationGroup)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A list of active notifications in a notification group has changed

pub fn on_active_notifications<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateActiveNotifications)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Contains active notifications that was shown on previous application launches. This update is sent only if a message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update

pub fn on_have_pending_notifications<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateHavePendingNotifications)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Describes, whether there are some pending notification updates. Can be used to prevent application from killing, while there are some pending notifications

pub fn on_delete_messages<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateDeleteMessages)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Some messages were deleted

pub fn on_user_chat_action<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateUserChatAction)) -> TGResult<()> + Send + Sync + 'static, 
[src]

User activity in the chat has changed

pub fn on_user_status<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateUserStatus)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The user went online or offline

pub fn on_user<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateUser)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Some data of a user has changed. This update is guaranteed to come before the user identifier is returned to the client

pub fn on_basic_group<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateBasicGroup)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Some data of a basic group has changed. This update is guaranteed to come before the basic group identifier is returned to the client

pub fn on_supergroup<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateSupergroup)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Some data of a supergroup or a channel has changed. This update is guaranteed to come before the supergroup identifier is returned to the client

pub fn on_secret_chat<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateSecretChat)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Some data of a secret chat has changed. This update is guaranteed to come before the secret chat identifier is returned to the client

pub fn on_user_full_info<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateUserFullInfo)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Some data from userFullInfo has been changed

pub fn on_basic_group_full_info<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateBasicGroupFullInfo)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Some data from basicGroupFullInfo has been changed

pub fn on_supergroup_full_info<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateSupergroupFullInfo)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Some data from supergroupFullInfo has been changed

pub fn on_service_notification<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateServiceNotification)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Service notification from the server. Upon receiving this the client must show a popup with the content of the notification

pub fn on_file<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateFile)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Information about a file was updated

pub fn on_file_generation_start<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateFileGenerationStart)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The file generation process needs to be started by the client

pub fn on_file_generation_stop<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateFileGenerationStop)) -> TGResult<()> + Send + Sync + 'static, 
[src]

File generation is no longer needed

pub fn on_call<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateCall)) -> TGResult<()> + Send + Sync + 'static, 
[src]

New call was created or information about a call was updated

pub fn on_user_privacy_setting_rules<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateUserPrivacySettingRules)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Some privacy setting rules have been changed

pub fn on_unread_message_count<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateUnreadMessageCount)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Number of unread messages has changed. This update is sent only if a message database is used

pub fn on_unread_chat_count<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateUnreadChatCount)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Number of unread chats, i.e. with unread messages or marked as unread, has changed. This update is sent only if a message database is used

pub fn on_option<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateOption)) -> TGResult<()> + Send + Sync + 'static, 
[src]

An option changed its value

pub fn on_installed_sticker_sets<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateInstalledStickerSets)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The list of installed sticker sets was updated

The list of trending sticker sets was updated or some of them were viewed

pub fn on_recent_stickers<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateRecentStickers)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The list of recently used stickers was updated

pub fn on_favorite_stickers<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateFavoriteStickers)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The list of favorite stickers was updated

pub fn on_saved_animations<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateSavedAnimations)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The list of saved animations was updated

pub fn on_language_pack_strings<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateLanguagePackStrings)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Some language pack strings have been updated

pub fn on_connection_state<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateConnectionState)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The connection state has changed

pub fn on_terms_of_service<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateTermsOfService)) -> TGResult<()> + Send + Sync + 'static, 
[src]

New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method should be called with the reason "Decline ToS update"

pub fn on_new_inline_query<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateNewInlineQuery)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A new incoming inline query; for bots only

pub fn on_new_chosen_inline_result<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateNewChosenInlineResult)) -> TGResult<()> + Send + Sync + 'static, 
[src]

The user has chosen a result of an inline query; for bots only

pub fn on_new_callback_query<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateNewCallbackQuery)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A new incoming callback query; for bots only

pub fn on_new_inline_callback_query<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateNewInlineCallbackQuery)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A new incoming callback query from a message sent via a bot; for bots only

pub fn on_new_shipping_query<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateNewShippingQuery)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A new incoming shipping query; for bots only. Only for invoices with flexible price

pub fn on_new_pre_checkout_query<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateNewPreCheckoutQuery)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A new incoming pre-checkout query; for bots only. Contains full information about a checkout

pub fn on_new_custom_event<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateNewCustomEvent)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A new incoming event; for bots only

pub fn on_new_custom_query<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdateNewCustomQuery)) -> TGResult<()> + Send + Sync + 'static, 
[src]

A new incoming query; for bots only

pub fn on_poll<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &UpdatePoll)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Information about a poll was updated; for bots only

pub fn on_test_use_update<F>(&mut self, fnc: F) -> &mut Self where
    F: Fn((&Api, &TestUseUpdate)) -> TGResult<()> + Send + Sync + 'static, 
[src]

Does nothing and ensures that the Update object is used; for testing only. This is an offline method. Can be called before authorization

Trait Implementations

impl Clone for Listener[src]

impl Default for Listener[src]

Auto Trait Implementations

impl Send for Listener

impl Sync for Listener

impl Unpin for Listener

impl !UnwindSafe for Listener

impl !RefUnwindSafe for Listener

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]