Skip to content

Commit 91ec6eb

Browse files
committed
Merge branch 'develop' of https://github.com/pyrogram/pyrogram
� Conflicts: � pyrogram/methods/chats/__init__.py � pyrogram/methods/chats/mark_chat_unread.py
2 parents c2c857b + 04cf4e6 commit 91ec6eb

3 files changed

Lines changed: 50 additions & 1 deletion

File tree

compiler/docs/compiler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ def get_title_list(s: str) -> list:
220220
delete_supergroup
221221
delete_user_history
222222
set_slow_mode
223+
mark_chat_unread
223224
""",
224225
users="""
225226
Users
@@ -475,6 +476,7 @@ def get_title_list(s: str) -> list:
475476
Chat.add_members
476477
Chat.join
477478
Chat.leave
479+
Chat.mark_unread
478480
""",
479481
user="""
480482
User

pyrogram/methods/chats/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
from .unpin_all_chat_messages import UnpinAllChatMessages
5353
from .unpin_chat_message import UnpinChatMessage
5454
from .update_chat_username import UpdateChatUsername
55+
from .mark_chat_unread import MarkChatUnread
5556

5657

5758
class Chats(
@@ -90,6 +91,7 @@ class Chats(
9091
SetAdministratorTitle,
9192
SetSlowMode,
9293
DeleteUserHistory,
93-
UnpinAllChatMessages
94+
UnpinAllChatMessages,
95+
MarkChatUnread
9496
):
9597
pass
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Pyrogram - Telegram MTProto API Client Library for Python
2+
# Copyright (C) 2017-2020 Dan <https://github.com/delivrance>
3+
#
4+
# This file is part of Pyrogram.
5+
#
6+
# Pyrogram is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU Lesser General Public License as published
8+
# by the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# Pyrogram is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU Lesser General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU Lesser General Public License
17+
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
18+
19+
from typing import Union
20+
21+
from pyrogram.raw import functions
22+
from pyrogram.scaffold import Scaffold
23+
24+
25+
class MarkChatUnread(Scaffold):
26+
async def mark_chat_unread(
27+
self,
28+
chat_id: Union[int, str],
29+
) -> bool:
30+
"""Mark a chat as unread.
31+
32+
Parameters:
33+
chat_id (``int`` | ``str``):
34+
Unique identifier (int) or username (str) of the target chat.
35+
36+
Returns:
37+
``bool``: On success, True is returned.
38+
"""
39+
40+
return await self.send(
41+
functions.messages.MarkDialogUnread(
42+
peer=await self.resolve_peer(chat_id),
43+
unread=True
44+
)
45+
)

0 commit comments

Comments
 (0)