Type Alias grammers_client::client::messages::SearchIter
source · pub type SearchIter = IterBuffer<Search, Message>;
Aliased Type§
struct SearchIter { /* private fields */ }
Implementations§
source§impl SearchIter
impl SearchIter
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.