Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
attributes=[
types.DocumentAttributeVideo(
round_message=True,
duration=duration,
w=length,
h=length
)
]
)
else:
media = utils.get_input_media_from_file_id(video_note, file_ref, 13)
while True:
try:
r = self.send(
functions.messages.SendMedia(
peer=self.resolve_peer(chat_id),
media=media,
silent=disable_notification or None,
reply_to_msg_id=reply_to_message_id,
random_id=self.rnd_id(),
schedule_date=schedule_date,
reply_markup=reply_markup.write() if reply_markup else None,
message=""
)
)
except FilePartMissing as e:
self.save_file(video_note, file_id=file.id, file_part=e.x)
else:
for i in r.updates:
if isinstance(
i,
Date when the message will be automatically sent. Unix time.
reply_markup (:obj:`InlineKeyboardMarkup` | :obj:`ReplyKeyboardMarkup` | :obj:`ReplyKeyboardRemove` | :obj:`ForceReply`, *optional*):
Additional interface options. An object for an inline keyboard, custom reply keyboard,
instructions to remove reply keyboard or to force a reply from the user.
Returns:
:obj:`Message`: On success, the sent location message is returned.
Example:
.. code-block:: python
app.send_location("me", 51.500729, -0.124583)
"""
r = self.send(
functions.messages.SendMedia(
peer=self.resolve_peer(chat_id),
media=types.InputMediaGeoPoint(
geo_point=types.InputGeoPoint(
lat=latitude,
long=longitude
)
),
message="",
silent=disable_notification or None,
reply_to_msg_id=reply_to_message_id,
random_id=self.rnd_id(),
schedule_date=schedule_date,
reply_markup=reply_markup.write() if reply_markup else None
)
)
reply_markup (:obj:`InlineKeyboardMarkup` | :obj:`ReplyKeyboardMarkup` | :obj:`ReplyKeyboardRemove` | :obj:`ForceReply`, *optional*):
Additional interface options. An object for an inline keyboard, custom reply keyboard,
instructions to remove reply keyboard or to force a reply from the user.
Returns:
:obj:`Message`: On success, the sent venue message is returned.
Example:
.. code-block:: python
app.send_venue(
"me", 51.500729, -0.124583,
"Elizabeth Tower", "Westminster, London SW1A 0AA, UK")
"""
r = self.send(
functions.messages.SendMedia(
peer=self.resolve_peer(chat_id),
media=types.InputMediaVenue(
geo_point=types.InputGeoPoint(
lat=latitude,
long=longitude
),
title=title,
address=address,
provider="",
venue_id=foursquare_id,
venue_type=foursquare_type
),
message="",
silent=disable_notification or None,
reply_to_msg_id=reply_to_message_id,
random_id=self.rnd_id(),
Date when the message will be automatically sent. Unix time.
reply_markup (:obj:`InlineKeyboardMarkup` | :obj:`ReplyKeyboardMarkup` | :obj:`ReplyKeyboardRemove` | :obj:`ForceReply`, *optional*):
Additional interface options. An object for an inline keyboard, custom reply keyboard,
instructions to remove reply keyboard or to force a reply from the user.
Returns:
:obj:`Message`: On success, the sent contact message is returned.
Example:
.. code-block:: python
app.send_contact("me", "+39 123 456 7890", "Dan")
"""
r = self.send(
functions.messages.SendMedia(
peer=self.resolve_peer(chat_id),
media=types.InputMediaContact(
phone_number=phone_number,
first_name=first_name,
last_name=last_name or "",
vcard=vcard or ""
),
message="",
silent=disable_notification or None,
reply_to_msg_id=reply_to_message_id,
random_id=self.rnd_id(),
schedule_date=schedule_date,
reply_markup=reply_markup.write() if reply_markup else None
)
)
Date when the message will be automatically sent. Unix time.
reply_markup (:obj:`InlineKeyboardMarkup` | :obj:`ReplyKeyboardMarkup` | :obj:`ReplyKeyboardRemove` | :obj:`ForceReply`, *optional*):
Additional interface options. An object for an inline keyboard, custom reply keyboard,
instructions to remove reply keyboard or to force a reply from the user.
Returns:
:obj:`Message`: On success, the sent poll message is returned.
Example:
.. code-block:: python
app.send_poll(chat_id, "Is this a poll question?", ["Yes", "No", "Maybe"])
"""
r = self.send(
functions.messages.SendMedia(
peer=self.resolve_peer(chat_id),
media=types.InputMediaPoll(
poll=types.Poll(
id=0,
question=question,
answers=[
types.PollAnswer(text=o, option=bytes([i]))
for i, o in enumerate(options)
]
)
),
message="",
silent=disable_notification or None,
reply_to_msg_id=reply_to_message_id,
random_id=self.rnd_id(),
schedule_date=schedule_date,
reply_markup (:obj:`InlineKeyboardMarkup` | :obj:`ReplyKeyboardMarkup` | :obj:`ReplyKeyboardRemove` | :obj:`ForceReply`, *optional*):
Additional interface options. An object for an inline keyboard, custom reply keyboard,
instructions to remove reply keyboard or to force a reply from the user.
Returns:
:obj:`Message`: On success, the sent media message is returned.
Example:
.. code-block:: python
app.send_cached_media("me", "CAADBAADyg4AAvLQYAEYD4F7vcZ43AI")
"""
r = self.send(
functions.messages.SendMedia(
peer=self.resolve_peer(chat_id),
media=utils.get_input_media_from_file_id(file_id, file_ref),
silent=disable_notification or None,
reply_to_msg_id=reply_to_message_id,
random_id=self.rnd_id(),
schedule_date=schedule_date,
reply_markup=reply_markup.write() if reply_markup else None,
**self.parser.parse(caption, parse_mode)
)
)
for i in r.updates:
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage, types.UpdateNewScheduledMessage)):
return pyrogram.Message._parse(
self, i.message,
{i.id: i for i in r.users},
voice=True,
duration=duration
)
]
)
elif voice.startswith("http"):
media = types.InputMediaDocumentExternal(
url=voice
)
else:
media = utils.get_input_media_from_file_id(voice, file_ref, 3)
while True:
try:
r = self.send(
functions.messages.SendMedia(
peer=self.resolve_peer(chat_id),
media=media,
silent=disable_notification or None,
reply_to_msg_id=reply_to_message_id,
random_id=self.rnd_id(),
schedule_date=schedule_date,
reply_markup=reply_markup.write() if reply_markup else None,
**self.parser.parse(caption, parse_mode)
)
)
except FilePartMissing as e:
self.save_file(voice, file_id=file.id, file_part=e.x)
else:
for i in r.updates:
if isinstance(
i,
If the message is a reply, ID of the original message.
reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
An object for an inline keyboard. If empty, one ‘Play game_title’ button will be shown automatically.
If not empty, the first button must launch the game.
Returns:
:obj:`Message`: On success, the sent game message is returned.
Example:
.. code-block:: python
app.send_game(chat_id, "gamename")
"""
r = self.send(
functions.messages.SendMedia(
peer=self.resolve_peer(chat_id),
media=types.InputMediaGame(
id=types.InputGameShortName(
bot_id=types.InputUserSelf(),
short_name=game_short_name
),
),
message="",
silent=disable_notification or None,
reply_to_msg_id=reply_to_message_id,
random_id=self.rnd_id(),
reply_markup=reply_markup.write() if reply_markup else None
)
)
for i in r.updates: