Whats the syntax to require Permission X AND Y OR Z when using requiredUserPermissions
when using
requiredUserPermissions
. Its an array so Im not sureSolution:Jump to solution
No, required user permissions does not allow nested arrays and "and/or" logic. I recommend you just implement it in the run function. Or, use the precondition directly:
```ts
preconditions: [
{ name: 'UserPermissions', context: { permissions: PermissionFlags.Administrator } },...
11 Replies
nested arrays?
like this?
makes more sense like this but you get the point
requiredUserPermissions: ['Administrator', ['ManageGuild', 'ManageRoles']],
Yes
So this would be Administrator and (either manage guild or channels)
what would either x y or z be? just the normal brackets? or is the 1. layer
and
and the second one is or
?first layer and, second or. For just or, it would be
[['x', 'y']]
Ohhh wait wait this is required user permissions, I thought you were talking about preconditions
I don't know if user permissions supports that nesting, but if it does, what I said is correctnot the same logic?
Lemme check the source code
Solution
No, required user permissions does not allow nested arrays and "and/or" logic. I recommend you just implement it in the run function. Or, use the precondition directly:
which represents this ^^^