Skip to content
Snippets Groups Projects
Commit 75bcb921 authored by Reviath's avatar Reviath
Browse files

Fixed daily command

parent 8f536eb6
No related branches found
No related tags found
No related merge requests found
......@@ -24,13 +24,20 @@ exports.run = async(client, message, args, connection) => {
resolve(result);
});
});
var daily2 = "";
if(daily.length < 1) {
daily2 = null;
}
else {
daily2 = daily[0].time
}
if (daily !== null && cooldown - (Date.now() - daily)> 0 ){
let time = ms(cooldown - (Date.now() - daily),{ long: true });
if (daily !== null && cooldown - (Date.now() - daily2)> 0 ){
let time = ms(cooldown - (Date.now() - daily2),{ long: true });
message.channel.send(`You already claimed today's daily. Please wait \`${time.hours}h ${time.minutes}m ${time.seconds}s\` to claim again.`);
} else{
message.channel.send(`Successfully claimed ${amout}\$.`);
let sql = `UPDATE lastDaily SET time ='${Date.now()}' WHERE guildid ='${message.guild.id}' AND userid ='${message.author.id}'`
let sql = `INSERT INTO lastDaily (time, userid, guildid) VALUES (${Date.now()}, ${message.author.id}, ${message.guild.id})`
connection.query(sql, function (err, result) {
if (err) throw err;
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment