Skip to content

Commit a0355a5

Browse files
committed
Type hint all methods return values
1 parent bf0b947 commit a0355a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+80
-68
lines changed

pyrogram/client/methods/chats/delete_chat_photo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
class DeleteChatPhoto(BaseClient):
2626
def delete_chat_photo(self,
27-
chat_id: Union[int, str]):
27+
chat_id: Union[int, str]) -> bool:
2828
"""Use this method to delete a chat photo.
2929
Photos can't be changed for private chats.
3030
You must be an administrator in the chat for this to work and must have the appropriate admin rights.

pyrogram/client/methods/chats/export_chat_invite_link.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
class ExportChatInviteLink(BaseClient):
2626
def export_chat_invite_link(self,
27-
chat_id: Union[int, str]):
27+
chat_id: Union[int, str]) -> str:
2828
"""Use this method to generate a new invite link for a chat; any previously generated link is revoked.
2929
3030
You must be an administrator in the chat for this to work and have the appropriate admin rights.

pyrogram/client/methods/chats/get_chat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
class GetChat(BaseClient):
2727
def get_chat(self,
28-
chat_id: Union[int, str]):
28+
chat_id: Union[int, str]) -> "pyrogram.Chat":
2929
"""Use this method to get up to date information about the chat (current name of the user for
3030
one-on-one conversations, current username of a user, group or channel, etc.)
3131

pyrogram/client/methods/chats/get_chat_member.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
class GetChatMember(BaseClient):
2727
def get_chat_member(self,
2828
chat_id: Union[int, str],
29-
user_id: Union[int, str]):
29+
user_id: Union[int, str]) -> "pyrogram.ChatMember":
3030
"""Use this method to get information about one member of a chat.
3131
3232
Args:
@@ -67,13 +67,6 @@ def get_chat_member(self,
6767
)
6868
)
6969

70-
return pyrogram.ChatMembers._parse(
71-
self,
72-
types.channels.ChannelParticipants(
73-
count=1,
74-
participants=[r.participant],
75-
users=r.users
76-
)
77-
).chat_members[0]
70+
return pyrogram.ChatMember._parse(self, r.participant, r.users[0])
7871
else:
7972
raise ValueError("The chat_id \"{}\" belongs to a user".format(chat_id))

pyrogram/client/methods/chats/get_chat_members.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def get_chat_members(self,
3838
offset: int = 0,
3939
limit: int = 200,
4040
query: str = "",
41-
filter: str = Filters.ALL):
41+
filter: str = Filters.ALL) -> "pyrogram.ChatMembers":
4242
"""Use this method to get the members list of a chat.
4343
4444
A chat can be either a basic group, a supergroup or a channel.

pyrogram/client/methods/chats/get_chat_members_count.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
class GetChatMembersCount(BaseClient):
2626
def get_chat_members_count(self,
27-
chat_id: Union[int, str]):
27+
chat_id: Union[int, str]) -> int:
2828
"""Use this method to get the number of members in a chat.
2929
3030
Args:

pyrogram/client/methods/chats/get_dialogs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class GetDialogs(BaseClient):
2525
def get_dialogs(self,
2626
offset_dialog: "pyrogram.Dialog" = None,
2727
limit: int = 100,
28-
pinned_only: bool = False):
28+
pinned_only: bool = False) -> "pyrogram.Dialogs":
2929
"""Use this method to get the user's dialogs
3030
3131
You can get up to 100 dialogs at once.

pyrogram/client/methods/chats/kick_chat_member.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class KickChatMember(BaseClient):
2727
def kick_chat_member(self,
2828
chat_id: Union[int, str],
2929
user_id: Union[int, str],
30-
until_date: int = 0):
30+
until_date: int = 0) -> "pyrogram.Message":
3131
"""Use this method to kick a user from a group, a supergroup or a channel.
3232
In the case of supergroups and channels, the user will not be able to return to the group on their own using
3333
invite links, etc., unless unbanned first. You must be an administrator in the chat for this to work and must

pyrogram/client/methods/chats/pin_chat_message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class PinChatMessage(BaseClient):
2626
def pin_chat_message(self,
2727
chat_id: Union[int, str],
2828
message_id: int,
29-
disable_notification: bool = None):
29+
disable_notification: bool = None) -> bool:
3030
"""Use this method to pin a message in a supergroup or a channel.
3131
You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin right in
3232
the supergroup or "can_edit_messages" admin right in the channel.

pyrogram/client/methods/chats/promote_chat_member.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def promote_chat_member(self,
3333
can_invite_users: bool = True,
3434
can_restrict_members: bool = True,
3535
can_pin_messages: bool = False,
36-
can_promote_members: bool = False):
36+
can_promote_members: bool = False) -> bool:
3737
"""Use this method to promote or demote a user in a supergroup or a channel.
3838
You must be an administrator in the chat for this to work and must have the appropriate admin rights.
3939
Pass False for all boolean parameters to demote a user.

0 commit comments

Comments
 (0)