Skip to main content

teloxide_core_ng/payloads/
send_message.rs

1//! Generated by `codegen_payloads`, do not edit by hand.
2
3use serde::Serialize;
4
5use crate::types::{
6    BusinessConnectionId, EffectId, LinkPreviewOptions, Message, MessageEntity, ParseMode,
7    Recipient, ReplyMarkup, ReplyParameters, ThreadId,
8};
9
10impl_payload! {
11    /// Use this method to send text messages. On success, the sent [`Message`] is returned.
12    ///
13    /// [`Message`]: crate::types::Message
14    #[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
15    pub SendMessage (SendMessageSetters) => Message {
16        required {
17            /// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
18            pub chat_id: Recipient [into],
19            /// Text of the message to be sent, 1-4096 characters after entities parsing
20            pub text: String [into],
21        }
22        optional {
23            /// Unique identifier of the business connection on behalf of which the message will be sent
24            pub business_connection_id: BusinessConnectionId,
25            /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
26            pub message_thread_id: ThreadId,
27            /// Mode for parsing entities in the message text. See [formatting options] for more details.
28            ///
29            /// [formatting options]: https://core.telegram.org/bots/api#formatting-options
30            pub parse_mode: ParseMode,
31            /// List of special entities that appear in the message text, which can be specified instead of _parse\_mode_
32            pub entities: Vec<MessageEntity> [collect],
33            /// Link preview generation options for the message
34            pub link_preview_options: LinkPreviewOptions,
35            /// Sends the message [silently]. Users will receive a notification with no sound.
36            ///
37            /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
38            pub disable_notification: bool,
39            /// Protects the contents of sent messages from forwarding and saving
40            pub protect_content: bool,
41            /// Pass `true` to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
42            pub allow_paid_broadcast: bool,
43            /// Unique identifier of the message effect to be added to the message; for private chats only
44            pub message_effect_id: EffectId,
45            /// Description of the message to reply to
46            pub reply_parameters: ReplyParameters,
47            /// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account.
48            ///
49            /// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
50            /// [custom reply keyboard]: https://core.telegram.org/bots#keyboards
51            pub reply_markup: ReplyMarkup [into],
52        }
53    }
54}