1.0.1 • Published 2 years ago

cooldown-wk v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

An npm to make your cooldown easier

const userModel = require('./models/User'); /* The database */
const cooldown = require('cooldown-wk'); /* The npm package */
let userGet = await userModel.findOne({ userId: message.author.id }); /* You need to use your own Database */
var number = 15000; /* 15 seconds to milliseconds */

if(user) {
  if(cooldown.compare(user.userCooldown)) {
    message.channel.send({ content: `You have to wait ${cooldown.time(user.userCooldown)} to use this command again.` });
  } else {
    user.userCooldown = cooldown.temporizator(number); /* Set cooldown time */
    await user.save();
    message.channel.send({ content: `You used the command!, Now you have to wait ${cooldown.timeResult(number)}` });
  };
} else {
  let newUser = new userModel({
    userId: message.author.id,
    userCooldown: 0
  });
  await newUser.save(); /* Create a new account */
  message.channel.send({ content: 'Try again!' });
}
1.0.1

2 years ago

1.0.0

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago