pub struct IterBuffer<R, T> { /* private fields */ }
Expand description
Common parts to all requests that are used for creating iterators.
End-users should obtain particular instances of this type via client methods.
Implementations§
Source§impl IterBuffer<GetInlineBotResults, InlineResult>
impl IterBuffer<GetInlineBotResults, InlineResult>
Sourcepub fn chat<C: Into<PackedChat>>(self, chat: C) -> Self
pub fn chat<C: Into<PackedChat>>(self, chat: C) -> Self
Indicate the bot the chat where this inline query will be sent to.
Some bots use this information to return different results depending on the type of the chat, and some even “need” it to give useful results.
Sourcepub async fn next(&mut self) -> Result<Option<InlineResult>, InvocationError>
pub async fn next(&mut self) -> Result<Option<InlineResult>, InvocationError>
Return the next InlineResult
from the internal buffer, filling the buffer previously if
it’s empty.
Returns None
if the limit
is reached or there are no results left.
Source§impl IterBuffer<GetDialogs, Dialog>
impl IterBuffer<GetDialogs, Dialog>
Sourcepub async fn total(&mut self) -> Result<usize, InvocationError>
pub async fn total(&mut self) -> Result<usize, InvocationError>
Determines how many dialogs there are in total.
This only performs a network call if next
has not been called before.
Source§impl IterBuffer<GetHistory, Message>
impl IterBuffer<GetHistory, Message>
Source§impl IterBuffer<Search, Message>
impl IterBuffer<Search, Message>
pub fn offset_id(self, offset: i32) -> Self
Sourcepub fn query(self, query: &str) -> Self
pub fn query(self, query: &str) -> Self
Changes the query of the search. Telegram servers perform a somewhat fuzzy search over this query (so a word in singular may also return messages with the word in plural, for example).
Sourcepub fn sent_by_self(self) -> Self
pub fn sent_by_self(self) -> Self
Restricts results to messages sent by the logged-in user
Sourcepub fn min_date(self, date_time: &DateTime<FixedOffset>) -> Self
pub fn min_date(self, date_time: &DateTime<FixedOffset>) -> Self
Returns only messages with date bigger than date_time.
use chrono::DateTime;
// Search messages sent after Jan 1st, 2021
let min_date = DateTime::parse_from_rfc3339("2021-01-01T00:00:00-00:00").unwrap();
let mut messages = client.search_messages(&chat).min_date(&min_date);
Sourcepub fn max_date(self, date_time: &DateTime<FixedOffset>) -> Self
pub fn max_date(self, date_time: &DateTime<FixedOffset>) -> Self
Returns only messages with date smaller than date_time
use chrono::DateTime;
// Search messages sent before Dec, 25th 2022
let max_date = DateTime::parse_from_rfc3339("2022-12-25T00:00:00-00:00").unwrap();
let mut messages = client.search_messages(&chat).max_date(&max_date);
Sourcepub fn filter(self, filter: MessagesFilter) -> Self
pub fn filter(self, filter: MessagesFilter) -> Self
Changes the media filter. Only messages with this type of media will be fetched.
Sourcepub async fn total(&mut self) -> Result<usize, InvocationError>
pub async fn total(&mut self) -> Result<usize, InvocationError>
Determines how many messages there are in total.
This only performs a network call if next
has not been called before.
Source§impl IterBuffer<SearchGlobal, Message>
impl IterBuffer<SearchGlobal, Message>
pub fn offset_id(self, offset: i32) -> Self
Sourcepub fn query(self, query: &str) -> Self
pub fn query(self, query: &str) -> Self
Changes the query of the search. Telegram servers perform a somewhat fuzzy search over this query (so a word in singular may also return messages with the word in plural, for example).
Sourcepub fn filter(self, filter: MessagesFilter) -> Self
pub fn filter(self, filter: MessagesFilter) -> Self
Changes the media filter. Only messages with this type of media will be fetched.
Sourcepub async fn total(&mut self) -> Result<usize, InvocationError>
pub async fn total(&mut self) -> Result<usize, InvocationError>
Determines how many messages there are in total.
This only performs a network call if next
has not been called before.