Skip to content

Commit

Permalink
Update only_admins.py and only_managers.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiiRepair committed Sep 19, 2023
1 parent 7b8825e commit 8b97434
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions bot/decorators/only_admins.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@


def only_admins(func):
"""
Allow only admins to use any command.
"""
@functools.wraps(func)
async def _(client: Client, message: Message):
if not message.chat.type == ChatType.PRIVATE:
Expand Down
5 changes: 4 additions & 1 deletion bot/decorators/only_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@


def only_managers(func):
"""
Allow only admins and user requester to use any command.
"""
@functools.wraps(func)
async def _(client: Client, any):
try:
Expand All @@ -29,8 +32,8 @@ async def _(client: Client, any):
text="**__You are not my master or played user, you cannot execute this action.__** \U0001f621",
show_alert=True,
)
await func(client, any)
except Exception as e:
logging.error(e)
await func(client, any)

return _

0 comments on commit 8b97434

Please sign in to comment.