Skip to content

Commit

Permalink
Various fixed from #91
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-dk committed Sep 8, 2021
1 parent d123e3a commit dd48a57
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tortoolkit/uploaders/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, path, update_message, user_message):
self._user_message = user_message

async def execute(self):
self._update_message = self._update_message.client.get_messages(self._update_message.chat_id,ids=self._update_message.id)
self._update_message = await self._update_message.client.get_messages(self._update_message.chat_id,ids=self._update_message.id)

password = self._update_message.client.dl_passwords.get(self._user_message.id)
if password is not None:
Expand Down
15 changes: 11 additions & 4 deletions tortoolkit/utils/admin_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,32 @@ async def is_admin(client,user_id,chat_id, force_owner=False):
return False

try:
if user_id == chat_id:
# If accessed in private chat
if user_id in get_val("ALD_USR"):
return True
else:
return False

res = await client(GetParticipantRequest(
channel=chat_id,
user_id=user_id
participant=user_id
))

try:
if isinstance(res.participant,(ChannelParticipantAdmin,ChannelParticipantCreator,ChannelParticipantsAdmins)):
return True
else:

else:
if user_id in get_val("ALD_USR"):
return True
else:
return False

except:
torlog.info("Bot Accessed in Private {}".format(traceback.format_exc()))
return False
except Exception as e:
torlog.info("Bot Accessed in Private {}".format(e))
torlog.exception("Bot Accessed in Private {}".format(e))
if user_id in get_val("ALD_USR"):
return True
else:
Expand Down

0 comments on commit dd48a57

Please sign in to comment.