Cooldowns during command execution
Hi all, wondering if there is a way to set a cooldown using with the global cooldown precondition during command execution? Creating a system for transactions, if said transaction goes through I would like the cooldown to be x amount. Otherwise if it fails, I'd like it to be the default value. Not sure if I need to implement a custom system for this or if this can be achieved with the default tools given.
Solution:Jump to solution
You will have to implement a custom system for this leveraging listeners and a cache for the cool down state.
8 Replies
If you find the time to reply, I'd greatly appreciate you pinging me when responding! :)
Solution
You will have to implement a custom system for this leveraging listeners and a cache for the cool down state.
Okay, thank you lots! I'll end up doing that then. Any recommendations for a cache?
A Map, or Collection if you need to additional methods DJS adds. The exact same way that DJS caches things.
Do you have any idea how I could clear these cooldowns from cache?
MDN Web Docs
Map.prototype.delete() - JavaScript | MDN
The delete() method of Map instances removes the specified element from this map by
key.
yeah but do i check every x minute or
whats a good practice for this
there isnt really any standard. You decide for yourself.