discord_bot/commands/economy/beg.js

41 lines
1.2 KiB
JavaScript
Raw Normal View History

const { MessageEmbed } = require("discord.js");
const db = require("quick.db");
const ms = require("parse-ms");
module.exports = {
name: "beg",
noalias: [""],
category: "economy",
description: "Beg for money",
usage: " ",
accessableby: "everyone"
,
run: async (bot, message, args) => {
let user = message.author;
let timeout = 120000;
let amount = 20;
let beg = await db.fetch(`beg_${user.id}`);
if (beg !== null && timeout - (Date.now() - beg) > 0) {
let time = ms(timeout - (Date.now() - beg));
let timeEmbed = new MessageEmbed()
.setColor("GREEN")
.setDescription(`❌ Du hast vor kurzem schon gebettelt, Bettel in ${time.minutes}m ${time.seconds}s erneut`);
message.channel.send(timeEmbed)
} else {
let moneyEmbed = new MessageEmbed()
.setColor("GREEN")
.setDescription(`✅ Sie haben ${amount} Coins erbettelt und erhalten`);
message.channel.send(moneyEmbed)
db.add(`money_${user.id}`, amount)
db.add(`begs_${user.id}`, 1)
db.set(`beg_${user.id}`, Date.now())
}
}
};