How to reset the command cooldown in JS

I've been searching around in the server and the only solution I found was written in TypeScript, any way to do this in JS?
Solution:
this.container.stores.get('preconditions').get('Cooldown').buckets.delete(this);
this.container.stores.get('preconditions').get('Cooldown').buckets.delete(this);
now the top link code is JS, see how easy it is to remove types....
Jump to solution
4 Replies
Favna
Favna5mo ago
TypeScript is JavaScript. All valid JavaScript is also valid TypeScript. You can just ignore the type information and write the exact same code. For example:
function sum(a: number, b: number): number {
return a + b;
}
function sum(a: number, b: number): number {
return a + b;
}
vs JS
function sum(a, b) {
return a + b;
}
function sum(a, b) {
return a + b;
}
aiden
aiden5mo ago
i see, the solution i found was a little heavy on types i got overwhelmed trying to figure it out https://discord.com/channels/737141877803057244/1148149986547208192/1148174169616437338 thought id ask in case there was a separate solution i did find a snippet of code without the types but it errors out on the .buckets and i couldnt figure out how to fix it was this one in the legacy support channel https://discord.com/channels/737141877803057244/737142503043498015/1042220290643599432 never got the hang of it trying to make sense of the weakmaps
Solution
Favna
Favna5mo ago
this.container.stores.get('preconditions').get('Cooldown').buckets.delete(this);
this.container.stores.get('preconditions').get('Cooldown').buckets.delete(this);
now the top link code is JS, see how easy it is to remove types.
aiden
aiden5mo ago
i dont think i have the brain capacity to understand why i got a TypeError: Cannot read properties of undefined (reading 'buckets') error beforehand LMAO thank you regardless that does work
Want results from more Discord servers?
Add your server