feat: Renamed validator files and added permission validator

This commit is contained in:
Marius Begby committed 2023-07-23 11:19:21 +02:00
1 parent f04937eee0
commit b68b7dac95
18 files changed
+51 -22

No files matched your search

@@ -0,0 +1,24 @@
const logger = require('../../services/logger');
const { embedOptions } = require('../../config');
const { EmbedBuilder } = require('discord.js');
exports.cannotJoinVoiceOrTalk = async (interaction) => {
const channel = interaction.member.voice.channel;
if (!channel.joinable || !channel.speakable) {
await interaction.editReply({
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedOptions.icons.warning} Oops!**\nI do not have permission to play audio in the voice channel you are in.\n\nPlease make sure I have the **Connect** and **Speak** permissions in this voice channel.`
)
.setColor(embedOptions.colors.warning)
]
});
logger.debug(`User tried to use command ${interaction.commandName} but was not in a voice channel.`);
return true;
}
return false;
};