U
U
ukrainemf2020-11-13 01:05:10
Node.js
ukrainemf, 2020-11-13 01:05:10

How to add cd to a team?

How to add a CD to the command below, for example, for 24 hours?

module.exports.run = async (bot, message, args) => {
    const profile = require('../profile.json');
    const bonus = 50;
    profile[message.author.id].coins = profile[message.author.id].coins + bonus
    await message.reply(` вы получили бонус ${bonus} Coins!`);
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
ukrainemf, 2020-11-14
@ukrainemf

In general, I decided to simply add daily to the profile and when I entered the /daily command I changed this value to 1, then I added the SetTimeout () function and after a minute it changed the value of daily in the profile back to 0.

module.exports.run = async (bot, message, args) => {
    const profile = require('../profile.json');
    if(profile[message.author.id].daily == 1) return message.reply(' no!')
    const bonus = 50;
    profile[message.author.id].coins = profile[message.author.id].coins + bonus;
    await message.reply(` вы получили бонус ${bonus} Coins!`);
    profile[message.author.id].daily = 1;
    setTimeout(() => {
        profile[message.author.id].daily = 0;
    }, 60000);
};

N
Nikita Kudrin, 2020-11-14
@HepkaPlay

Here it is written how to do it.
Good luck!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question