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

No description
No description
32 Replies
chillihero
chilliheroโ€ข2y 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
Favnaโ€ข2y 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
vladdyโ€ข2y ago
did you really have to use github.dev
Favna
Favnaโ€ข2y ago
oh
vladdy
vladdyโ€ข2y ago
it does work tho
Favna
Favnaโ€ข2y ago
well yes, much easier to navigate
vladdy
vladdyโ€ข2y ago
so I'll give you that
Favna
Favnaโ€ข2y ago
there changed the urls I use github.dev quite a lot tbh
vladdy
vladdyโ€ข2y 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
Favnaโ€ข2y 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
vladdyโ€ข2y 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
Favnaโ€ข2y ago
it makes preconditions in the "or" syntax
๐ŸŽƒ ararou!
๐ŸŽƒ ararou!โ€ข2y ago
ah wtf
Favna
Favnaโ€ข2y 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
Favnaโ€ข2y 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
Favnaโ€ข2y ago
Thonkang precondition combine syntax is wacko
vladdy
vladdyโ€ข2y 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
Teixeiraโ€ข15mo ago
Ran into this issue today ๐Ÿ˜ฆ Took me quite some time to understand why it wasn't working as intended
Favna
Favnaโ€ข15mo ago
imagine if @kyra ๐Ÿฉต๐Ÿฉท๐Ÿค๐Ÿฉท๐Ÿฉต didnt ignore this entire thread @vladdy
vladdy
vladdyโ€ข15mo ago
OMEGALUL
kyra
kyraโ€ข15mo ago
This thread is literally made after my first semester's finals, when I was busy preparing for maths angery
Favna
Favnaโ€ข15mo ago
and it's existed ever since, which has spanned a lot of time. Stop making excuses angery
kyra
kyraโ€ข15mo 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
kyraโ€ข15mo ago
Now I'll have a shower and leave to see grandparents
Teixeira
Teixeiraโ€ข15mo ago
Thanks everyone!
Want results from more Discord servers?
Add your server