This commit is contained in:
Axel Olausson Holtenäs 2022-03-06 14:24:43 +01:00
parent 109f3114c9
commit 483b7ee3a9
No known key found for this signature in database
GPG key ID: E3AE7E194AE017ED

View file

@ -45,6 +45,17 @@ module.exports = async (interaction) => {
const fromUser = await credits.findOne({ userId: from.id, guildId: interaction.member.guild.id });
const toUser = await credits.findOne({ userId: to.id, guildId: interaction.member.guild.id });
if (!toUser) {
const embed = {
title: 'Set',
description: 'That user has no credits, I can not set credits to the user',
color: config.colors.error,
timestamp: new Date(),
footer: { iconURL: config.footer.icon, text: config.footer.text },
};
return interaction.editReply({ embeds: [embed], ephemeral: true });
}
fromUser.balance -= amount;
toUser.balance += amount;