#Command Cooldown

1 messages · Page 1 of 1 (latest)

strong tendon
#

Here

#

I have slash

worldly aurora
#

so what you can do

#

is make it so that

#

it loads all the command names

#

into a map

#

with a number

#

then you can load the map into discord by doing client.commandmap = themap;

#

then in each command

strong tendon
#

waitwaitwaitwait

#

How do I make a map

worldly aurora
#

you can mess with maps here

#

just a few lines

#

that teach you about it

strong tendon
#

Ok so continue

worldly aurora
#

so you load the map into discord

#

because you can do that with any module

#

doesnt even have to be discord

#

but

#

then in the command you want to have a delay

#

oh

#

you also would have to make the map display who executed it with their id

#

so in the command file

#

it will check if the command is 0

#

and if its 0

#

it will execute no problem

#

but if its 1 it will say that there is a delay

#

and you make it so the map number

#

resets

#

each time

#

like

#

each minute

#

or something

strong tendon
#

How

worldly aurora
#

in your cmd handler

#

does it log

#

when the msg

#

is made

#

sorry

#

when the command

#

is loaded

strong tendon
#

Yeah

worldly aurora
#

like blahblah.js is loaded

strong tendon
#

yeah

worldly aurora
#

so you can do

strong tendon
worldly aurora
#

mapname.set(interaction.user, [everyloadedcommand: "0"])

#

so like

#

that as an example

#

it makes an object in the map

#

with ur id

#

with every command name

#

and 0

#

then when you execute the command

strong tendon
#

Ohhhhhh

worldly aurora
#

you make it add 1

#

to the 0

#

and if its 1

#

it sends an error

#

then you just make it reset back to 0 after however long

#

you want the cooldown

#

to be

strong tendon
#

So when the bot logs that the command has loaded it will also set all the commands to 0 in the map

worldly aurora
#

ya

strong tendon
worldly aurora
#

so for that

#
    setTimeout(function() {
        map.set((interaction.user).specificcommand, 0)
    }, timeuntilresetnumberhere);
#

send the command handler

strong tendon
#
const fs = require('fs');

fs.readdirSync('./src/Commands').filter(file => file.endsWith('js')).forEach(file =>{
  /**
  * @type {Command}
  */
  const command = require(`../Commands/${file}`)
  console.log(`Command ${command.name} has loaded!`)
  this.commands.set(command.name, command)

});
#

I have 4 minutes eeeeeeee

#

3

#

2

#

1

#

@worldly aurora Gtg you can send how to do it but I won't see it till morning. Thank you for your help!