pub trait SendMessageSetters: HasPayload<Payload = SendMessage> + Sized {
Show 16 methods
// Provided methods
fn text<T>(self, value: T) -> Self
where T: Into<String> { ... }
fn business_connection_id(self, value: BusinessConnectionId) -> Self { ... }
fn chat_id<T>(self, value: T) -> Self
where T: Into<Recipient> { ... }
fn ephemeral_message_parameters(
self,
value: EphemeralMessageParameters,
) -> Self { ... }
fn message_thread_id(self, value: ThreadId) -> Self { ... }
fn direct_messages_topic_id(self, value: TopicId) -> Self { ... }
fn parse_mode(self, value: ParseMode) -> Self { ... }
fn entities<T>(self, value: T) -> Self
where T: IntoIterator<Item = MessageEntity> { ... }
fn link_preview_options(self, value: LinkPreviewOptions) -> Self { ... }
fn disable_notification(self, value: bool) -> Self { ... }
fn protect_content(self, value: bool) -> Self { ... }
fn allow_paid_broadcast(self, value: bool) -> Self { ... }
fn message_effect_id(self, value: EffectId) -> Self { ... }
fn suggested_post_parameters(self, value: SuggestedPostParameters) -> Self { ... }
fn reply_parameters(self, value: ReplyParameters) -> Self { ... }
fn reply_markup<T>(self, value: T) -> Self
where T: Into<ReplyMarkup> { ... }
}Expand description
Setters for fields of SendMessage
Provided Methods§
Sourcefn business_connection_id(self, value: BusinessConnectionId) -> Self
fn business_connection_id(self, value: BusinessConnectionId) -> Self
Setter for business_connection_id field.
Sourcefn chat_id<T>(self, value: T) -> Self
fn chat_id<T>(self, value: T) -> Self
Setter for chat_id field.
Examples found in repository?
examples/self_info.rs (line 18)
7async fn main() -> Result<(), Box<dyn std::error::Error>> {
8 pretty_env_logger::init();
9
10 let chat_id =
11 ChatId(std::env::var("CHAT_ID").expect("Expected CHAT_ID env var").parse::<i64>()?);
12
13 let bot = Bot::from_env().parse_mode(ParseMode::MarkdownV2);
14
15 let me = bot.get_me().await?;
16
17 bot.send_dice(chat_id).emoji(DiceEmoji::Dice).await?;
18 bot.send_message(format!("Hi, my name is **{}** 👋", me.first_name)).chat_id(chat_id).await?;
19
20 Ok(())
21}More examples
examples/erased.rs (line 39)
6async fn main() -> Result<(), Box<dyn std::error::Error>> {
7 pretty_env_logger::init();
8
9 let chat_id =
10 ChatId(std::env::var("CHAT_ID").expect("Expected CHAT_ID env var").parse::<i64>()?);
11
12 let trace_settings = match std::env::var("TRACE").as_deref() {
13 Ok("EVERYTHING_VERBOSE") => trace::Settings::TRACE_EVERYTHING_VERBOSE,
14 Ok("EVERYTHING") => trace::Settings::TRACE_EVERYTHING,
15 Ok("REQUESTS_VERBOSE") => trace::Settings::TRACE_REQUESTS_VERBOSE,
16 Ok("REQUESTS") => trace::Settings::TRACE_REQUESTS,
17 Ok("RESPONSES_VERBOSE") => trace::Settings::TRACE_RESPONSES_VERBOSE,
18 Ok("RESPONSES") => trace::Settings::TRACE_RESPONSES,
19 Ok("EMPTY") | Ok("") | Err(VarError::NotPresent) => trace::Settings::empty(),
20 Ok(_) | Err(VarError::NotUnicode(_)) => {
21 panic!(
22 "Expected `TRACE` environment variable to be equal to any of the following: \
23 `EVERYTHING_VERBOSE`, `EVERYTHING`, `REQUESTS_VERBOSE`, `REQUESTS`, \
24 `RESPONSES_VERBOSE`, `RESPONSES`, `EMPTY`, `` (empty string)"
25 )
26 }
27 };
28
29 log::info!("Trace settings: {trace_settings:?}");
30
31 let bot = if trace_settings.is_empty() {
32 Bot::from_env().erase()
33 } else {
34 Bot::from_env().trace(trace_settings).erase()
35 };
36
37 bot.send_chat_action(chat_id, ChatAction::Typing).await?;
38 tokio::time::sleep(Duration::from_secs(1)).await;
39 bot.send_message("Hey hey hey").chat_id(chat_id).await?;
40
41 Ok(())
42}Sourcefn ephemeral_message_parameters(self, value: EphemeralMessageParameters) -> Self
fn ephemeral_message_parameters(self, value: EphemeralMessageParameters) -> Self
Setter for ephemeral_message_parameters field.
Sourcefn message_thread_id(self, value: ThreadId) -> Self
fn message_thread_id(self, value: ThreadId) -> Self
Setter for message_thread_id field.
Sourcefn direct_messages_topic_id(self, value: TopicId) -> Self
fn direct_messages_topic_id(self, value: TopicId) -> Self
Setter for direct_messages_topic_id field.
Sourcefn parse_mode(self, value: ParseMode) -> Self
fn parse_mode(self, value: ParseMode) -> Self
Setter for parse_mode field.
Sourcefn entities<T>(self, value: T) -> Selfwhere
T: IntoIterator<Item = MessageEntity>,
fn entities<T>(self, value: T) -> Selfwhere
T: IntoIterator<Item = MessageEntity>,
Setter for entities field.
Sourcefn link_preview_options(self, value: LinkPreviewOptions) -> Self
fn link_preview_options(self, value: LinkPreviewOptions) -> Self
Setter for link_preview_options field.
Sourcefn disable_notification(self, value: bool) -> Self
fn disable_notification(self, value: bool) -> Self
Setter for disable_notification field.
Sourcefn protect_content(self, value: bool) -> Self
fn protect_content(self, value: bool) -> Self
Setter for protect_content field.
Sourcefn allow_paid_broadcast(self, value: bool) -> Self
fn allow_paid_broadcast(self, value: bool) -> Self
Setter for allow_paid_broadcast field.
Sourcefn message_effect_id(self, value: EffectId) -> Self
fn message_effect_id(self, value: EffectId) -> Self
Setter for message_effect_id field.
Sourcefn suggested_post_parameters(self, value: SuggestedPostParameters) -> Self
fn suggested_post_parameters(self, value: SuggestedPostParameters) -> Self
Setter for suggested_post_parameters field.
Sourcefn reply_parameters(self, value: ReplyParameters) -> Self
fn reply_parameters(self, value: ReplyParameters) -> Self
Setter for reply_parameters field.
Sourcefn reply_markup<T>(self, value: T) -> Selfwhere
T: Into<ReplyMarkup>,
fn reply_markup<T>(self, value: T) -> Selfwhere
T: Into<ReplyMarkup>,
Setter for reply_markup field.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".