fix: Extract logic for getting author value for embeds

This commit is contained in:
Marius Begby committed 2023-09-05 21:52:03 +02:00
1 parent 8c05499f08
commit 83e23d87b4
60 files changed
+126 -317

No files matched your search

+12 -1
View File
@@ -1,4 +1,5 @@
import config from 'config';
import { GuildQueue } from 'discord-player';
import {
ApplicationCommandOptionChoiceData,
AutocompleteInteraction,
@@ -64,7 +65,7 @@ abstract class BaseInteractionWithEmbedResponse extends BaseInteraction {
this.botOptions = config.get('botOptions');
}
protected async getEmbedAuthor(
protected async getEmbedUserAuthor(
interaction: MessageComponentInteraction | ChatInputCommandInteraction
): Promise<EmbedAuthorOptions> {
let authorName: string = '';
@@ -79,6 +80,16 @@ abstract class BaseInteractionWithEmbedResponse extends BaseInteraction {
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
};
}
protected async getEmbedQueueAuthor(
interaction: MessageComponentInteraction | ChatInputCommandInteraction,
queue: GuildQueue
): Promise<EmbedAuthorOptions> {
return {
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
iconURL: interaction.guild!.iconURL() || this.embedOptions.info.fallbackIconUrl
};
}
}
export abstract class BaseSlashCommandInteraction extends BaseInteractionWithEmbedResponse {
+1 -2
View File
@@ -1,8 +1,7 @@
import { Events } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import loggerModule from '../../services/logger';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
module.exports = {
name: Events.Debug,
+1 -2
View File
@@ -1,11 +1,10 @@
import config from 'config';
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
import { ExtendedClient } from '../../types/clientTypes';
import { EmbedOptions, SystemOptions } from '../../types/configTypes';
import { Logger } from 'pino';
const embedOptions: EmbedOptions = config.get('embedOptions');
const systemOptions: SystemOptions = config.get('systemOptions');
+1 -2
View File
@@ -1,8 +1,7 @@
import { Events } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import loggerModule from '../../services/logger';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
module.exports = {
name: Events.Error,
+1 -2
View File
@@ -1,8 +1,7 @@
import { Events, Guild } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import loggerModule from '../../services/logger';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
module.exports = {
name: Events.GuildCreate,
+1 -2
View File
@@ -1,8 +1,7 @@
import { Events, Guild } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import loggerModule from '../../services/logger';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
module.exports = {
name: Events.GuildDelete,
-1
View File
@@ -1,7 +1,6 @@
import config from 'config';
import { BaseGuildTextChannel, EmbedBuilder, Events, PresenceData } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
import { ExtendedClient } from '../../types/clientTypes';
-1
View File
@@ -1,7 +1,6 @@
import config from 'config';
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
import { ExtendedClient } from '../../types/clientTypes';
+1 -1
View File
@@ -1,6 +1,6 @@
import { Events } from 'discord.js';
import { Logger } from 'pino';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
module.exports = {
+2 -2
View File
@@ -6,15 +6,15 @@ import {
InteractionType,
MessageComponentInteraction
} from 'discord.js';
import { Logger } from 'pino';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import { CustomError } from '../../classes/interactions';
import { handleAutocomplete } from '../../handlers/interactionAutocompleteHandler';
import { handleCommand } from '../../handlers/interactionCommandHandler';
import { handleComponent } from '../../handlers/interactionComponentHandler';
import { handleError } from '../../handlers/interactionErrorHandler';
import loggerModule from '../../services/logger';
import { ExtendedClient } from '../../types/clientTypes';
import { CustomError } from '../../classes/interactions';
module.exports = {
name: Events.InteractionCreate,
+1 -1
View File
@@ -1,5 +1,5 @@
import { Logger } from 'pino';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
module.exports = {
+1 -1
View File
@@ -1,7 +1,7 @@
import config from 'config';
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { Logger } from 'pino';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
import { BotOptions, EmbedOptions, SystemOptions } from '../../types/configTypes';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
+1 -1
View File
@@ -1,5 +1,5 @@
import { Logger } from 'pino';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
module.exports = {
+1 -1
View File
@@ -1,7 +1,7 @@
import config from 'config';
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { Logger } from 'pino';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
import { BotOptions, EmbedOptions, SystemOptions } from '../../types/configTypes';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
+1 -1
View File
@@ -1,8 +1,8 @@
import config from 'config';
import { Track } from 'discord-player';
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { Logger } from 'pino';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
import { BotOptions, EmbedOptions, SystemOptions } from '../../types/configTypes';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
+1 -1
View File
@@ -1,6 +1,6 @@
import { Track } from 'discord-player';
import { Logger } from 'pino';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
+1 -1
View File
@@ -1,5 +1,5 @@
import { Logger } from 'pino';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
module.exports = {
+1 -1
View File
@@ -1,5 +1,5 @@
import { Logger } from 'pino';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
module.exports = {
@@ -1,8 +1,8 @@
import { AutocompleteInteraction } from 'discord.js';
import { Logger } from 'pino';
import { BaseAutocompleteInteraction } from '../classes/interactions';
import loggerModule from '../services/logger';
import { ExtendedClient } from '../types/clientTypes';
import { BaseAutocompleteInteraction } from '../classes/interactions';
export const handleAutocomplete = async (
interaction: AutocompleteInteraction,
+1 -1
View File
@@ -1,8 +1,8 @@
import { ChatInputCommandInteraction } from 'discord.js';
import { Logger } from 'pino';
import { BaseSlashCommandInteraction } from '../classes/interactions';
import loggerModule from '../services/logger';
import { ExtendedClient } from '../types/clientTypes';
import { BaseSlashCommandInteraction } from '../classes/interactions';
import { checkChannelPermissionViewable } from '../utils/validation/permissionValidator';
export const handleCommand = async (
+1 -1
View File
@@ -1,8 +1,8 @@
import { MessageComponentInteraction } from 'discord.js';
import { Logger } from 'pino';
import { BaseComponentInteraction } from '../classes/interactions';
import loggerModule from '../services/logger';
import { ExtendedClient } from '../types/clientTypes';
import { BaseComponentInteraction } from '../classes/interactions';
import { checkChannelPermissionViewable } from '../utils/validation/permissionValidator';
export const handleComponent = async (
+1 -1
View File
@@ -8,9 +8,9 @@ import {
MessageComponentInteraction
} from 'discord.js';
import { Logger } from 'pino';
import { CustomError, InteractionValidationError } from '../classes/interactions';
import loggerModule from '../services/logger';
import { BotOptions, EmbedOptions } from '../types/configTypes';
import { CustomError, InteractionValidationError } from '../classes/interactions';
const embedOptions: EmbedOptions = config.get('embedOptions');
const botOptions: BotOptions = config.get('botOptions');
+1 -3
View File
@@ -1,9 +1,7 @@
import 'dotenv/config';
import config from 'config';
import { Client, Shard, ShardEvents, ShardingManager, ShardingManagerOptions } from 'discord.js';
import 'dotenv/config';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from './services/logger';
+1 -1
View File
@@ -1,8 +1,8 @@
import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
import { Player, SearchResult, useMainPlayer } from 'discord-player';
import { ApplicationCommandOptionChoiceData } from 'discord.js';
import { BaseAutocompleteParams, BaseAutocompleteReturnType } from '../../types/interactionTypes';
import { BaseAutocompleteInteraction } from '../../classes/interactions';
import { BaseAutocompleteParams, BaseAutocompleteReturnType } from '../../types/interactionTypes';
// TODO: create type for recent query object
const recentQueries = new Map();
+1 -1
View File
@@ -1,7 +1,7 @@
import { Player, SearchResult, useMainPlayer } from 'discord-player';
import { ApplicationCommandOptionChoiceData } from 'discord.js';
import { BaseAutocompleteParams, BaseAutocompleteReturnType } from '../../types/interactionTypes';
import { BaseAutocompleteInteraction } from '../../classes/interactions';
import { BaseAutocompleteParams, BaseAutocompleteReturnType } from '../../types/interactionTypes';
// TODO: create type for recent query object
const recentQueries = new Map();
+1 -1
View File
@@ -1,6 +1,6 @@
import { EmbedBuilder, SlashCommandBuilder, SlashCommandNumberOption, SlashCommandStringOption } from 'discord.js';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
class HelpCommand extends BaseSlashCommandInteraction {
constructor() {
+1 -1
View File
@@ -2,8 +2,8 @@ import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
import osu from 'node-os-utils';
// @ts-ignore
import { version } from '../../../../package.json';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
class StatusCommand extends BaseSlashCommandInteraction {
+2 -2
View File
@@ -18,8 +18,8 @@ import { Logger } from 'pino';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { FFmpegFilterOption, FFmpegFilterOptions } from '../../../types/configTypes';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { checkQueueExists, checkQueueCurrentTrack } from '../../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
+2 -2
View File
@@ -3,7 +3,7 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { checkQueueExists } from '../../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
class LeaveCommand extends BaseSlashCommandInteraction {
constructor() {
@@ -36,7 +36,7 @@ class LeaveCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor(await this.getEmbedAuthor(interaction))
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.success} Leaving channel**\nCleared the track queue and left voice channel.\n\nTo play more music, use the **\`/play\`** command!`
)
+6 -23
View File
@@ -1,9 +1,9 @@
import { GuildQueue, QueueRepeatMode, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder, SlashCommandStringOption } from 'discord.js';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { EmbedBuilder, SlashCommandBuilder, SlashCommandStringOption } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { checkQueueExists } from '../../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
class LoopCommand extends BaseSlashCommandInteraction {
constructor() {
@@ -106,14 +106,6 @@ class LoopCommand extends BaseSlashCommandInteraction {
});
}
let authorName: string;
if (interaction.member instanceof GuildMember) {
authorName = interaction.member.nickname || interaction.user.username;
} else {
authorName = interaction.user.username;
}
if (queue.repeatMode === 0) {
logger.debug('Disabled loop mode.');
@@ -122,10 +114,7 @@ class LoopCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.success} Loop mode disabled**\nChanging loop mode from **\`${currentModeUserString}\`** to **\`${modeUserString}\`**.\n\nThe ${currentModeUserString} will no longer play on repeat!`
)
@@ -141,10 +130,7 @@ class LoopCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.autoplaying} Loop mode changed**\nChanging loop mode from **\`${currentModeUserString}\`** to **\`${modeUserString}\`**.\n\nWhen the queue is empty, similar tracks will start playing!`
)
@@ -159,10 +145,7 @@ class LoopCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.looping} Loop mode changed**\nChanging loop mode from **\`${currentModeUserString}\`** to **\`${modeUserString}\`**.\n\nThe ${modeUserString} will now play on repeat!`
)
+3 -3
View File
@@ -1,10 +1,10 @@
import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
import { GuildQueue, Player, QueryType, useMainPlayer, useQueue } from 'discord-player';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { checkQueueExists, checkQueueCurrentTrack } from '../../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
class LyricsCommand extends BaseSlashCommandInteraction {
constructor() {
@@ -10,11 +10,11 @@ import {
EmbedBuilder,
SlashCommandBuilder
} from 'discord.js';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { PlayerOptions } from '../../../types/configTypes';
import { BaseSlashCommandParams, BaseSlashCommandReturnType, TrackMetadata } from '../../../types/interactionTypes';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { checkQueueExists, checkQueueCurrentTrack } from '../../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
const playerOptions: PlayerOptions = config.get('playerOptions');
@@ -132,10 +132,7 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
iconURL: interaction.guild!.iconURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedQueueAuthor(interaction, queue))
.setDescription(
(queue.node.isPaused()
? '**Currently Paused**\n'
+5 -17
View File
@@ -1,10 +1,9 @@
import { GuildQueue, Track, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { checkQueueExists, checkQueueCurrentTrack } from '../../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
class PauseCommand extends BaseSlashCommandInteraction {
constructor() {
@@ -42,22 +41,11 @@ class PauseCommand extends BaseSlashCommandInteraction {
queue.node.setPaused(!queue.node.isPaused());
logger.debug(`Set paused state to ${queue.node.isPaused()}.`);
let authorName: string;
if (interaction.member instanceof GuildMember) {
authorName = interaction.member.nickname || interaction.user.username;
} else {
authorName = interaction.user.username;
}
logger.debug('Responding with success embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.pauseResumed} ${
queue.node.isPaused() ? 'Paused Track' : 'Resumed track'
+3 -36
View File
@@ -238,22 +238,11 @@ class PlayCommand extends BaseSlashCommandInteraction {
if (searchResult.playlist && searchResult.tracks.length > 1) {
logger.debug(`Playlist found and added with player.play(). Query: '${query}'`);
let authorName: string;
if (interaction.member instanceof GuildMember) {
authorName = interaction.member.nickname || interaction.user.username;
} else {
authorName = interaction.user.username;
}
logger.debug('Responding with success embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.success} Added playlist to queue**\n**${durationFormat} [${
track.title
@@ -270,22 +259,11 @@ class PlayCommand extends BaseSlashCommandInteraction {
if (queue && queue.currentTrack === track && queue.tracks.data.length === 0) {
logger.debug(`Track found and added with player.play(), started playing. Query: '${query}'.`);
let authorName: string;
if (interaction.member instanceof GuildMember) {
authorName = interaction.member.nickname || interaction.user.username;
} else {
authorName = interaction.user.username;
}
logger.debug('Responding with success embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.audioStartedPlaying} Started playing**\n**${durationFormat} [${
track.title
@@ -299,22 +277,11 @@ class PlayCommand extends BaseSlashCommandInteraction {
logger.debug(`Track found and added with player.play(), added to queue. Query: '${query}'.`);
let authorName: string;
if (interaction.member instanceof GuildMember) {
authorName = interaction.member.nickname || interaction.user.username;
} else {
authorName = interaction.user.username;
}
logger.debug('Responding with success embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`${this.embedOptions.icons.success} **Added to queue**\n**${durationFormat} [${track.title}](${
track.raw.url ?? track.url
+4 -10
View File
@@ -1,11 +1,11 @@
import config from 'config';
import { GuildQueue, PlayerTimestamp, Track, useQueue } from 'discord-player';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { PlayerOptions } from '../../../types/configTypes';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { checkQueueExists } from '../../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
const playerOptions: PlayerOptions = config.get('playerOptions');
@@ -103,10 +103,7 @@ class QueueCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
iconURL: interaction.guild!.iconURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedQueueAuthor(interaction, queue))
.setDescription(
`${repeatModeString}` +
`**${this.embedOptions.icons.queue} Tracks in queue**\n${queueString}`
@@ -141,10 +138,7 @@ class QueueCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
iconURL: interaction.guild!.iconURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedQueueAuthor(interaction, queue))
.setDescription(
`**${this.embedOptions.icons.audioPlaying} Now playing**\n` +
(currentTrack
+4 -15
View File
@@ -1,9 +1,9 @@
import { GuildQueue, Track, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { checkQueueExists } from '../../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
class RemoveCommand extends BaseSlashCommandInteraction {
constructor() {
@@ -63,22 +63,11 @@ class RemoveCommand extends BaseSlashCommandInteraction {
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
}
let authorName: string;
if (interaction.member instanceof GuildMember) {
authorName = interaction.member.nickname || interaction.user.username;
} else {
authorName = interaction.user.username;
}
logger.debug('Responding with success embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.success} Removed track**\n**${durationFormat} [${
removedTrack.title
+5 -16
View File
@@ -1,9 +1,9 @@
import { GuildQueue, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { checkQueueExists, checkQueueCurrentTrack } from '../../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
class SeekCommand extends BaseSlashCommandInteraction {
constructor() {
@@ -141,22 +141,11 @@ class SeekCommand extends BaseSlashCommandInteraction {
queue.node.seek(durationInMilliseconds);
logger.debug(`Seeked to '${durationString}' in current track.`);
let authorName: string;
if (interaction.member instanceof GuildMember) {
authorName = interaction.member.nickname || interaction.user.username;
} else {
authorName = interaction.user.username;
}
logger.debug('Responding with success embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.success} Seeking to duration**\nSeeking to **\`${durationString}\`** in current track.`
)
+5 -16
View File
@@ -1,9 +1,9 @@
import { GuildQueue, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { checkQueueExists, checkQueueEmpty } from '../../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { checkQueueEmpty, checkQueueExists } from '../../../utils/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
class ShuffleCommand extends BaseSlashCommandInteraction {
constructor() {
@@ -31,22 +31,11 @@ class ShuffleCommand extends BaseSlashCommandInteraction {
queue.tracks.shuffle();
logger.debug('Shuffled queue tracks.');
let authorName: string;
if (interaction.member instanceof GuildMember) {
authorName = interaction.member.nickname || interaction.user.username;
} else {
authorName = interaction.user.username;
}
logger.debug('Responding with success embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.shuffled} Shuffled queue tracks**\nThe **${queue.tracks.data.length}** tracks in the queue has been shuffled.\n\nView the new queue order with **\`/queue\`**.`
)
+6 -28
View File
@@ -1,9 +1,9 @@
import { GuildQueue, Track, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { checkQueueExists, checkQueueCurrentTrack } from '../../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
class SkipCommand extends BaseSlashCommandInteraction {
constructor() {
@@ -63,22 +63,11 @@ class SkipCommand extends BaseSlashCommandInteraction {
queue.node.skipTo(skipToTrack - 1);
logger.debug('Skipped to specified track number.');
let authorName: string;
if (interaction.member instanceof GuildMember) {
authorName = interaction.member.nickname || interaction.user.username;
} else {
authorName = interaction.user.username;
}
logger.debug('Responding with success embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
skippedTrack.title
@@ -134,22 +123,11 @@ class SkipCommand extends BaseSlashCommandInteraction {
const repeatModeString: string = queue.repeatMode === 0 ? '' : getRepeatModeMessage(queue.repeatMode);
let authorName: string;
if (interaction.member instanceof GuildMember) {
authorName = interaction.member.nickname || interaction.user.username;
} else {
authorName = interaction.user.username;
}
logger.debug('Responding with success embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
skippedTrack.title
+4 -15
View File
@@ -1,9 +1,9 @@
import { GuildQueue, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { checkQueueExists } from '../../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
class StopCommand extends BaseSlashCommandInteraction {
constructor() {
@@ -34,22 +34,11 @@ class StopCommand extends BaseSlashCommandInteraction {
logger.debug('Cleared and stopped the queue.');
}
let authorName: string;
if (interaction.member instanceof GuildMember) {
authorName = interaction.member.nickname || interaction.user.username;
} else {
authorName = interaction.user.username;
}
logger.debug('Responding with success embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.success} Stopped playing**\nStopped playing audio and cleared the track queue.\n\nTo play more music, use the **\`/play\`** command!`
)
+5 -19
View File
@@ -1,9 +1,9 @@
import { GuildQueue, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { checkQueueExists } from '../../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
class VolumeCommand extends BaseSlashCommandInteraction {
constructor() {
@@ -72,23 +72,12 @@ class VolumeCommand extends BaseSlashCommandInteraction {
queue.node.setVolume(volume);
logger.debug(`Set volume to ${volume}%.`);
let authorName: string;
if (interaction.member instanceof GuildMember) {
authorName = interaction.member.nickname || interaction.user.username;
} else {
authorName = interaction.user.username;
}
if (volume === 0) {
logger.debug('Responding with success embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.volumeMuted} Audio muted**\nPlayback audio has been muted, because volume was set to **\`${volume}%\`**.`
)
@@ -101,10 +90,7 @@ class VolumeCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.volumeChanged} Volume changed**\nPlayback volume has been changed to **\`${volume}%\`**.`
)
+1 -1
View File
@@ -1,6 +1,6 @@
import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator';
class GuildsCommand extends BaseSlashCommandInteraction {
+1 -1
View File
@@ -1,7 +1,7 @@
import { ApplicationCommandOption, ApplicationCommandOptionData, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { ExtendedClient } from '../../../types/clientTypes';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator';
class ReloadCommand extends BaseSlashCommandInteraction {
+1 -1
View File
@@ -1,7 +1,7 @@
import { EmbedBuilder, EmbedField, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { ExtendedClient } from '../../../types/clientTypes';
import { BaseSlashCommandParams, BaseSlashCommandReturnType, ShardInfo } from '../../../types/interactionTypes';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator';
class ShardsCommand extends BaseSlashCommandInteraction {
@@ -2,8 +2,8 @@ import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
import osu from 'node-os-utils';
// @ts-ignore
import { dependencies, version } from '../../../../package.json';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator';
@@ -1,9 +1,9 @@
import { GuildQueue, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember } from 'discord.js';
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
import { EmbedBuilder } from 'discord.js';
import { BaseComponentInteraction } from '../../classes/interactions';
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
import { checkQueueExists } from '../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
class FiltersDisableButtonComponent extends BaseComponentInteraction {
constructor() {
@@ -30,22 +30,11 @@ class FiltersDisableButtonComponent extends BaseComponentInteraction {
logger.debug('Reset queue filters.');
}
let authorName: string;
if (interaction.member instanceof GuildMember) {
authorName = interaction.member.nickname || interaction.user.username;
} else {
authorName = interaction.user.username;
}
logger.debug('Responding with success embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.success} Disabled filters**\nAll audio filters have been disabled.`
)
@@ -1,11 +1,12 @@
import config from 'config';
import { GuildQueue, QueueFilters, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, StringSelectMenuInteraction } from 'discord.js';
import { EmbedBuilder, StringSelectMenuInteraction } from 'discord.js';
import { BaseComponentInteraction } from '../../classes/interactions';
import { FFmpegFilterOption, FFmpegFilterOptions } from '../../types/configTypes';
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
import { BaseComponentInteraction } from '../../classes/interactions';
import { checkQueueExists } from '../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
class FiltersSelectMenuComponent extends BaseComponentInteraction {
@@ -61,22 +62,11 @@ class FiltersSelectMenuComponent extends BaseComponentInteraction {
queue.filters.ffmpeg.toggle(selectMenuInteraction.values as (keyof QueueFilters)[]);
logger.debug(`Enabled filters ${selectMenuInteraction.values.join(', ')}.`);
let authorName: string;
if (selectMenuInteraction.member instanceof GuildMember) {
authorName = selectMenuInteraction.member.nickname || selectMenuInteraction.user.username;
} else {
authorName = selectMenuInteraction.user.username;
}
logger.debug('Responding with success embed.');
return await selectMenuInteraction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: selectMenuInteraction.user.avatarURL() || ''
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${
this.embedOptions.icons.success
@@ -1,9 +1,9 @@
import { GuildQueue, Track, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember } from 'discord.js';
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
import { EmbedBuilder } from 'discord.js';
import { BaseComponentInteraction } from '../../classes/interactions';
import { checkQueueExists, checkQueueCurrentTrack } from '../../utils/validation/queueValidator';
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
class NowplayingSkipButton extends BaseComponentInteraction {
constructor() {
@@ -85,22 +85,11 @@ class NowplayingSkipButton extends BaseComponentInteraction {
const repeatModeString: string = queue.repeatMode === 0 ? '' : getRepeatModeMessage(queue.repeatMode);
let authorName: string;
if (interaction.member instanceof GuildMember) {
authorName = interaction.member.nickname || interaction.user.username;
} else {
authorName = interaction.user.username;
}
logger.debug('Responding with success embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
})
.setAuthor(await this.getEmbedUserAuthor(interaction))
.setDescription(
`**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
skippedTrack.title
-1
View File
@@ -1,6 +1,5 @@
import config from 'config';
import pino, { DestinationStream, Logger, LoggerOptions } from 'pino';
import { CustomLoggerOptions } from '../types/configTypes';
import { TargetOptions } from '../types/serviceTypes';
-1
View File
@@ -1,6 +1,5 @@
import { GuildQueuePlayerNode } from 'discord-player';
import { BaseGuildTextChannel } from 'discord.js';
import { ExtendedClient } from './clientTypes';
export type ClientEventArguments = unknown[];
-1
View File
@@ -1,6 +1,5 @@
import { GuildQueue, Player } from 'discord-player';
import { ChatInputCommandInteraction, MessageComponentInteraction } from 'discord.js';
import { ExtendedClient } from './clientTypes';
export type RegisterEventListenersParams = {
+3 -6
View File
@@ -1,19 +1,16 @@
import 'dotenv/config';
import config from 'config';
import { REST, RESTPostAPIChatInputApplicationCommandsJSONBody, RouteLike, Routes } from 'discord.js';
import 'dotenv/config';
import { randomUUID as uuidv4 } from 'node:crypto';
import fs from 'node:fs';
import path from 'node:path';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../services/logger';
import { SystemOptions } from '../types/configTypes';
import { Logger } from 'pino';
const systemOptions: SystemOptions = config.get('systemOptions');
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
module: 'deploy',
name: 'deploySlashCommands',
+1 -2
View File
@@ -1,7 +1,6 @@
import Discord, { Client } from 'discord.js';
import loggerModule from '../../services/logger';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
export const createClient = async ({ executionId }: { executionId: string }) => {
const logger: Logger = loggerModule.child({
-1
View File
@@ -1,6 +1,5 @@
import config from 'config';
import { Channel, Client } from 'discord.js';
import { Logger } from 'pino';
import loggerModule from '../../services/logger';
import { LoadTestOptions } from '../../types/configTypes';
+2 -3
View File
@@ -1,11 +1,10 @@
import { Collection } from 'discord.js';
import fs from 'node:fs';
import path from 'node:path';
import loggerModule from '../services/logger';
import { RegisterClientInteractionsParams } from '../types/utilTypes';
import { Logger } from 'pino';
import loggerModule from '../services/logger';
import { ExtendedClient } from '../types/clientTypes';
import { RegisterClientInteractionsParams } from '../types/utilTypes';
export const registerClientInteractions = async ({ client, executionId }: RegisterClientInteractionsParams) => {
const logger: Logger = loggerModule.child({
+3 -4
View File
@@ -1,14 +1,13 @@
import config from 'config';
import fs from 'node:fs';
import path from 'node:path';
import { GuildQueueEvents, Player, PlayerEvents } from 'discord-player';
import { Client } from 'discord.js';
import fs from 'node:fs';
import path from 'node:path';
import { Logger } from 'pino';
import loggerModule from '../services/logger';
import { CustomLoggerOptions } from '../types/configTypes';
import { ClientEventArguments, PlayerEventArguments, ProcessEventArguments } from '../types/eventTypes';
import { CustomEvent, RegisterEventListenersParams } from '../types/utilTypes';
import { Logger } from 'pino';
const loggerOptions: CustomLoggerOptions = config.get('loggerOptions');
+1 -1
View File
@@ -9,10 +9,10 @@ import {
VoiceChannel
} from 'discord.js';
import { Logger } from 'pino';
import { InteractionValidationError } from '../../classes/interactions';
import loggerModule from '../../services/logger';
import { EmbedOptions } from '../../types/configTypes';
import { ValidatorParams } from '../../types/utilTypes';
import { InteractionValidationError } from '../../classes/interactions';
const embedOptions: EmbedOptions = config.get('embedOptions');
export const checkVoicePermissionJoinAndTalk = async ({ interaction, executionId }: ValidatorParams) => {
+1 -1
View File
@@ -1,10 +1,10 @@
import config from 'config';
import { EmbedBuilder, InteractionType } from 'discord.js';
import { Logger } from 'pino';
import { InteractionValidationError } from '../../classes/interactions';
import loggerModule from '../../services/logger';
import { EmbedOptions } from '../../types/configTypes';
import { ValidatorParams } from '../../types/utilTypes';
import { InteractionValidationError } from '../../classes/interactions';
const embedOptions: EmbedOptions = config.get('embedOptions');
export const checkQueueExists = async ({ interaction, queue, executionId }: ValidatorParams) => {
@@ -1,10 +1,10 @@
import config from 'config';
import { EmbedBuilder, InteractionType } from 'discord.js';
import { Logger } from 'pino';
import { InteractionValidationError } from '../../classes/interactions';
import loggerModule from '../../services/logger';
import { EmbedOptions, SystemOptions } from '../../types/configTypes';
import { ValidatorParams } from '../../types/utilTypes';
import { InteractionValidationError } from '../../classes/interactions';
const embedOptions: EmbedOptions = config.get('embedOptions');
const systemOptions: SystemOptions = config.get('systemOptions');
@@ -1,10 +1,10 @@
import config from 'config';
import { EmbedBuilder, GuildMember, InteractionType } from 'discord.js';
import { Logger } from 'pino';
import { InteractionValidationError } from '../../classes/interactions';
import loggerModule from '../../services/logger';
import { EmbedOptions } from '../../types/configTypes';
import { ValidatorParams } from '../../types/utilTypes';
import { InteractionValidationError } from '../../classes/interactions';
const embedOptions: EmbedOptions = config.get('embedOptions');
export const checkInVoiceChannel = async ({ interaction, executionId }: ValidatorParams) => {