#Whats the syntax to require Permission X AND Y OR Z when using requiredUserPermissions
1 messages · Page 1 of 1 (latest)
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 correct
not the same logic?
Lemme check the source code
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:
preconditions: [
{ name: 'UserPermissions', context: { permissions: PermissionFlags.Administrator } },
[
{ name: 'UserPermissions', context: { permissions: PermissionFlags.ManageGuild },
{ name: 'UserPermissions', context: { permissions: PermissionFlags.ManageChannels }
]
]
which represents this ^^^
Whats the syntax to require Permission X AND Y OR Z when using requiredUserPermissions