Skip to main content

ronami_core/payloads/
send_voice.rs

1//! Generated by `codegen_payloads`, do not edit by hand.
2
3use serde::Serialize;
4
5use crate::types::BusinessConnectionId;
6use crate::types::EffectId;
7use crate::types::EphemeralMessageParameters;
8use crate::types::InputFile;
9use crate::types::Message;
10use crate::types::MessageEntity;
11use crate::types::ParseMode;
12use crate::types::Recipient;
13use crate::types::ReplyMarkup;
14use crate::types::ReplyParameters;
15use crate::types::SuggestedPostParameters;
16use crate::types::ThreadId;
17use crate::types::TopicId;
18
19impl_payload! {
20    @[multipart = voice]
21    /// Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as [`Audio`] or [`Document`]). On success, the sent [`Message`] is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
22    ///
23    /// [`Document`]: crate::types::Document
24    /// [`Audio`]: crate::types::Audio
25    /// [`Message`]: crate::types::Message
26    #[derive(Debug, Clone, Serialize)]
27    pub SendVoice (SendVoiceSetters) => Message {
28        required {
29            /// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
30            pub chat_id: Recipient [into],
31            /// Audio file to send. Pass a file_id as FileId to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. [More info on Sending Files »]
32            ///
33            /// [More info on Sending Files »]: crate::types::InputFile
34            pub voice: InputFile,
35        }
36        optional {
37            /// Unique identifier of the business connection on behalf of which the message will be sent
38            pub business_connection_id: BusinessConnectionId,
39            /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
40            pub message_thread_id: ThreadId,
41            /// Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
42            pub direct_messages_topic_id: TopicId,
43            /// Voice message caption, 0-1024 characters after entities parsing
44            pub caption: String [into],
45            /// Mode for parsing entities in the voice message caption. See [formatting options] for more details.
46            ///
47            /// [formatting options]: https://core.telegram.org/bots/api#formatting-options
48            pub parse_mode: ParseMode,
49            /// List of special entities that appear in the photo caption, which can be specified instead of _parse\_mode_
50            pub caption_entities: Vec<MessageEntity> [collect],
51            /// Duration of the voice message in seconds
52            pub duration: u32,
53            /// Sends the message [silently]. Users will receive a notification with no sound.
54            ///
55            /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
56            pub disable_notification: bool,
57            /// Protects the contents of sent message from forwarding and saving
58            pub protect_content: bool,
59            /// 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
60            pub allow_paid_broadcast: bool,
61            /// Unique identifier of the message effect to be added to the message; for private chats only
62            pub message_effect_id: EffectId,
63            /// An object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
64            pub suggested_post_parameters: SuggestedPostParameters,
65            /// A JSON-serialized object containing the parameters of the ephemeral message to send
66            pub ephemeral_message_parameters: EphemeralMessageParameters,
67            /// Description of the message to reply to
68            pub reply_parameters: ReplyParameters,
69            /// 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.
70            ///
71            /// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
72            /// [custom reply keyboard]: https://core.telegram.org/bots#keyboards
73            pub reply_markup: ReplyMarkup [into],
74        }
75    }
76}