40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
const { MessageEmbed } = require("discord.js");
|
|
const db = require("quick.db");
|
|
const ms = require("parse-ms");
|
|
|
|
module.exports = {
|
|
|
|
name: "daily",
|
|
aliases: ["coins-system"],
|
|
category: "economy",
|
|
description: "Gibt Ihnen 200 pro Tag",
|
|
usage: " ",
|
|
accessableby: "everyone"
|
|
,
|
|
run: async (bot, message, args) => {
|
|
let user = message.author;
|
|
|
|
let timeout = 86400000;
|
|
let amount = 200;
|
|
|
|
let daily = await db.fetch(`daily_${user.id}`);
|
|
|
|
if (daily !== null && timeout - (Date.now() - daily) > 0) {
|
|
let time = ms(timeout - (Date.now() - daily));
|
|
|
|
let timeEmbed = new MessageEmbed()
|
|
.setColor("GREEN")
|
|
.setDescription(`❌ Sie haben Ihre tägliche Belohnung bereits abgeholt\n\nSammeln Sie sie in ${time.hours}h ${time.minutes}m ${time.seconds}s erneut`);
|
|
message.channel.send(timeEmbed)
|
|
} else {
|
|
let moneyEmbed = new MessageEmbed()
|
|
.setColor("GREEN")
|
|
.setDescription(`✅ Sie haben Ihre tägliche Prämie in Höhe von ${amount} Münzen gesammelt`);
|
|
message.channel.send(moneyEmbed)
|
|
db.add(`money_${user.id}`, amount)
|
|
db.set(`daily_${user.id}`, Date.now())
|
|
|
|
|
|
}
|
|
}
|
|
} |