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: "coins-system",
|
|
aliases: ["week"],
|
|
category: "economy",
|
|
description: "Gibt Ihnen 5000 pro Tag",
|
|
usage: " ",
|
|
accessableby: "everyone"
|
|
,
|
|
run: async (bot, message, args) => {
|
|
|
|
let user = message.author;
|
|
let timeout = 604800000;
|
|
let amount = 5000;
|
|
|
|
let weekly = await db.fetch(`weekly_${user.id}`);
|
|
|
|
if (weekly !== null && timeout - (Date.now() - weekly) > 0) {
|
|
let time = ms(timeout - (Date.now() - weekly));
|
|
|
|
let timeEmbed = new MessageEmbed()
|
|
.setColor("GREEN")
|
|
.setDescription(`❌ Sie haben Ihre wöchentliche Prämie bereits abgeholt\n\nHolen Sie sie in ${time.days}d ${time.hours}h ${time.minutes}m ${time.seconds}s erneut ab `);
|
|
message.channel.send(timeEmbed)
|
|
} else {
|
|
let moneyEmbed = new MessageEmbed()
|
|
.setColor("GREEN")
|
|
.setDescription(`✅ Sie haben Ihre wöchentliche Prämie in Höhe von ${amount} Münzen gesammelt`);
|
|
message.channel.send(moneyEmbed)
|
|
db.add(`money_${user.id}`, amount)
|
|
db.set(`weekly_${user.id}`, Date.now())
|
|
|
|
|
|
}
|
|
}
|
|
} |