78 lines
2.2 KiB
JavaScript
78 lines
2.2 KiB
JavaScript
|
const { MessageEmbed } = require("discord.js");
|
||
|
const db = require("quick.db");
|
||
|
|
||
|
module.exports = {
|
||
|
|
||
|
name: "pay",
|
||
|
noalias: [""],
|
||
|
category: "economy",
|
||
|
description: "An jemanden zahlen",
|
||
|
usage: "[mention | ID] <amount>",
|
||
|
accessableby: "everyone"
|
||
|
,
|
||
|
run: async (bot, message, args) => {
|
||
|
try {
|
||
|
let user2 = message.author
|
||
|
if (!args[0]) return message.channel.send("**Bitte geben Sie einen Benutzer ein!**");
|
||
|
let user =
|
||
|
message.mentions.members.first() ||
|
||
|
message.guild.members.cache.get(args[0]) ||
|
||
|
message.guild.members.cache.find(
|
||
|
r => r.user.username.toLowerCase() === args[0].toLocaleLowerCase()
|
||
|
) ||
|
||
|
message.guild.members.cache.find(
|
||
|
r => r.displayName.toLowerCase() === args[0].toLocaleLowerCase()
|
||
|
);
|
||
|
if (!user) return message.channel.send("**Geben Sie einen gültigen Benutzer ein!**");
|
||
|
|
||
|
let member = db.fetch(`money_${user2.id}`);
|
||
|
|
||
|
let embed1 = new MessageEmbed()
|
||
|
.setColor("GREEN")
|
||
|
.setDescription(`❌ Erwähnen Sie jemanden zum Bezahlen`);
|
||
|
|
||
|
if (!args[0]) {
|
||
|
return message.channel.send(embed1);
|
||
|
}
|
||
|
let embed2 = new MessageEmbed()
|
||
|
.setColor("GREEN")
|
||
|
.setDescription(`❌ Sie können nicht selbst bezahlen`);
|
||
|
|
||
|
if (user.user.id === message.author.id) {
|
||
|
return message.channel.send(embed2);
|
||
|
}
|
||
|
|
||
|
let embed3 = new MessageEmbed()
|
||
|
.setColor("GREEN")
|
||
|
.setDescription(`❌ Geben Sie einen zu zahlenden Betrag an`);
|
||
|
|
||
|
if (!args[1]) {
|
||
|
return message.channel.send(embed3);
|
||
|
}
|
||
|
let embed4 = new MessageEmbed()
|
||
|
.setColor("GREEN")
|
||
|
.setDescription(`❌ Geben Sie einen gültigen Betrag ein!`);
|
||
|
|
||
|
if (isNaN(args[1])) {
|
||
|
return message.channel.send(embed4);
|
||
|
}
|
||
|
let embed5 = new MessageEmbed()
|
||
|
.setColor("GREEN")
|
||
|
.setDescription(`❌ Du hast nicht so viel Geld`);
|
||
|
|
||
|
if (member < args[1]) {
|
||
|
return message.channel.send(embed5);
|
||
|
}
|
||
|
|
||
|
let embed6 = new MessageEmbed()
|
||
|
.setColor("GREEN")
|
||
|
.setDescription(`✅ Sie haben ${user.displayName} ${args[1]} Coins bezahlt`);
|
||
|
|
||
|
message.channel.send(embed6);
|
||
|
db.add(`money_${user.id}`, args[1]);
|
||
|
db.subtract(`money_${user2.id}`, args[1]);
|
||
|
} catch {
|
||
|
|
||
|
}
|
||
|
}
|
||
|
};
|