Merge pull request #528 from pyrogram/fixes

Collection of fixes
This commit is contained in:
Dan 2020-10-31 19:30:41 +01:00 committed by GitHub
commit 888e296813
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 13 additions and 31 deletions

View File

@ -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,

View File

@ -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())

View File

@ -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())

View File

@ -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"),

View File

@ -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

View File

@ -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(

View File

@ -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"))

View File

@ -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(

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -218,26 +218,6 @@ class ChatMember(Object):
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(
user=user,