Skip to content

Commit

Permalink
pyrofork: Add message_effect_id to send* methods
Browse files Browse the repository at this point in the history
Signed-off-by: wulan17 <wulan17@nusantararom.org>
  • Loading branch information
SpEcHiDe authored and wulan17 committed May 31, 2024
1 parent 9ef7628 commit 54f4503
Show file tree
Hide file tree
Showing 17 changed files with 91 additions and 6 deletions.
5 changes: 5 additions & 0 deletions pyrogram/methods/bots/send_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async def send_game(
business_connection_id: str = None,
reply_to_message_id: int = None,
protect_content: bool = None,
message_effect_id: int = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
Expand Down Expand Up @@ -73,6 +74,9 @@ async def send_game(
protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.
message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.
reply_markup (:obj:`~pyrogram.types.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.
Expand Down Expand Up @@ -105,6 +109,7 @@ async def send_game(
reply_to=reply_to,
random_id=self.rnd_id(),
noforwards=protect_content,
effect=message_effect_id,
reply_markup=await reply_markup.write(self) if reply_markup else None
)
if business_connection_id is not None:
Expand Down
5 changes: 5 additions & 0 deletions pyrogram/methods/messages/send_animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ async def send_animation(
quote_entities: List["types.MessageEntity"] = None,
schedule_date: datetime = None,
protect_content: bool = None,
message_effect_id: int = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
Expand Down Expand Up @@ -150,6 +151,9 @@ async def send_animation(
List of special entities that appear in quote_text, which can be specified instead of *parse_mode*.
for reply_to_message only.
message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
Date when the message will be automatically sent.
Expand Down Expand Up @@ -278,6 +282,7 @@ async def progress(current, total):
random_id=self.rnd_id(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,
effect=message_effect_id,
reply_markup=await reply_markup.write(self) if reply_markup else None,
**await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
)
Expand Down
5 changes: 5 additions & 0 deletions pyrogram/methods/messages/send_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ async def send_audio(
reply_to_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
message_effect_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
reply_markup: Union[
Expand Down Expand Up @@ -143,6 +144,9 @@ async def send_audio(
List of special entities that appear in quote_text, which can be specified instead of *parse_mode*.
for reply_to_message only.
message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
Date when the message will be automatically sent.
Expand Down Expand Up @@ -264,6 +268,7 @@ async def progress(current, total):
random_id=self.rnd_id(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,
effect=message_effect_id,
reply_markup=await reply_markup.write(self) if reply_markup else None,
**await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
)
Expand Down
7 changes: 6 additions & 1 deletion pyrogram/methods/messages/send_contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async def send_contact(
parse_mode: Optional["enums.ParseMode"] = None,
schedule_date: datetime = None,
protect_content: bool = None,
message_effect_id: int = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
Expand Down Expand Up @@ -112,6 +113,9 @@ async def send_contact(
protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.
message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
Expand Down Expand Up @@ -150,7 +154,8 @@ async def send_contact(
random_id=self.rnd_id(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,
reply_markup=await reply_markup.write(self) if reply_markup else None
reply_markup=await reply_markup.write(self) if reply_markup else None,
effect=message_effect_id
)
if business_connection_id is not None:
r = await self.invoke(
Expand Down
5 changes: 5 additions & 0 deletions pyrogram/methods/messages/send_dice.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ async def send_dice(
parse_mode: Optional["enums.ParseMode"] = None,
schedule_date: datetime = None,
protect_content: bool = None,
message_effect_id: int = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
Expand Down Expand Up @@ -108,6 +109,9 @@ async def send_dice(
protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.
message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
Expand Down Expand Up @@ -149,6 +153,7 @@ async def send_dice(
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,
reply_markup=await reply_markup.write(self) if reply_markup else None,
effect=message_effect_id,
message=""
)
if business_connection_id is not None:
Expand Down
5 changes: 5 additions & 0 deletions pyrogram/methods/messages/send_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ async def send_document(
reply_to_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
message_effect_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
reply_markup: Union[
Expand Down Expand Up @@ -135,6 +136,9 @@ async def send_document(
List of special entities that appear in quote_text, which can be specified instead of *parse_mode*.
for reply_to_message only.
message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
Date when the message will be automatically sent.
Expand Down Expand Up @@ -242,6 +246,7 @@ async def progress(current, total):
random_id=self.rnd_id(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,
effect=message_effect_id,
reply_markup=await reply_markup.write(self) if reply_markup else None,
**await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
)
Expand Down
7 changes: 6 additions & 1 deletion pyrogram/methods/messages/send_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ async def send_location(
parse_mode: Optional["enums.ParseMode"] = None,
schedule_date: datetime = None,
protect_content: bool = None,
message_effect_id: int = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
Expand Down Expand Up @@ -104,6 +105,9 @@ async def send_location(
protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.
message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
Expand Down Expand Up @@ -142,7 +146,8 @@ async def send_location(
random_id=self.rnd_id(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,
reply_markup=await reply_markup.write(self) if reply_markup else None
reply_markup=await reply_markup.write(self) if reply_markup else None,
effect=message_effect_id
)
if business_connection_id is not None:
r = await self.invoke(
Expand Down
7 changes: 6 additions & 1 deletion pyrogram/methods/messages/send_media_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ async def send_media_group(
parse_mode: Optional["enums.ParseMode"] = None,
schedule_date: datetime = None,
protect_content: bool = None,
message_effect_id: int = None
) -> List["types.Message"]:
"""Send a group of photos or videos as an album.
Expand Down Expand Up @@ -114,6 +115,9 @@ async def send_media_group(
protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.
message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.
Returns:
List of :obj:`~pyrogram.types.Message`: On success, a list of the sent messages is returned.
Expand Down Expand Up @@ -465,7 +469,8 @@ async def send_media_group(
silent=disable_notification or None,
reply_to=reply_to,
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content
noforwards=protect_content,
effect=message_effect_id
)

if business_connection_id is not None:
Expand Down
7 changes: 6 additions & 1 deletion pyrogram/methods/messages/send_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ async def send_message(
schedule_date: datetime = None,
protect_content: bool = None,
invert_media: bool = None,
message_effect_id: int = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
Expand Down Expand Up @@ -115,6 +116,9 @@ async def send_message(
invert_media (``bool``, *optional*):
Move web page preview to above the message.
message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
Expand Down Expand Up @@ -182,7 +186,8 @@ async def send_message(
message=message,
entities=entities,
noforwards=protect_content,
invert_media=invert_media
invert_media=invert_media,
effect=message_effect_id,
)
if business_connection_id is not None:
r = await self.invoke(
Expand Down
5 changes: 5 additions & 0 deletions pyrogram/methods/messages/send_photo.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ async def send_photo(
quote_entities: List["types.MessageEntity"] = None,
schedule_date: datetime = None,
protect_content: bool = None,
message_effect_id: int = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
Expand Down Expand Up @@ -132,6 +133,9 @@ async def send_photo(
protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.
message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
Expand Down Expand Up @@ -227,6 +231,7 @@ async def send_photo(
random_id=self.rnd_id(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,
effect=message_effect_id,
reply_markup=await reply_markup.write(self) if reply_markup else None,
**await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
)
Expand Down
7 changes: 6 additions & 1 deletion pyrogram/methods/messages/send_poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ async def send_poll(
quote_entities: List["types.MessageEntity"] = None,
parse_mode: Optional["enums.ParseMode"] = None,
schedule_date: datetime = None,
message_effect_id: int = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
Expand Down Expand Up @@ -154,6 +155,9 @@ async def send_poll(
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
Date when the message will be automatically sent.
message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
Expand Down Expand Up @@ -209,7 +213,8 @@ async def send_poll(
random_id=self.rnd_id(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,
reply_markup=await reply_markup.write(self) if reply_markup else None
reply_markup=await reply_markup.write(self) if reply_markup else None,
effect=message_effect_id
)
if business_connection_id is not None:
r = await self.invoke(
Expand Down
5 changes: 5 additions & 0 deletions pyrogram/methods/messages/send_sticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ async def send_sticker(
parse_mode: Optional["enums.ParseMode"] = None,
schedule_date: datetime = None,
protect_content: bool = None,
message_effect_id: int = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
Expand Down Expand Up @@ -117,6 +118,9 @@ async def send_sticker(
protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.
message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
Expand Down Expand Up @@ -208,6 +212,7 @@ async def send_sticker(
random_id=self.rnd_id(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,
effect=message_effect_id,
reply_markup=await reply_markup.write(self) if reply_markup else None,
message=""
)
Expand Down
7 changes: 6 additions & 1 deletion pyrogram/methods/messages/send_venue.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ async def send_venue(
parse_mode: Optional["enums.ParseMode"] = None,
schedule_date: datetime = None,
protect_content: bool = None,
message_effect_id: int = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
Expand Down Expand Up @@ -121,6 +122,9 @@ async def send_venue(
protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.
message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
Expand Down Expand Up @@ -166,7 +170,8 @@ async def send_venue(
random_id=self.rnd_id(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,
reply_markup=await reply_markup.write(self) if reply_markup else None
reply_markup=await reply_markup.write(self) if reply_markup else None,
effect=message_effect_id
)
if business_connection_id is not None:
r = await self.invoke(
Expand Down
Loading

0 comments on commit 54f4503

Please sign in to comment.