Fix perm (#42)

This commit is contained in:
yasirarism 2023-04-11 12:13:23 +07:00 committed by GitHub
parent e67c971000
commit 0304645b73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -127,6 +127,11 @@ async def check_perms(
sender = message.reply_text
chat = message.chat
# TODO: Cache all admin permissions in db.
if not message.from_user:
# For anonymous admins
if message.sender_chat and message.sender_chat.id == message.chat.id:
return True
return False
user = await chat.get_member(message.from_user.id)
if user.status == enums.ChatMemberStatus.OWNER:
return True

View file

@ -40,8 +40,7 @@ async def currency(c: Client, m: Message):
last_update = data["time_last_update_utc"]
except KeyError:
return await kirimPesan(m, "<code>Invalid response from api !</i>")
await kirimPesan(m, "**CURRENCY EXCHANGE RATE RESULT:**\n\n" f"`{amount}` **{target_code}** = `{round(conversion_result)}` **{base_code}**\n" f"<b>Rate Today</b> = `{round(conversion_rate)}`\n" f"<b>Last Update:</b> {last_update}")
await kirimPesan(m, "**CURRENCY EXCHANGE RATE RESULT:**\n\n" f"`{amount}` **{base_code}** = `{round(conversion_result)}` **{target_code}**\n" f"<b>Rate Today</b> = `{round(conversion_rate)}`\n" f"<b>Last Update:</b> {last_update}")
except:
await kirimPesan(m, "Failed convert currency, maybe you give wrong currency format or api down.")
else: