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:
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&#...
Jump to solution
5 Replies
Solution
Favna
Favna12mo ago
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 🩵🩷🤍🩷🩵 @vladdy
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&#...
vladdy
vladdy12mo ago
iirc preconditions start as and [a, b] -> a && b what favna sent looks..correct at first glance
chillihero
chilliheroOP12mo ago
easier 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
kyra
kyra12mo ago
[[[Manager, RoleHigher], GuildOwner, GuildAdmin]]
^< AND >
^< OR || || >
^< AND && >
[[[Manager, RoleHigher], GuildOwner, GuildAdmin]]
^< AND >
^< OR || || >
^< AND && >
That's basically (Manager && RoleHigher) || GuildOwner || GuildAdmin
vladdy
vladdy12mo ago
we really need to fix this setup... the moment you go into anything deeper than AND, it goes to hell
Want results from more Discord servers?
Add your server