Skip to content

Commit 6178df5

Browse files
author
Pyrogram-Mod - Dev
committed
feat(send_*): add message_effect_id parameter to all send methods
Closes #24
1 parent d0dd4bf commit 6178df5

17 files changed

Lines changed: 89 additions & 4 deletions

pyrogram/methods/messages/forward_messages.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ async def forward_messages(
3232
message_ids: Union[int, Iterable[int]],
3333
disable_notification: bool = None,
3434
schedule_date: datetime = None,
35-
protect_content: bool = None
35+
protect_content: bool = None,
36+
message_effect_id: int = None
3637
) -> Union["types.Message", List["types.Message"]]:
3738
"""Forward messages of any kind.
3839
@@ -62,6 +63,9 @@ async def forward_messages(
6263
protect_content (``bool``, *optional*):
6364
Protects the contents of the sent message from forwarding and saving.
6465
66+
message_effect_id (``int``, *optional*):
67+
Unique identifier of the message effect to add to the message.
68+
6569
Returns:
6670
:obj:`~pyrogram.types.Message` | List of :obj:`~pyrogram.types.Message`: In case *message_ids* was not
6771
a list, a single message is returned, otherwise a list of messages is returned.
@@ -87,7 +91,8 @@ async def forward_messages(
8791
silent=disable_notification or None,
8892
random_id=[self.rnd_id() for _ in message_ids],
8993
schedule_date=utils.datetime_to_timestamp(schedule_date),
90-
noforwards=protect_content
94+
noforwards=protect_content,
95+
effect=message_effect_id
9196
)
9297
)
9398

pyrogram/methods/messages/send_animation.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ async def send_animation(
5252
schedule_date: datetime = None,
5353
protect_content: bool = None,
5454
ttl_seconds: int = None,
55+
message_effect_id: int = None,
5556
reply_markup: Union[
5657
"types.InlineKeyboardMarkup",
5758
"types.ReplyKeyboardMarkup",
@@ -140,6 +141,9 @@ async def send_animation(
140141
protect_content (``bool``, *optional*):
141142
Protects the contents of the sent message from forwarding and saving.
142143
144+
message_effect_id (``int``, *optional*):
145+
Unique identifier of the message effect to add to the message.
146+
143147
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
144148
Additional interface options. An object for an inline keyboard, custom reply keyboard,
145149
instructions to remove reply keyboard or to force a reply from the user.
@@ -258,6 +262,7 @@ async def progress(current, total):
258262
schedule_date=utils.datetime_to_timestamp(schedule_date),
259263
noforwards=protect_content,
260264
reply_markup=await reply_markup.write(self) if reply_markup else None,
265+
effect=message_effect_id,
261266
**await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
262267
)
263268
)

pyrogram/methods/messages/send_audio.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ async def send_audio(
4949
partial_reply: str = None,
5050
schedule_date: datetime = None,
5151
protect_content: bool = None,
52+
message_effect_id: int = None,
5253
reply_markup: Union[
5354
"types.InlineKeyboardMarkup",
5455
"types.ReplyKeyboardMarkup",
@@ -126,6 +127,9 @@ async def send_audio(
126127
protect_content (``bool``, *optional*):
127128
Protects the contents of the sent message from forwarding and saving.
128129
130+
message_effect_id (``int``, *optional*):
131+
Unique identifier of the message effect to add to the message.
132+
129133
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
130134
Additional interface options. An object for an inline keyboard, custom reply keyboard,
131135
instructions to remove reply keyboard or to force a reply from the user.
@@ -235,6 +239,7 @@ async def progress(current, total):
235239
schedule_date=utils.datetime_to_timestamp(schedule_date),
236240
noforwards=protect_content,
237241
reply_markup=await reply_markup.write(self) if reply_markup else None,
242+
effect=message_effect_id,
238243
**await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
239244
)
240245
)

pyrogram/methods/messages/send_cached_media.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ async def send_cached_media(
4040
schedule_date: datetime = None,
4141
protect_content: bool = None,
4242
has_spoiler: bool = None,
43+
message_effect_id: int = None,
4344
reply_markup: Union[
4445
"types.InlineKeyboardMarkup",
4546
"types.ReplyKeyboardMarkup",
@@ -98,6 +99,9 @@ async def send_cached_media(
9899
has_spoiler (``bool``, *optional*):
99100
True, if the message media is covered by a spoiler animation.
100101
102+
message_effect_id (``int``, *optional*):
103+
Unique identifier of the message effect to add to the message.
104+
101105
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
102106
Additional interface options. An object for an inline keyboard, custom reply keyboard,
103107
instructions to remove reply keyboard or to force a reply from the user.
@@ -122,6 +126,7 @@ async def send_cached_media(
122126
random_id=self.rnd_id(),
123127
schedule_date=utils.datetime_to_timestamp(schedule_date),
124128
noforwards=protect_content,
129+
effect=message_effect_id,
125130
reply_markup=await reply_markup.write(self) if reply_markup else None,
126131
**await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
127132
)

pyrogram/methods/messages/send_contact.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ async def send_contact(
3838
partial_reply: str = None,
3939
schedule_date: datetime = None,
4040
protect_content: bool = None,
41+
message_effect_id: int = None,
4142
reply_markup: Union[
4243
"types.InlineKeyboardMarkup",
4344
"types.ReplyKeyboardMarkup",
@@ -86,6 +87,9 @@ async def send_contact(
8687
protect_content (``bool``, *optional*):
8788
Protects the contents of the sent message from forwarding and saving.
8889
90+
message_effect_id (``int``, *optional*):
91+
Unique identifier of the message effect to add to the message.
92+
8993
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
9094
Additional interface options. An object for an inline keyboard, custom reply keyboard,
9195
instructions to remove reply keyboard or to force a reply from the user.
@@ -116,6 +120,7 @@ async def send_contact(
116120
random_id=self.rnd_id(),
117121
schedule_date=utils.datetime_to_timestamp(schedule_date),
118122
noforwards=protect_content,
123+
effect=message_effect_id,
119124
reply_markup=await reply_markup.write(self) if reply_markup else None
120125
)
121126
)

pyrogram/methods/messages/send_dice.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ async def send_dice(
3535
partial_reply: str = None,
3636
schedule_date: datetime = None,
3737
protect_content: bool = None,
38+
message_effect_id: int = None,
3839
reply_markup: Union[
3940
"types.InlineKeyboardMarkup",
4041
"types.ReplyKeyboardMarkup",
@@ -79,6 +80,9 @@ async def send_dice(
7980
protect_content (``bool``, *optional*):
8081
Protects the contents of the sent message from forwarding and saving.
8182
83+
message_effect_id (``int``, *optional*):
84+
Unique identifier of the message effect to add to the message.
85+
8286
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
8387
Additional interface options. An object for an inline keyboard, custom reply keyboard,
8488
instructions to remove reply keyboard or to force a reply from the user.
@@ -110,6 +114,7 @@ async def send_dice(
110114
random_id=self.rnd_id(),
111115
schedule_date=utils.datetime_to_timestamp(schedule_date),
112116
noforwards=protect_content,
117+
effect=message_effect_id,
113118
reply_markup=await reply_markup.write(self) if reply_markup else None,
114119
message=""
115120
)

pyrogram/methods/messages/send_document.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ async def send_document(
4747
partial_reply: str = None,
4848
schedule_date: datetime = None,
4949
protect_content: bool = None,
50+
message_effect_id: int = None,
5051
reply_markup: Union[
5152
"types.InlineKeyboardMarkup",
5253
"types.ReplyKeyboardMarkup",
@@ -118,6 +119,9 @@ async def send_document(
118119
protect_content (``bool``, *optional*):
119120
Protects the contents of the sent message from forwarding and saving.
120121
122+
message_effect_id (``int``, *optional*):
123+
Unique identifier of the message effect to add to the message.
124+
121125
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
122126
Additional interface options. An object for an inline keyboard, custom reply keyboard,
123127
instructions to remove reply keyboard or to force a reply from the user.
@@ -211,6 +215,7 @@ async def progress(current, total):
211215
schedule_date=utils.datetime_to_timestamp(schedule_date),
212216
noforwards=protect_content,
213217
reply_markup=await reply_markup.write(self) if reply_markup else None,
218+
effect=message_effect_id,
214219
**await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
215220
)
216221
)

pyrogram/methods/messages/send_location.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ async def send_location(
3636
partial_reply: str = None,
3737
schedule_date: datetime = None,
3838
protect_content: bool = None,
39+
message_effect_id: int = None,
3940
reply_markup: Union[
4041
"types.InlineKeyboardMarkup",
4142
"types.ReplyKeyboardMarkup",
@@ -79,6 +80,9 @@ async def send_location(
7980
protect_content (``bool``, *optional*):
8081
Protects the contents of the sent message from forwarding and saving.
8182
83+
message_effect_id (``int``, *optional*):
84+
Unique identifier of the message effect to add to the message.
85+
8286
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
8387
Additional interface options. An object for an inline keyboard, custom reply keyboard,
8488
instructions to remove reply keyboard or to force a reply from the user.
@@ -109,6 +113,7 @@ async def send_location(
109113
random_id=self.rnd_id(),
110114
schedule_date=utils.datetime_to_timestamp(schedule_date),
111115
noforwards=protect_content,
116+
effect=message_effect_id,
112117
reply_markup=await reply_markup.write(self) if reply_markup else None
113118
)
114119
)

pyrogram/methods/messages/send_media_group.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ async def send_media_group(
4848
partial_reply: str = None,
4949
schedule_date: datetime = None,
5050
protect_content: bool = None,
51+
message_effect_id: int = None,
5152
) -> List["types.Message"]:
5253
"""Send a group of photos or videos as an album.
5354
@@ -82,6 +83,9 @@ async def send_media_group(
8283
protect_content (``bool``, *optional*):
8384
Protects the contents of the sent message from forwarding and saving.
8485
86+
message_effect_id (``int``, *optional*):
87+
Unique identifier of the message effect to add to the message.
88+
8589
Returns:
8690
List of :obj:`~pyrogram.types.Message`: On success, a list of the sent messages is returned.
8791
@@ -410,7 +414,8 @@ async def send_media_group(
410414
silent=disable_notification or None,
411415
reply_to=reply_to,
412416
schedule_date=utils.datetime_to_timestamp(schedule_date),
413-
noforwards=protect_content
417+
noforwards=protect_content,
418+
effect=message_effect_id
414419
),
415420
sleep_threshold=60
416421
)

pyrogram/methods/messages/send_message.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ async def send_message(
3939
partial_reply: str = None,
4040
schedule_date: datetime = None,
4141
protect_content: bool = None,
42+
message_effect_id: int = None,
4243
reply_markup: Union[
4344
"types.InlineKeyboardMarkup",
4445
"types.ReplyKeyboardMarkup",
@@ -92,6 +93,9 @@ async def send_message(
9293
protect_content (``bool``, *optional*):
9394
Protects the contents of the sent message from forwarding and saving.
9495
96+
message_effect_id (``int``, *optional*):
97+
Unique identifier of the message effect to add to the message.
98+
9599
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
96100
Additional interface options. An object for an inline keyboard, custom reply keyboard,
97101
instructions to remove reply keyboard or to force a reply from the user.
@@ -167,7 +171,8 @@ async def send_message(
167171
reply_markup=await reply_markup.write(self) if reply_markup else None,
168172
message=message,
169173
entities=entities,
170-
noforwards=protect_content
174+
noforwards=protect_content,
175+
effect=message_effect_id
171176
)
172177
)
173178

0 commit comments

Comments
 (0)