#Whats the syntax to require Permission X AND Y OR Z when using requiredUserPermissions

1 messages · Page 1 of 1 (latest)

stuck delta
#

when using requiredUserPermissions. Its an array so Im not sure

copper zealotBOT
#

@stuck delta to help others find answers, you can mark your question as solved via Right Click Solution Message->Apps->✅ Mark Solution

stuck delta
#

nested arrays?

#

like this?

#

makes more sense like this but you get the point

#

requiredUserPermissions: ['Administrator', ['ManageGuild', 'ManageRoles']],

hybrid rapids
#

Yes

hybrid rapids
stuck delta
hybrid rapids
#

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

stuck delta
#

not the same logic?

hybrid rapids
#

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 }
  ]
]
hybrid rapids
stuck delta
#

Whats the syntax to require Permission X AND Y OR Z when using requiredUserPermissions