mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 22:15:37 +00:00
fix: annotated util validation functions
This commit is contained in:
1 parent
d38ed18842
commit
1ae9503477
5 files changed
+64
-50
No files matched your search
@@ -2,19 +2,20 @@ import { EmbedOptions } from '../../types/configTypes';
|
||||
import loggerModule from '../../services/logger';
|
||||
import config from 'config';
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
import { EmbedBuilder, GuildMember } from 'discord.js';
|
||||
import { NotInVoiceChannelParams, NotInSameVoiceChannelParams } from '../../types/utilTypes';
|
||||
|
||||
export const notInVoiceChannel = async ({ interaction, executionId }) => {
|
||||
export const notInVoiceChannel = async ({ interaction, executionId }: NotInVoiceChannelParams) => {
|
||||
const logger = loggerModule.child({
|
||||
source: 'voiceChannelValidator.js',
|
||||
module: 'validator',
|
||||
name: 'notInVoiceChannel',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild.shardId,
|
||||
guildId: interaction.guild.id
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
|
||||
if (!interaction.member.voice.channel) {
|
||||
if (interaction.member instanceof GuildMember && !interaction.member.voice.channel) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
@@ -32,14 +33,14 @@ export const notInVoiceChannel = async ({ interaction, executionId }) => {
|
||||
return false;
|
||||
};
|
||||
|
||||
export const notInSameVoiceChannel = async ({ interaction, queue, executionId }) => {
|
||||
export const notInSameVoiceChannel = async ({ interaction, queue, executionId }: NotInSameVoiceChannelParams) => {
|
||||
const logger = loggerModule.child({
|
||||
source: 'voiceChannelValidator.js',
|
||||
module: 'utilValidation',
|
||||
name: 'notInSameVoiceChannel',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild.shardId,
|
||||
guildId: interaction.guild.id
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
|
||||
if (!queue || !queue.dispatcher) {
|
||||
@@ -47,7 +48,10 @@ export const notInSameVoiceChannel = async ({ interaction, queue, executionId })
|
||||
return false;
|
||||
}
|
||||
|
||||
if (interaction.member.voice.channel.id !== queue.dispatcher.channel.id) {
|
||||
if (
|
||||
interaction.member instanceof GuildMember &&
|
||||
interaction.member.voice.channel?.id !== queue.dispatcher.channel.id
|
||||
) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
|
||||
Reference in new issue
Block a user