Commands not respecting cooldown preconditions
I'm trying to make a command only run once every 10 mins globally, but it seems to just run anyway. @sapphire/framework v4.7.0
35 Replies
@! naeko.moe is that a proper impl of your plugin? could it be conflicting in preconditions?
need to test
In v2.3.0 of @kaname-png/plugin-subcommands-advanced btw (latest)
@! naeko.moe any updates?
Today
@! naeko.moe
i did get it working days ago with a custom cooldown but its still worth looking into
It's weird that it doesn't work because what I do is grab all the preconditions of the command and then run the test whether they pass or not
https://github.com/sawa-ko/neko-plugins/blob/main/packages/subcommands-advanced/src/lib/utils/const.ts#L36-L49
According to this line of code, the cooldown precondition is registered in the preconditions option of the command, which option is the one I read in my plugin
https://github.com/sapphiredev/framework/blob/main/src/lib/structures/Command.ts#L434-L437 try new version
2.4.0
does the latest version adds support for message based sub commands?
it doesnt, it only switches preconditions to the preconditions provided by the base @sapphire/plugin-subcommands
so if you want message based sub commands you'll have to stick to the base plugin and forego decorators
granted there isn't much advantage to using the advanced plugin for message based subcommands because message based subcommands do not need to be registered at the discord api
Uh i see, the default plugin for subcommands is pretty great anyways
and having
isn't much config either
would be better if i could have multiple decorators for each subcommand having the same attributes as the Command.Options
the only thing you might be missing is description but you can chuck that into
detailedDescription
already anywaySo is it possible to have seperate cooldowns for each subcommand?
yes
that was added with subcommand specific preconditions months ago
Wait what?, I haven't updated but can you provide me with a example?
because my typings isn't allowing me to (event after the update)
it was added in 4.1.0 on 2023-08-21
oh alr let me check
Oh i see, but those are preconditions and definitely possible to have seperate cooldowns with the precondition approach, but then we would still need to create our own Preconditions right
wdym
I saw the pr, it only adds the support for preconditions only right, i am talking abt these options https://www.sapphirejs.dev/docs/Documentation/api-framework/interfaces/CommandOptions#cooldowndelay
cooldowns are also preconditions
the only thing missing are the shortcut options. that you linked
but you can still add the precondition yourself
and how do i configure them? precondition resolvables doesn't take objects right?
they do
Sapphire Framework
Interface: PreconditionSingleResolvableDetails | Sapphire
Defines the detailed options for the PreconditionContainerSingle, where both the PreconditionContext and the
oh yeah just found out
thanks a lot
It'll be very helpful thanks again
❤️
GitHub
feat(subcommands): add support for all remaining precondition short...
No idea why I didn't just do this right away when I added runIn
yeah lmfao, i was struggling with this a minute ago thanks a lot
am I giving you extra work again ?
@Xeno™ seeing as you dont have the
Ping Me For Announcements
role you may have missed #Announcements so it's been released. Going to unfollow this thread now.Oh ok alr