fix: Add more logging to all commands

This commit is contained in:
Marius Begby committed 2023-07-19 00:44:32 +02:00
1 parent 389e60baad
commit 8ab4cbead2
13 files changed
+106 -7

No files matched your search

+13
View File
@@ -1,3 +1,4 @@
const logger = require('../../services/logger');
const { embedOptions } = require('../../config');
const { notInVoiceChannel } = require('../../utils/validation/voiceChannelValidation');
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidation');
@@ -45,6 +46,8 @@ module.exports = {
}
if (durationArray.length === 0 || durationArray.length > 3) {
logger.debug(`User used command ${interaction.commandName} but entered an invalid duration.`);
return await interaction.editReply({
embeds: [
new EmbedBuilder()
@@ -70,6 +73,9 @@ module.exports = {
});
if (!validElements) {
logger.debug(
`User used command ${interaction.commandName} but entered an invalid duration after parsing duration.`
);
return await interaction.editReply({
embeds: [
new EmbedBuilder()
@@ -90,6 +96,10 @@ module.exports = {
const isValidDuration = regex.test(durationString);
if (!isValidDuration) {
logger.debug(
`User used command ${interaction.commandName} but entered an invalid duration after regex checks.`
);
return await interaction.editReply({
embeds: [
new EmbedBuilder()
@@ -108,6 +118,7 @@ module.exports = {
const durationInMilliseconds = durationArray[0] * 3600000 + durationArray[1] * 60000 + durationArray[2] * 1000;
if (durationInMilliseconds > currentTrackMaxDurationInMs - 1000) {
logger.debug(`User used command ${interaction.commandName} but entered a duration longer than the track.`);
return await interaction.editReply({
embeds: [
new EmbedBuilder()
@@ -120,6 +131,8 @@ module.exports = {
}
queue.node.seek(durationInMilliseconds);
logger.debug(`User used command ${interaction.commandName} and seeked to duration.`);
return await interaction.editReply({
embeds: [
new EmbedBuilder()