How to use "and" & "or" with preconditions?
The Guide does not have any examples of this, so Im wondering how I can achive this.
Having one of multiple preconditions needing to match
Having multiple preconditions needing to match
Solution:Jump to solution
should be
[['AdminOnly', ['ModOnly', 'OwnerOnly']], 'InVoiceChannel'];
for
- AdminOnly
- AND ModOnly OR OwnerOnly
- AND InVoiceChannel
...GitHub
request: easier syntax for combining preconditions · Issue #334 · s...
Is your feature request related to a problem? Please describe. Currently the way to combine preconditions is using nested arrays such as: [['AdminOnly', ['ModOnly', 'OwnerOnly&#...
5 Replies
Solution
should be
[['AdminOnly', ['ModOnly', 'OwnerOnly']], 'InVoiceChannel'];
for
- AdminOnly
- AND ModOnly OR OwnerOnly
- AND InVoiceChannel
but iirc there was also a bug in how precondition AND/OR conditions are resovled but I don't remember the bug exactly and we sadly forgot to ever create a GH issue. That said we also have a GH issue https://github.com/sapphiredev/framework/issues/334 which would probably be a breaking change but make the syntax much easier.
CC @kyra 🩵🩷🤍🩷🩵 @vladdyGitHub
request: easier syntax for combining preconditions · Issue #334 · s...
Is your feature request related to a problem? Please describe. Currently the way to combine preconditions is using nested arrays such as: [['AdminOnly', ['ModOnly', 'OwnerOnly&#...
iirc preconditions start as and
[a, b]
-> a && b
what favna sent looks..correct at first glanceeasier syntax would be awesome
what would the result of this logic be?
<Manager AND RoleHigher> OR GuildOwner OR GuildAdmin
ah wait as a guild owner / with administator permission you automatically have the manage server permission so the multiple preconditions are not necessary.
would still intrest me tho
That's basically
(Manager && RoleHigher) || GuildOwner || GuildAdmin
we really need to fix this setup...
the moment you go into anything deeper than AND, it goes to hell