2021-06-12 12:53:51 +02:00
|
|
|
const { Client, Message, MessageEmbed } = require("discord.js");
|
|
|
|
module.exports = {
|
|
|
|
name: "drop",
|
|
|
|
usage: "{Channel} (Number)",
|
|
|
|
description: "Drops money to a channel",
|
|
|
|
category: "Economy",
|
|
|
|
run: async (client, message, args) => {
|
|
|
|
const p = await client.prefix(message);
|
|
|
|
const channel = message.mentions.channels.first() || message.channel;
|
|
|
|
const coinsAmount = args[0];
|
|
|
|
if (!coinsAmount) {
|
|
|
|
return client.err(message, "Economy", "drop", 5);
|
|
|
|
}
|
2021-07-13 05:17:39 +02:00
|
|
|
if ((await client.bal(message.author.id)) < coinsAmount) {
|
2021-06-12 12:53:51 +02:00
|
|
|
return client.err(message, "Economy", "drop", 20);
|
|
|
|
}
|
|
|
|
const filter = msg =>
|
|
|
|
msg.guild.id === message.guild.id && msg.content === `${p}claim`;
|
|
|
|
message.channel.send("The drop has started in " + channel.toString());
|
|
|
|
channel.send(
|
|
|
|
`${message.author.username} has dropped a ${client.currency} bomb! Use ${p}claim to claim ${client.currency}!!`
|
|
|
|
);
|
2021-07-13 05:17:39 +02:00
|
|
|
client.rmv(message.author.id, parseInt(coinsAmount));
|
2021-06-12 12:53:51 +02:00
|
|
|
channel.awaitMessages(filter, { max: 1, time: 60000 }).then(async msg => {
|
|
|
|
const id = msg.first().author.id;
|
|
|
|
const coinsToClaim = parseInt(coinsAmount);
|
2021-07-13 05:17:39 +02:00
|
|
|
await client.add(id, coinsToClaim, message);
|
2021-06-12 12:53:51 +02:00
|
|
|
msg
|
|
|
|
.first()
|
2021-09-06 12:38:25 +02:00
|
|
|
.reply(
|
2021-06-12 12:53:51 +02:00
|
|
|
`Congratultions! You have claimed **${coinsToClaim}** ${client.currency}!`
|
|
|
|
);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
};
|