From 18639002994515ad8e1a931aabc3e29ae6bfbd63 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 31 Oct 2020 17:15:47 +0100 Subject: [PATCH 1/2] Fix of a small mess up --- pyrogram/types/user_and_chats/chat_member.py | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/pyrogram/types/user_and_chats/chat_member.py b/pyrogram/types/user_and_chats/chat_member.py index 749e7065..69ab4955 100644 --- a/pyrogram/types/user_and_chats/chat_member.py +++ b/pyrogram/types/user_and_chats/chat_member.py @@ -217,26 +217,6 @@ class ChatMember(Object): status="creator", client=client ) - - if isinstance(member, raw.types.ChannelParticipantCreator): - permissions = member.admin_rights - return ChatMember( - user=user, - status="creator", - title=getattr(member, "rank", None), - joined_date=member.date, - invited_by=invited_by, - can_be_edited=member.can_edit, - can_change_info=permissions.change_info, - can_post_messages=permissions.post_messages, - can_edit_messages=permissions.edit_messages, - can_delete_messages=permissions.delete_messages, - can_restrict_members=permissions.ban_users, - can_invite_users=permissions.invite_users, - can_pin_messages=permissions.pin_messages, - can_promote_members=permissions.add_admins, - client=client - ) if isinstance(member, raw.types.ChatParticipantAdmin): return ChatMember( From c139d78b34f9a827b4bb62e80ae6bc900c508a8b Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 31 Oct 2020 19:29:39 +0100 Subject: [PATCH 2/2] Fix wrong imports in examples --- pyrogram/methods/bots/answer_inline_query.py | 2 +- pyrogram/methods/chats/restrict_chat_member.py | 2 +- pyrogram/methods/chats/set_chat_permissions.py | 2 +- pyrogram/methods/contacts/add_contacts.py | 2 +- pyrogram/methods/messages/edit_inline_media.py | 2 +- pyrogram/methods/messages/edit_inline_reply_markup.py | 2 +- pyrogram/methods/messages/edit_message_media.py | 2 +- pyrogram/methods/messages/edit_message_reply_markup.py | 2 +- pyrogram/methods/messages/send_message.py | 2 +- pyrogram/methods/utilities/add_handler.py | 3 ++- pyrogram/methods/utilities/remove_handler.py | 3 ++- 11 files changed, 13 insertions(+), 11 deletions(-) diff --git a/pyrogram/methods/bots/answer_inline_query.py b/pyrogram/methods/bots/answer_inline_query.py index e84491ee..1915db58 100644 --- a/pyrogram/methods/bots/answer_inline_query.py +++ b/pyrogram/methods/bots/answer_inline_query.py @@ -84,7 +84,7 @@ class AnswerInlineQuery(Scaffold): Example: .. code-block:: python - from pyrogram import InlineQueryResultArticle, InputTextMessageContent + from pyrogram.types import InlineQueryResultArticle, InputTextMessageContent app.answer_inline_query( inline_query_id, diff --git a/pyrogram/methods/chats/restrict_chat_member.py b/pyrogram/methods/chats/restrict_chat_member.py index af760feb..60f7132a 100644 --- a/pyrogram/methods/chats/restrict_chat_member.py +++ b/pyrogram/methods/chats/restrict_chat_member.py @@ -60,7 +60,7 @@ class RestrictChatMember(Scaffold): from time import time - from pyrogram import ChatPermissions + from pyrogram.types import ChatPermissions # Completely restrict chat member (mute) forever app.restrict_chat_member(chat_id, user_id, ChatPermissions()) diff --git a/pyrogram/methods/chats/set_chat_permissions.py b/pyrogram/methods/chats/set_chat_permissions.py index 028f0eb1..aab7697b 100644 --- a/pyrogram/methods/chats/set_chat_permissions.py +++ b/pyrogram/methods/chats/set_chat_permissions.py @@ -47,7 +47,7 @@ class SetChatPermissions(Scaffold): Example: .. code-block:: python - from pyrogram import ChatPermissions + from pyrogram.types import ChatPermissions # Completely restrict chat app.set_chat_permissions(chat_id, ChatPermissions()) diff --git a/pyrogram/methods/contacts/add_contacts.py b/pyrogram/methods/contacts/add_contacts.py index b786991c..aabdf064 100644 --- a/pyrogram/methods/contacts/add_contacts.py +++ b/pyrogram/methods/contacts/add_contacts.py @@ -40,7 +40,7 @@ class AddContacts(Scaffold): Example: .. code-block:: python - from pyrogram import InputPhoneContact + from pyrogram.types import InputPhoneContact app.add_contacts([ InputPhoneContact("39123456789", "Foo"), diff --git a/pyrogram/methods/messages/edit_inline_media.py b/pyrogram/methods/messages/edit_inline_media.py index f607462d..2e7147e2 100644 --- a/pyrogram/methods/messages/edit_inline_media.py +++ b/pyrogram/methods/messages/edit_inline_media.py @@ -54,7 +54,7 @@ class EditInlineMedia(Scaffold): Example: .. code-block:: python - from pyrogram import InputMediaPhoto, InputMediaVideo, InputMediaAudio + from pyrogram.types import InputMediaPhoto, InputMediaVideo, InputMediaAudio # Bots only diff --git a/pyrogram/methods/messages/edit_inline_reply_markup.py b/pyrogram/methods/messages/edit_inline_reply_markup.py index 8213c86e..6696b1a7 100644 --- a/pyrogram/methods/messages/edit_inline_reply_markup.py +++ b/pyrogram/methods/messages/edit_inline_reply_markup.py @@ -44,7 +44,7 @@ class EditInlineReplyMarkup(Scaffold): Example: .. code-block:: python - from pyrogram import InlineKeyboardMarkup, InlineKeyboardButton + from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton # Bots only app.edit_inline_reply_markup( diff --git a/pyrogram/methods/messages/edit_message_media.py b/pyrogram/methods/messages/edit_message_media.py index 5733c5bd..bef439d6 100644 --- a/pyrogram/methods/messages/edit_message_media.py +++ b/pyrogram/methods/messages/edit_message_media.py @@ -65,7 +65,7 @@ class EditMessageMedia(Scaffold): Example: .. code-block:: python - from pyrogram import InputMediaPhoto, InputMediaVideo, InputMediaAudio + from pyrogram.types import InputMediaPhoto, InputMediaVideo, InputMediaAudio # Replace the current media with a local photo app.edit_message_media(chat_id, message_id, InputMediaPhoto("new_photo.jpg")) diff --git a/pyrogram/methods/messages/edit_message_reply_markup.py b/pyrogram/methods/messages/edit_message_reply_markup.py index 43d870ad..ae5d0410 100644 --- a/pyrogram/methods/messages/edit_message_reply_markup.py +++ b/pyrogram/methods/messages/edit_message_reply_markup.py @@ -50,7 +50,7 @@ class EditMessageReplyMarkup(Scaffold): Example: .. code-block:: python - from pyrogram import InlineKeyboardMarkup, InlineKeyboardButton + from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton # Bots only app.edit_message_reply_markup( diff --git a/pyrogram/methods/messages/send_message.py b/pyrogram/methods/messages/send_message.py index e2ccc853..93264731 100644 --- a/pyrogram/methods/messages/send_message.py +++ b/pyrogram/methods/messages/send_message.py @@ -98,7 +98,7 @@ class SendMessage(Scaffold): # For bots only, send messages with keyboards attached ## - from pyrogram import ( + from pyrogram.types import ( ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton) # Send a normal keyboard diff --git a/pyrogram/methods/utilities/add_handler.py b/pyrogram/methods/utilities/add_handler.py index f8d993cd..3c7440f3 100644 --- a/pyrogram/methods/utilities/add_handler.py +++ b/pyrogram/methods/utilities/add_handler.py @@ -44,7 +44,8 @@ class AddHandler(Scaffold): .. code-block:: python :emphasize-lines: 8 - from pyrogram import Client, MessageHandler + from pyrogram import Client + from pyrogram.handlers import MessageHandler def dump(client, message): print(message) diff --git a/pyrogram/methods/utilities/remove_handler.py b/pyrogram/methods/utilities/remove_handler.py index 5a4de8c1..67709cb5 100644 --- a/pyrogram/methods/utilities/remove_handler.py +++ b/pyrogram/methods/utilities/remove_handler.py @@ -39,7 +39,8 @@ class RemoveHandler(Scaffold): .. code-block:: python :emphasize-lines: 11 - from pyrogram import Client, MessageHandler + from pyrogram import Client + from pyrogram.handlers import MessageHandler def dump(client, message): print(message)