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?
![](https://utfs.io/f/2d238d26-563f-46a3-957b-92aa8a801df2-1nq2cb.png)
makes more sense like this but you get the point
![](https://utfs.io/f/531a5e87-04f6-4ad8-a5eb-ca968b01971b-1nq2cb.png)
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 ^^^