SendMedia
---functions--- messages.sendMedia#0330e77f 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 media:InputMedia 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
Returns
| Updates |
Parameters
| silent | true | optional |
| background | true | optional |
| clear_draft | true | optional |
| noforwards | true | optional |
| update_stickersets_order | true | optional |
| invert_media | true | optional |
| allow_paid_floodskip | true | optional |
| peer | InputPeer | required |
| reply_to | InputReplyTo | optional |
| media | InputMedia | required |
| message | string | required |
| random_id | long | required |
| reply_markup | ReplyMarkup | optional |
| entities | Vector<MessageEntity> | optional |
| schedule_date | int | optional |
| schedule_repeat_period | int | optional |
| send_as | InputPeer | optional |
| quick_reply_shortcut | InputQuickReplyShortcut | optional |
| effect | long | optional |
| allow_paid_stars | long | optional |
| suggested_post | SuggestedPost | optional |
Example
The examples below use placeholder values. Replace them with real data before running the code.
▶ Minimal
import asyncio
import random
from ferogram import Client, raw
app = Client("my_session", api_id=12345, api_hash="0123456789abcdef0123456789abcdef")
async def main():
await app.start()
result = await app.raw.messages.SendMedia(
peer='username',
media=raw.types.InputMediaEmpty(),
message='Hello there!',
random_id=random.randrange(-2**63, 2**63)
)
print(result)
asyncio.run(main())
The minimal example uses Ferogram's raw proxy shorthand. Peers can be passed as strings and required primitives get safe defaults. Expand Full API to see every parameter.
▶ Full API
import asyncio
import random
from ferogram import Client, raw
app = Client("my_session", api_id=12345, api_hash="0123456789abcdef0123456789abcdef")
async def main():
await app.start()
result = await app(raw.functions.messages.SendMedia(
silent=True,
background=True,
clear_draft=True,
noforwards=True,
update_stickersets_order=True,
invert_media=True,
allow_paid_floodskip=True,
peer=raw.types.InputPeerSelf(),
reply_to=raw.types.InputReplyToMessage(reply_to_msg_id=42),
media=raw.types.InputMediaEmpty(),
message='Hello there!',
random_id=random.randrange(-2**63, 2**63),
reply_markup=raw.types.ReplyKeyboardHide(),
entities=[raw.types.MessageEntityUnknown(offset=0, length=1)],
schedule_date=42,
schedule_repeat_period=42,
send_as=raw.types.InputPeerSelf(),
quick_reply_shortcut=raw.types.InputQuickReplyShortcutId(shortcut_id=0),
effect=-12398745604826,
allow_paid_stars=-12398745604826,
suggested_post=raw.types.SuggestedPost(date=0)
))
print(result)
asyncio.run(main())