Skip to content

Commit

Permalink
how does this not work
Browse files Browse the repository at this point in the history
  • Loading branch information
Starlii10 committed Oct 26, 2024
1 parent d5929e6 commit d6c64d4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions extras/viviatools.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,22 +323,22 @@ def ownerOnly(func: Callable) -> Callable:
Decorator that only allows the bot owner to execute a command.
"""
@wraps(func)
def wrapper(bot: commands.Bot, ctx: commands.Context, *args, **kwargs):
async def wrapper(bot: commands.Bot, ctx: commands.Context, *args, **kwargs):
if bot.owner_id == ctx.author.id:
asyncio.run(ctx.send(personalityMessage("missingpermissions")))
await ctx.send(personalityMessage("missingpermissions"))
return False
return func(bot, ctx, *args, **kwargs)
return await func(bot, ctx, *args, **kwargs)
return wrapper

def adminOnly(func: Callable) -> Callable:
"""
Decorator that only allows Vivia Admins to execute a command.
"""
@wraps(func)
def wrapper(bot: commands.Bot, ctx: commands.Context, *args, **kwargs):
async def wrapper(bot: commands.Bot, ctx: commands.Context, *args, **kwargs):
if has_bot_permissions(ctx.author, ctx.guild):
return func(bot, ctx, *args, **kwargs)
asyncio.run(ctx.send(personalityMessage("missingpermissions")))
return await func(bot, ctx, *args, **kwargs)
await ctx.send(personalityMessage("missingpermissions"))
return False
return wrapper

Expand All @@ -347,9 +347,9 @@ def blockInDMs(func: Callable) -> Callable:
Decorator that blocks commands from being executed in DMs.
"""
@wraps(func)
def wrapper(bot: commands.Bot, ctx: commands.Context, *args, **kwargs):
async def wrapper(bot: commands.Bot, ctx: commands.Context, *args, **kwargs):
if not ctx.guild:
asyncio.run(ctx.send(personalityMessage("nodm")))
await ctx.send(personalityMessage("nodm"))
return False
return func(bot, ctx, *args, **kwargs)
return await func(bot, ctx, *args, **kwargs)
return wrapper

0 comments on commit d6c64d4

Please sign in to comment.