Eventho runIn has values Guildtext and dm, if run in guild text, error message is shown

No description
No description
32 Replies
chillihero
chillihero2y ago
Not sure where to put Bugreports, but I dont think this is intendet behaviour
Ararou 🍭
Ararou 🍭2y ago
i think thats intended by framework not too sure tho and what is the issue anyway can you elaborate
Favna
Favna2y ago
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?
vladdy
vladdy2y ago
did you really have to use github.dev
Favna
Favna2y ago
oh
vladdy
vladdy2y ago
it does work tho
Favna
Favna2y ago
well yes, much easier to navigate
vladdy
vladdy2y ago
so I'll give you that
Favna
Favna2y ago
there changed the urls I use github.dev quite a lot tbh
vladdy
vladdy2y ago
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)
Favna
Favna2y ago
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
preconditions: [['DMOnly', 'GuildText'], /* any other preconditions here */]
preconditions: [['DMOnly', 'GuildText'], /* any other preconditions here */]
vladdy
vladdy2y ago
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
Ararou 🍭
Ararou 🍭2y ago
why the extra [
Favna
Favna2y ago
it makes preconditions in the "or" syntax
Ararou 🍭
Ararou 🍭2y ago
ah wtf
Favna
Favna2y ago
so it's DMOnly OR GuildText AND everything beyond it
if ((DMOnly || GuildText) && somethingElse)
if ((DMOnly || GuildText) && somethingElse)
in JS terms yeah it's not the best syntax
Favna
Favna2y ago
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', ...
Ararou 🍭
Ararou 🍭2y ago
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 🤷
Ararou 🍭
Ararou 🍭2y ago
cmd:
No description
Ararou 🍭
Ararou 🍭2y ago
config
No description
Ararou 🍭
Ararou 🍭2y ago
and channels
No description
Favna
Favna2y ago
Thonkang precondition combine syntax is wacko
vladdy
vladdy2y ago
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 mode
Ararou 🍭
Ararou 🍭2y ago
O
Teixeira
Teixeira12mo ago
Ran into this issue today 😦 Took me quite some time to understand why it wasn't working as intended
Favna
Favna12mo ago
imagine if @kyra 🩵🩷🤍🩷🩵 didnt ignore this entire thread @vladdy
vladdy
vladdy12mo ago
OMEGALUL
kyra
kyra12mo ago
This thread is literally made after my first semester's finals, when I was busy preparing for maths angery
Favna
Favna12mo ago
and it's existed ever since, which has spanned a lot of time. Stop making excuses angery
kyra
kyra12mo ago
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...
kyra
kyra12mo ago
Now I'll have a shower and leave to see grandparents
Teixeira
Teixeira12mo ago
Thanks everyone!