Command cooldown
Coded by Rhaze Requested by Gekimunknown
javascript
2 years ago
700 B
12
Indexable
if (input.startsWith('example') { //create a cooldown if not vip if (!(vips.includes(event.senderID))) { if (!(event.senderID in cd)) { cd[event.senderID] = Math.floor(Date.now() / 1000) + (60 * 0.5); } else if (Math.floor(Date.now() / 1000) < cd[event.senderID]) { api.sendMessage("⚠️Opps you're going to fast! Wait for " + Math.floor(cd[event.senderID] - Math.floor(Date.now() / 1000)) % 60 + " second/s", event.threadID, event.messageID); return 0; } else { cd[event.senderID] = Math.floor(Date.now() / 1000) + (60 * 0.5); } } //run command try { //command code here } catch (error) { console.log(error.meessage) } }
Editor is loading...