#Converter
1 messages · Page 1 of 1 (latest)
It's not possible to enforce it in the client
But it's literally just an if statement in the body
How about a decorator for implementation?
not sure what you mean by that
Can this logic be implemented through @lightbulb.add_checks ?
No
In fact, I'm trying to implement it through this kind of logic.
class ValidRoleConverter(lightbulb.converters.RoleConverter):
async def convert(self, ctx: lightbulb.Context, argument: str) -> hikari.Role:
role = await super().convert(ctx, argument)
if role.is_everyone:
raise ValueError('Use of the @everyone role is prohibited')
return role
and
@lightbulb.option('role_1', 'Select role 1', ValidRoleConverter, required=True)
@lightbulb.option('role_2', 'Select role 2', ValidRoleConverter, required=True)
But I'm doing something wrong because it's not working.
https://hikari-lightbulb.readthedocs.io/en/latest/guides/commands.html#adding-checks-to-commands
I was able to do this, through a custom check
the presence of the options upon check invocation is not guaranteed
so if something changes in lightbulb internals that breaks it then on your head be it
OK, how best to do this given that this logic is needed for about 8-12 invoke command
you can write your own decorator and place it at the bottom of the stack
because when it is invoked the args are guaranteed to be populated