fix: updated logging for commands

This commit is contained in:
Marius Begby committed 2023-08-26 17:00:08 +02:00
1 parent 5c8f3353f9
commit a04d0aeb5b
24 files changed
+510 -292

No files matched your search

+14 -7
View File
@@ -1,4 +1,3 @@
const logger = require('../../services/logger');
const config = require('config');
const embedOptions = config.get('embedOptions');
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
@@ -14,6 +13,15 @@ module.exports = {
.setDMPermission(false)
.setNSFW(false),
execute: async ({ interaction, executionId }) => {
const logger = require('../../services/logger').child({
source: 'leave.js',
module: 'slashCommand',
name: '/leave',
executionId: executionId,
shardId: interaction.guild.shardId,
guildId: interaction.guild.id
});
if (await notInVoiceChannel({ interaction, executionId })) {
return;
}
@@ -21,9 +29,9 @@ module.exports = {
const queue = useQueue(interaction.guild.id);
if (!queue) {
logger.debug(
`User used command ${interaction.commandName} but there was no queue.`
);
logger.debug('There is already no queue.');
logger.debug('Responding with warning embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
@@ -41,11 +49,10 @@ module.exports = {
if (!queue.deleted) {
queue.delete();
logger.debug(
`User used command ${interaction.commandName} and deleted the queue.`
);
logger.debug('Deleted the queue.');
}
logger.debug('Responding with success embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()