Answer the question
In order to leave comments, you need to log in
How to make a random issue of currency?
How to make it so that not 200 coins are given, but from 100 to 500 for example
const Discord = require("discord.js");
const db = require("quick.db");
const ms = require("parse-ms");
module.exports.run = async (bot, message, args) => {
if(!message.content.startsWith('!'))return;
let user = message.author;
let timeout = 86400000;
let amount = 200;
let daily = await db.fetch(`daily_${message.guild.id}_${user.id}`);
if (daily !== null && timeout - (Date.now() - daily) > 0) {
let time = ms(timeout - (Date.now() - daily));
let timeEmbed = new Discord.MessageEmbed()
.setAuthor(`Daily`, message.author.displayAvatarURL)
.setColor("GREEN")
.setDescription(`Вы уже забрали свою ежедневную награду, забери награду снова через ${time.hours}ч ${time.minutes}м ${time.seconds}с `);
message.channel.send(timeEmbed)
} else {
let moneyEmbed = new Discord.MessageEmbed()
.setColor("GREEN")
.setDescription(`Вы получили ежедневную награду в размере ${amount} коинов`);
message.channel.send(moneyEmbed)
db.add(`money_${message.guild.id}_${user.id}`, amount)
db.set(`daily_${message.guild.id}_${user.id}`, Date.now())
}
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question