Skip to content

Commit f2d49fc

Browse files
Update Pyrogram to v2.0.61
1 parent bfab8d8 commit f2d49fc

File tree

10 files changed

+105
-42
lines changed

10 files changed

+105
-42
lines changed

.github/workflows/python.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
strategy:
1010
matrix:
1111
os: [ubuntu-latest, macos-latest]
12-
python-version: ["3.7", "3.8", "3.9", "3.10"]
12+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
1313

1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v3
1616

1717
- name: Set up Python ${{ matrix.python-version }}
1818
uses: actions/setup-python@v2

compiler/api/source/main_api.tl

Lines changed: 64 additions & 30 deletions
Large diffs are not rendered by default.

pyrogram/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
__version__ = "2.0.59"
19+
__version__ = "2.0.61"
2020
__license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)"
2121
__copyright__ = "Copyright (C) 2017-present Dan <https://github.com/delivrance>"
2222

pyrogram/enums/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,20 @@
3030
from .poll_type import PollType
3131
from .sent_code_type import SentCodeType
3232
from .user_status import UserStatus
33+
34+
__all__ = [
35+
'ChatAction',
36+
'ChatEventAction',
37+
'ChatMemberStatus',
38+
'ChatMembersFilter',
39+
'ChatType',
40+
'MessageEntityType',
41+
'MessageMediaType',
42+
'MessageServiceType',
43+
'MessagesFilter',
44+
'NextCodeType',
45+
'ParseMode',
46+
'PollType',
47+
'SentCodeType',
48+
'UserStatus'
49+
]

pyrogram/filters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ async def all_filter(_, __, ___):
164164

165165
# region me_filter
166166
async def me_filter(_, __, m: Message):
167-
return bool(m.from_user and m.from_user.is_self or m.outgoing)
167+
return bool(m.from_user and m.from_user.is_self or getattr(m, "outgoing", False))
168168

169169

170170
me = create(me_filter)
@@ -914,4 +914,4 @@ async def __call__(self, _, message: Message):
914914
or ("me" in self
915915
and message.from_user
916916
and message.from_user.is_self
917-
and not message.outgoing)))
917+
and not message.outgoing)))

pyrogram/methods/contacts/delete_contacts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async def delete_contacts(
3333
3434
Parameters:
3535
user_ids (``int`` | ``str`` | List of ``int`` or ``str``):
36-
A single user id/username o a list of user identifiers (id or username).
36+
A single user id/username or a list of user identifiers (id or username).
3737
3838
Returns:
3939
:obj:`~pyrogram.types.User` | List of :obj:`~pyrogram.types.User` | ``None``: In case *user_ids* was an
@@ -63,4 +63,4 @@ async def delete_contacts(
6363

6464
users = types.List([types.User._parse(self, i) for i in r.users])
6565

66-
return users if is_list else users[0]
66+
return users if is_list else users[0]

pyrogram/methods/decorators/on_disconnect.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ def on_disconnect(self=None) -> Callable:
3232
def decorator(func: Callable) -> Callable:
3333
if isinstance(self, pyrogram.Client):
3434
self.add_handler(pyrogram.handlers.DisconnectHandler(func))
35+
else:
36+
if not hasattr(func, "handlers"):
37+
func.handlers = []
38+
39+
func.handlers.append((pyrogram.handlers.DisconnectHandler(func), 0))
3540

3641
return func
3742

38-
return decorator
43+
return decorator

pyrogram/methods/decorators/on_raw_update.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ def decorator(func: Callable) -> Callable:
4646
func.handlers.append(
4747
(
4848
pyrogram.handlers.RawUpdateHandler(func),
49-
group if self is None else group
49+
group
5050
)
5151
)
5252

5353
return func
5454

55-
return decorator
55+
return decorator

pyrogram/methods/messages/copy_message.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async def copy_message(
4545
"types.ReplyKeyboardRemove",
4646
"types.ForceReply"
4747
] = None
48-
) -> List["types.Message"]:
48+
) -> "types.Message":
4949
"""Copy messages of any kind.
5050
5151
The method is analogous to the method :meth:`~Client.forward_messages`, but the copied message doesn't have a
@@ -118,4 +118,4 @@ async def copy_message(
118118
schedule_date=schedule_date,
119119
protect_content=protect_content,
120120
reply_markup=reply_markup
121-
)
121+
)

pyrogram/types/messages_and_media/message.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ class Message(Object, Update):
254254
255255
views (``int``, *optional*):
256256
Channel post views.
257+
258+
forwards (``int``, *optional*):
259+
Channel post forwards.
257260
258261
via_bot (:obj:`~pyrogram.types.User`):
259262
The information of the bot that generated the message from an inline query of a user.
@@ -361,6 +364,7 @@ def __init__(
361364
pinned_message: "Message" = None,
362365
game_high_score: int = None,
363366
views: int = None,
367+
forwards: int = None,
364368
via_bot: "types.User" = None,
365369
outgoing: bool = None,
366370
matches: List[Match] = None,
@@ -436,6 +440,7 @@ def __init__(
436440
self.pinned_message = pinned_message
437441
self.game_high_score = game_high_score
438442
self.views = views
443+
self.forwards = forwards
439444
self.via_bot = via_bot
440445
self.outgoing = outgoing
441446
self.matches = matches
@@ -800,6 +805,7 @@ async def _parse(
800805
poll=poll,
801806
dice=dice,
802807
views=message.views,
808+
forwards=message.forwards,
803809
via_bot=types.User._parse(client, users.get(message.via_bot_id, None)),
804810
outgoing=message.out,
805811
reply_markup=reply_markup,
@@ -3051,6 +3057,7 @@ async def copy(
30513057
chat_id,
30523058
text=self.text,
30533059
entities=self.entities,
3060+
parse_mode=enums.ParseMode.DISABLED,
30543061
disable_web_page_preview=not self.web_page,
30553062
disable_notification=disable_notification,
30563063
reply_to_message_id=reply_to_message_id,

0 commit comments

Comments
 (0)