42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
|
const db = require('quick.db')
|
||
|
const { MessageEmbed } = require('discord.js')
|
||
|
const ms = require("parse-ms");
|
||
|
const Jwork = require('../../JSON/works.json');
|
||
|
const JworkR = Jwork[Math.floor(Math.random() * Jwork.length)];
|
||
|
|
||
|
module.exports = {
|
||
|
|
||
|
name: "work",
|
||
|
aliases: ["wr"],
|
||
|
category: "economy",
|
||
|
description: "Arbeiten, um Geld zu verdienen",
|
||
|
usage: " ",
|
||
|
accessableby: "everyone"
|
||
|
,
|
||
|
run: async (bot, message, args) => {
|
||
|
|
||
|
let user = message.author;
|
||
|
let author = await db.fetch(`work_${user.id}`)
|
||
|
|
||
|
let timeout = 1800000;
|
||
|
|
||
|
if (author !== null && timeout - (Date.now() - author) > 0) {
|
||
|
let time = ms(timeout - (Date.now() - author));
|
||
|
|
||
|
let timeEmbed = new MessageEmbed()
|
||
|
.setColor("GREEN")
|
||
|
.setDescription(`❌ Sie haben bereits vor Kurzem gearbeitet\n\nVersuchen Sie es in ${time.minutes}m ${time.seconds}s erneut`);
|
||
|
message.channel.send(timeEmbed)
|
||
|
} else {
|
||
|
let amount = Math.floor(Math.random() * 80) + 1;
|
||
|
let embed1 = new MessageEmbed()
|
||
|
.setColor("GREEN")
|
||
|
.setDescription(`✅ **${JworkR} ${amount}**`)
|
||
|
message.channel.send(embed1)
|
||
|
|
||
|
db.add(`works_${user.id}`, 1)
|
||
|
db.add(`money_${user.id}`, amount)
|
||
|
db.set(`work_${user.id}`, Date.now())
|
||
|
};
|
||
|
}
|
||
|
};
|