Fix support for pyrogram 1.1.3

This commit is contained in:
blank X 2020-12-24 16:07:12 +07:00
parent dc67e2155a
commit f91b9210f5
2 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
# https://github.com/ssut/py-googletrans/issues/234#issuecomment-736314530 # https://github.com/ssut/py-googletrans/issues/234#issuecomment-736314530
git+https://github.com/alainrouillon/py-googletrans@feature/enhance-use-of-direct-api git+https://github.com/alainrouillon/py-googletrans@feature/enhance-use-of-direct-api
pyrogram pyrogram>=1.1.3
tgcrypto tgcrypto
requests requests
aiohttp>=3.7.1 aiohttp>=3.7.1

View File

@ -21,20 +21,20 @@ async def log_user_joins(client, update, users, chats):
if isinstance(message, MessageService): if isinstance(message, MessageService):
action = message.action action = message.action
if isinstance(action, (MessageActionChatAddUser, MessageActionChatJoinedByLink)): if isinstance(action, (MessageActionChatAddUser, MessageActionChatJoinedByLink)):
if isinstance(message.to_id, PeerChannel): if isinstance(message.peer_id, PeerChannel):
chat_id = message.to_id.channel_id chat_id = message.peer_id.channel_id
sexy_chat_id = int('-100' + str(chat_id)) sexy_chat_id = int('-100' + str(chat_id))
elif isinstance(message.to_id, PeerChat): elif isinstance(message.peer_id, PeerChat):
chat_id = message.to_id.chat_id chat_id = message.peer_id.chat_id
sexy_chat_id = -chat_id sexy_chat_id = -chat_id
else: else:
return return
peer = await client.resolve_peer(config['config']['log_chat']) peer = await client.resolve_peer(config['config']['log_chat'])
if peer == message.to_id: if peer == message.peer_id:
return return
is_join = isinstance(action, MessageActionChatJoinedByLink) is_join = isinstance(action, MessageActionChatJoinedByLink)
if not is_join: if not is_join:
is_join = action.users == [message.from_id] is_join = action.users == [message.from_id.user_id]
if is_join and not config['config']['log_user_joins']: if is_join and not config['config']['log_user_joins']:
raise ContinuePropagation raise ContinuePropagation
if not is_join and not config['config']['log_user_adds']: if not is_join and not config['config']['log_user_adds']: