🚑 forgot to save users and do it in a try catch
This commit is contained in:
parent
73f9f91a8b
commit
8b8343a26f
1 changed files with 45 additions and 39 deletions
|
@ -3,6 +3,7 @@ const debug = require('../../../handlers/debug');
|
|||
const saveUser = require('../../../helpers/saveUser');
|
||||
|
||||
module.exports = async (interaction) => {
|
||||
try {
|
||||
const user = await interaction.options.getUser('user');
|
||||
const amount = await interaction.options.getInteger('amount');
|
||||
const data = await credits.findOne({ userId: interaction.user.id });
|
||||
|
@ -42,6 +43,8 @@ module.exports = async (interaction) => {
|
|||
fromUser.balance -= amount;
|
||||
toUser.balance += amount;
|
||||
|
||||
saveUser(fromUser, toUser);
|
||||
|
||||
const embed = {
|
||||
title: 'Gift',
|
||||
description: `You sent ${
|
||||
|
@ -55,4 +58,7 @@ module.exports = async (interaction) => {
|
|||
return await interaction.editReply({ embeds: [embed], ephemeral: true });
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
async (err) => debug(err);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue