Eventho runIn has values Guildtext and dm, if run in guild text, error message is shown
32 Replies
Not sure where to put Bugreports, but I dont think this is intendet behaviour
i think thats intended by framework
not too sure tho
and what is the issue anyway
can you elaborate
It should allow both... not sure what is going on there tbh.
would have to look into what preconditions it creates under the hood
and why the DM only one triggers when used in a guild text channel
assuming you tried it in a guild text channel
so that's NOT a thread, NOT a forum post and NOT a voice text channel
reading the code though you should get preconditions of
DMOnly
and GuildTextOnly
but I might have an inclination where it is going wrong
@kyra ๐ฉต๐ฉท๐ค๐ฉท๐ฉต @vladdy when you look at these bits of code:
https://github.com/sapphiredev/framework/blob/main/src/lib/structures/Command.ts#L414-L495
https://github.com/sapphiredev/framework/blob/main/src/lib/utils/preconditions/PreconditionContainerArray.ts#L127-L142
do you also draw the conclusion that the runIn
preconditions are added as PreconditionRunCondition.And
instead of the expected PreconditionRunCondition.Or
?did you really have to use github.dev
oh
it does work tho
well yes, much easier to navigate
so I'll give you that
there changed the urls
I use github.dev quite a lot tbh
you are right that its an AND check right now
which is...weird
and making it an OR check requires either a jank parent existing for no reason, or overriding a readonly property
this is why we need preconditions v2
ngl
(internally, not externally)
So I forgot the exact syntax but I think as a temporary fix what you can do is instead of using
runIn
use this @chillihero
uhhh
yeahh and removing runIn but we should really fix this someday
I'm surprised nobody found it till now
@kyra ๐ฉต๐ฉท๐ค๐ฉท๐ฉต you made it, you fix it please
why the extra [
it makes preconditions in the "or" syntax
ah
wtf
so it's DMOnly OR GuildText AND everything beyond it
in JS terms
yeah it's not the best syntax
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', ...
i use
['Blacklisted', 'Channels']
and it checks if the user is blacklisted and if not, checks the channel the commands ran in and prevents it if the channel isn't in an array of bot cmd channels
works well so ๐คทcmd:
config
and channels
precondition combine syntax is wacko
yes
thats because by default its in And mode
the issue is runIn also ends up in
and
mode
when it should be in or modeO
Ran into this issue today ๐ฆ Took me quite some time to understand why it wasn't working as intended
imagine if @kyra ๐ฉต๐ฉท๐ค๐ฉท๐ฉต didnt ignore this entire thread @vladdy
This thread is literally made after my first semester's finals, when I was busy preparing for maths
and it's existed ever since, which has spanned a lot of time. Stop making excuses
@vladdy @Favna https://github.com/sapphiredev/framework/pull/655
GitHub
refactor(preconditions): add
RunIn
, deprecate everything else by ...Fixes the issue in thread #Eventho runIn has values Guildtext and dm, if run in guild text, error message is shown.
I deprecated the following preconditions:
DMOnly
GuildNewsOnly
GuildNewsThreadOn...
Now I'll have a shower and leave to see grandparents
Thanks everyone!