You can use command cooldowns to ensure your commands are only ran every so often. Each cooldown type requires a string for it's duration and duration type (seconds, minutes, etc)
There are 4 types of cooldowns:
Example of per-user cooldowns:
JavaScript TypeScript
Copy const { CommandType , CooldownTypes } = require ( "wokcommands" );
module . exports = {
description : "Ping pong command" ,
type : CommandType . BOTH ,
cooldowns : {
type : CooldownTypes .perUser ,
duration : "1 d" ,
} ,
callback : () => {
return {
content : "Pong!" ,
};
} ,
};
Copy import { CommandObject , CommandType , CooldownTypes } from "wokcommands" ;
export default {
description : "Ping pong command" ,
type : CommandType . BOTH ,
cooldowns : {
type : CooldownTypes .perUser ,
duration : "1 d" ,
} ,
callback : () => {
return {
content : "Pong!" ,
};
} ,
} as CommandObject ;
Last updated 10 months ago