[CodeFactor] Apply fixes

This commit is contained in:
codefactor-io 2022-02-28 10:31:34 +00:00 committed by Axel Olausson Holtenäs
parent a4aa42dd24
commit d7c3843b6a
No known key found for this signature in database
GPG key ID: E3AE7E194AE017ED
5 changed files with 21 additions and 13 deletions

View file

@ -25,7 +25,7 @@ module.exports = async (interaction) => {
footer: { iconURL: process.env.FOOTER_ICON, text: process.env.FOOTER_TEXT },
};
return await interaction.editReply({ embeds: [embed], ephemeral: true });
} else {
}
const toUser = await credits.findOne({ userId: user.id });
toUser.balance -= amount;
toUser.save();
@ -38,5 +38,5 @@ module.exports = async (interaction) => {
footer: { iconURL: process.env.FOOTER_ICON, text: process.env.FOOTER_TEXT },
};
return await interaction.editReply({ embeds: [embed], ephemeral: true });
}
};

View file

@ -74,15 +74,20 @@ module.exports = {
if (interaction.options.getSubcommand() === 'balance') {
require('./addons/balance.js')(interaction);
} else if (interaction.options.getSubcommand() === 'gift') {
}
else if (interaction.options.getSubcommand() === 'gift') {
require('./addons/gift.js')(interaction);
} else if (interaction.options.getSubcommand() === 'give') {
}
else if (interaction.options.getSubcommand() === 'give') {
require('./addons/give.js')(interaction);
} else if (interaction.options.getSubcommand() === 'redeem') {
}
else if (interaction.options.getSubcommand() === 'redeem') {
require('./addons/redeem.js')(interaction);
} else if (interaction.options.getSubcommand() === 'take') {
}
else if (interaction.options.getSubcommand() === 'take') {
require('./addons/take.js')(interaction);
} else if (interaction.options.getSubcommand() === 'top') {
}
else if (interaction.options.getSubcommand() === 'top') {
require('./addons/top.js')(interaction);
}
},

View file

@ -4,7 +4,8 @@ module.exports = async () => {
try {
await mongoose.connect(process.env.MONGODB_URL);
console.log('Connected to the database');
} catch (e) {
}
catch (e) {
console.log(e);
}
};

View file

@ -7,21 +7,22 @@ module.exports = async function saveUser(data, data2) {
_
? console.log(
`ERROR Occured while saving data (saveUser) \n${'='.repeat(50)}\n${
_ + '\n' + '='.repeat(50)
`${_ }\n${ '='.repeat(50)}`
}`
)
: 'No Error'
);
if (data2)
data2.save((_) =>
if (data2) {
data2.save((_) =>
_
? console.error(
`ERROR Occured while saving data (saveUser) \n${'='.repeat(50)}\n${
_ + '\n' + '='.repeat(50)
`${_ }\n${ '='.repeat(50)}`
}`
)
: 'No Error'
);
}
},
data,
data2

View file

@ -33,7 +33,8 @@ client.on('interactionCreate', async (interaction) => {
try {
await command.execute(interaction);
} catch (error) {
}
catch (error) {
console.error(error);
await interaction.reply({
content: 'There was an error while executing this command!',