mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 22:15:37 +00:00
feat: rename .js files to .ts
This commit is contained in:
1 parent
40bf9d926b
commit
92b1992b1a
54 files changed
No files matched your search
@@ -0,0 +1,64 @@
|
||||
const config = require('config');
|
||||
const embedOptions = config.get('embedOptions');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
|
||||
exports.notInVoiceChannel = async ({ interaction, executionId }) => {
|
||||
const logger = require('../../services/logger').child({
|
||||
source: 'voiceChannelValidator.js',
|
||||
module: 'validator',
|
||||
name: 'notInVoiceChannel',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild.shardId,
|
||||
guildId: interaction.guild.id
|
||||
});
|
||||
|
||||
if (!interaction.member.voice.channel) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`**${embedOptions.icons.warning} Not in a voice channel**\nYou need to be in a voice channel to use this command.`
|
||||
)
|
||||
.setColor(embedOptions.colors.warning)
|
||||
]
|
||||
});
|
||||
|
||||
logger.debug(`User tried to use command '${interaction.commandName}' but was not in a voice channel.`);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
exports.notInSameVoiceChannel = async ({ interaction, queue, executionId }) => {
|
||||
const logger = require('../../services/logger').child({
|
||||
source: 'voiceChannelValidator.js',
|
||||
module: 'utilValidation',
|
||||
name: 'notInSameVoiceChannel',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild.shardId,
|
||||
guildId: interaction.guild.id
|
||||
});
|
||||
|
||||
if (!queue || !queue.dispatcher) {
|
||||
// If there is no queue or bot is not in voice channel, then there is no need to check if user is in same voice channel.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (interaction.member.voice.channel.id !== queue.dispatcher.channel.id) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`**${embedOptions.icons.warning} Not in same voice channel**\nYou need to be in the same voice channel as me to use this command.\n\n**Voice channel:** ${queue.dispatcher.channel.name}`
|
||||
)
|
||||
.setColor(embedOptions.colors.warning)
|
||||
]
|
||||
});
|
||||
|
||||
logger.debug(`User tried to use command '${interaction.commandName}' but was not in the same voice channel.`);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
Reference in new issue
Block a user