messages.SendMessage
- class pyrogram.raw.functions.messages.SendMessage
Sends a message to a chat
- Details:
Layer:
223ID:
545CD15A
- Parameters:
peer (
InputPeer) – The destination where the message will be sentmessage (
str) – The messagerandom_id (
int64-bit) – Unique client message ID required to prevent message resendingno_webpage (
bool, optional) – Set this flag to disable generation of the webpage previewsilent (
bool, optional) – Send this message silently (no notifications for the receivers)background (
bool, optional) – Send this message as background messageclear_draft (
bool, optional) – Clear the draft fieldnoforwards (
bool, optional) – Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn’t have content protection enabledupdate_stickersets_order (
bool, optional) – Whether to move used stickersets to top, see here for more info on this flag »invert_media (
bool, optional) – If set, any eventual webpage preview will be shown on top of the message instead of at the bottom.allow_paid_floodskip (
bool, optional) – Bots only: if set, allows sending 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.reply_to (
InputReplyTo, optional) – If set, indicates that the message should be sent in reply to the specified message or story. Also used to quote other messages.reply_markup (
ReplyMarkup, optional) – Reply markup for sending bot buttonsentities (List of
MessageEntity, optional) – Message entities for sending styled textschedule_date (
int32-bit, optional) – Scheduled message date for scheduled messagesschedule_repeat_period (
int32-bit, optional)send_as (
InputPeer, optional) – Send this message as the specified peerquick_reply_shortcut (
InputQuickReplyShortcut, optional) – Add the message to the specified quick reply shortcut », instead.effect (
int64-bit, optional) – Specifies a message effect » to use for the message.allow_paid_stars (
int64-bit, optional) – For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message.suggested_post (
SuggestedPost, optional) – Used to suggest a post to a channel, see here » for more info on the full flow.
- Returns:
TL Schema
messages.sendMessage#545cd15a
flags:#
no_webpage:flags.1?true
silent:flags.5?true
background:flags.6?true
clear_draft:flags.7?true
noforwards:flags.14?true
update_stickersets_order:flags.15?true
invert_media:flags.16?true
allow_paid_floodskip:flags.19?true
peer:InputPeer
reply_to:flags.0?InputReplyTo
message:string
random_id:long
reply_markup:flags.2?ReplyMarkup
entities:flags.3?Vector<MessageEntity>
schedule_date:flags.10?int
schedule_repeat_period:flags.24?int
send_as:flags.13?InputPeer
quick_reply_shortcut:flags.17?InputQuickReplyShortcut
effect:flags.18?long
allow_paid_stars:flags.21?long
suggested_post:flags.22?SuggestedPost
= Updates
Parameter Tree
true (optional)true (optional)true (optional)true (optional)true (optional)true (optional)true (optional)true (optional)InputPeerInputPeerEmptyInputPeerSelfInputPeerChatlongInputPeerUserlonglongInputPeerChannellonglongInputPeerUserFromMessageInputPeerInputPeerEmptyInputPeerSelfInputPeerChatInputPeerUserInputPeerChannelInputPeerUserFromMessageInputPeerChannelFromMessageintlongInputPeerInputPeerEmptyInputPeerSelfInputPeerChatInputPeerUserInputPeerChannelInputPeerUserFromMessageInputPeerChannelFromMessageintlongInputReplyTo (optional)InputReplyToMessageintint (optional)InputPeer (optional)InputPeerEmptyInputPeerSelfInputPeerChatInputPeerUserInputPeerChannelInputPeerUserFromMessageInputPeerChannelFromMessagestring (optional)Vector < MessageEntity > (optional)MessageEntityUnknownintintMessageEntityMentionintintMessageEntityHashtagintintMessageEntityBotCommandintintMessageEntityUrlintintMessageEntityEmailintintMessageEntityBoldintintMessageEntityItalicintintMessageEntityCodeintintMessageEntityPreintintstringMessageEntityTextUrlintintstringMessageEntityMentionNameintintlongInputMessageEntityMentionNameintintInputUserInputUserEmptyInputUserSelfInputUserInputUserFromMessageMessageEntityPhoneintintMessageEntityCashtagintintMessageEntityUnderlineintintMessageEntityStrikeintintMessageEntityBankCardintintMessageEntitySpoilerintintMessageEntityCustomEmojiintintlongMessageEntityBlockquotetrue (optional)intintMessageEntityFormattedDatetrue (optional)true (optional)true (optional)true (optional)true (optional)true (optional)intintintint (optional)InputPeer (optional)InputPeerEmptyInputPeerSelfInputPeerChatInputPeerUserInputPeerChannelInputPeerUserFromMessageInputPeerChannelFromMessageint (optional)InputReplyToStoryInputPeerInputPeerEmptyInputPeerSelfInputPeerChatInputPeerUserInputPeerChannelInputPeerUserFromMessageInputPeerChannelFromMessageintInputReplyToMonoForumInputPeerInputPeerEmptyInputPeerSelfInputPeerChatInputPeerUserInputPeerChannelInputPeerUserFromMessagestringlongReplyMarkup (optional)ReplyKeyboardHidetrue (optional)ReplyKeyboardForceReplytrue (optional)true (optional)string (optional)ReplyKeyboardMarkuptrue (optional)true (optional)true (optional)true (optional)Vector < KeyboardButtonRow >KeyboardButtonRowVector < KeyboardButton >KeyboardButtonKeyboardButtonUrlKeyboardButtonCallbackKeyboardButtonRequestPhoneKeyboardButtonRequestGeoLocationKeyboardButtonSwitchInlineKeyboardButtonGameKeyboardButtonBuyKeyboardButtonUrlAuthInputKeyboardButtonUrlAuthKeyboardButtonRequestPollInputKeyboardButtonUserProfileKeyboardButtonUserProfileKeyboardButtonWebViewKeyboardButtonSimpleWebViewKeyboardButtonRequestPeerInputKeyboardButtonRequestPeerKeyboardButtonCopystring (optional)ReplyInlineMarkupVector < KeyboardButtonRow >KeyboardButtonRowVector < KeyboardButton >KeyboardButtonKeyboardButtonUrlKeyboardButtonCallbackKeyboardButtonGameKeyboardButtonBuyKeyboardButtonUrlAuthKeyboardButtonWebViewKeyboardButtonCopyVector < MessageEntity > (optional)MessageEntityUnknownintintMessageEntityMentionintintMessageEntityHashtagintintMessageEntityBotCommandintintMessageEntityUrlintintMessageEntityEmailintintMessageEntityBoldintintMessageEntityItalicintintMessageEntityCodeintintMessageEntityPreintintstringMessageEntityTextUrlintintstringMessageEntityMentionNameintintlongintintInputUserInputUserEmptyInputUserSelfInputUserInputUserFromMessageMessageEntityPhoneintintMessageEntityCashtagintintMessageEntityUnderlineintintMessageEntityStrikeintintMessageEntityBankCardintintMessageEntitySpoilerintintMessageEntityCustomEmojiintintlongMessageEntityBlockquotetrue (optional)intinttrue (optional)true (optional)true (optional)true (optional)true (optional)true (optional)intintintint (optional)int (optional)InputPeer (optional)InputPeerEmptyInputPeerSelfInputPeerChatlongInputPeerUserlonglongInputPeerChannellonglongInputPeerUserFromMessageInputPeerInputPeerEmptyInputPeerSelfInputPeerChatInputPeerUserInputPeerChannelInputPeerUserFromMessageInputPeerChannelFromMessageintlongInputPeerInputPeerEmptyInputPeerSelfInputPeerChatInputPeerUserInputPeerChannelInputPeerUserFromMessageInputPeerChannelFromMessageintlongInputQuickReplyShortcut (optional)InputQuickReplyShortcutstringintlong (optional)long (optional)SuggestedPost (optional)SuggestedPosttrue (optional)true (optional)StarsAmount (optional)StarsAmountlongintStarsTonAmountlongint (optional)Example
await app.invoke(
SendMessage(
no_webpage=None,
silent=None,
background=None,
clear_draft=None,
noforwards=None,
update_stickersets_order=None,
invert_media=None,
allow_paid_floodskip=None,
peer=await app.resolve_peer(chat_id),
reply_to=InputReplyToMessage(
reply_to_msg_id=0,
top_msg_id=None,
reply_to_peer_id=None,
quote_text=None,
quote_entities=None,
quote_offset=None,
monoforum_peer_id=None,
todo_item_id=None
),
message="Hello",
random_id=app.rnd_id(),
reply_markup=ReplyInlineMarkup(rows=[
KeyboardButtonRow(buttons=[
KeyboardButtonUrl(
style=None,
text="Open",
url="https://google.com"
)
])
]),
entities=[
MessageEntityUnknown(
offset=0,
length=0
)
],
schedule_date=0,
schedule_repeat_period=0,
send_as=await app.resolve_peer(chat_id),
quick_reply_shortcut=InputQuickReplyShortcut(shortcut="text"),
effect=0,
allow_paid_stars=0,
suggested_post=SuggestedPost(
accepted=None,
rejected=None,
price=None,
schedule_date=None
),
)
)