Fix the balance checking of transferring + prevent sending to self
Added the missing await operator and added a check to prevent players from trying to send themselves money
This commit is contained in:
parent
df07ce2940
commit
129b23eb2b
9
index.js
9
index.js
|
@ -290,16 +290,21 @@ client.on("interactionCreate", async interaction => {
|
||||||
content: "You must specify an amount.",
|
content: "You must specify an amount.",
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
// Sanity check to make sure they arent trying to send negative coins and break the economy
|
// Sanity check to make sure they aren't trying to send negative coins and break the economy
|
||||||
if (interaction.options.getNumber("amount") < 0) return interaction.reply({
|
if (interaction.options.getNumber("amount") < 0) return interaction.reply({
|
||||||
content: "You cannot send negative coins you lil goober.",
|
content: "You cannot send negative coins you lil goober.",
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
// Check if they're trying to be funny and send money to themselves.
|
||||||
|
if (interaction.user.id == interaction.options.getMember("user").user.id) return interaction.reply({
|
||||||
|
content: "You can't send coins to yourself silly.",
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
|
||||||
// Round the input up (these fuckers found a dupe one fucking day into the bot, fuck you krill issue)
|
// Round the input up (these fuckers found a dupe one fucking day into the bot, fuck you krill issue)
|
||||||
let amount = interaction.options.getNumber("amount");
|
let amount = interaction.options.getNumber("amount");
|
||||||
|
|
||||||
balance = checkPoints(interaction.user);
|
balance = await checkPoints(interaction.user);
|
||||||
if (balance < amount) return interaction.reply({
|
if (balance < amount) return interaction.reply({
|
||||||
content: "You do not have enough coins.",
|
content: "You do not have enough coins.",
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
|
|
Loading…
Reference in a new issue