@command()
@moderation_checks()
@guild_permission_check("ban", ban_members=True)
@bot_has_guild_permissions(ban_members=True)
@cooldown(1, 5, BucketType.member)
@guild_only()
@check_blacklist()
async def ban(
self,
ctx: Context,
user: User,
time: str | None,
*,
reason: str | None,
):```
lets say this is the command
and this is the moderation_checks decorator factory
```py
def moderation_checks():
async def predicate(ctx: Context):
print(ctx.args)
return True
return check(predicate)```
so i am printing ctx.args its always returning an empty list so is there no way in my decorator i can acess the user being targetted in the ban command ?
#args not passing to decorator
1 messages · Page 1 of 1 (latest)
if i use before_invoke decorator it passes the cog and the ctx to my function and then from there if i do ctx.args i do get the user
but why not directly then ?
is this a bug or something because in the before_invoke its passing the args correctly
that isnt how decorators work
this is the syntax-
def decorator(func:typing.Callable):
async def wrapper(*args, **kwargs):
return await func(*args, **kwargs)
return wrapper
i know how they work i am just using the same syntax as the library has used for other checks such as this one in the screen shot
also i have one more custom made decorator which works fine
the ctx is passed correctly
but the args associated with it come to be empty always
if i use the before_invoke decortaor and pass in a coro to it it will work fine
when u pass in the predicate into the check it returns the decorator then
please open a new thread if you still need help