fix: separated types and classes

This commit is contained in:
Marius Begby committed 2023-09-03 02:19:28 +02:00
1 parent 6dcddee2e9
commit ea32ae6c61
42 files changed
+234 -296

No files matched your search

@@ -10,55 +10,16 @@ import {
} from 'discord.js'; } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../services/logger'; import loggerModule from '../services/logger';
import { ExtendedClient } from './clientTypes'; import { BotOptions, EmbedOptions } from '../types/configTypes';
import { BotOptions, EmbedOptions } from './configTypes'; import {
BaseAutocompleteParams,
export interface ShardInfo { BaseAutocompleteReturnType,
shardId: number; BaseComponentParams,
memUsage: number; BaseComponentReturnType,
guildCount: number; BaseInteractionParams,
guildMemberCount: number; BaseSlashCommandParams,
playerStatistics: { BaseSlashCommandReturnType
activeVoiceConnections: number; } from '../types/interactionTypes';
totalTracks: number;
totalListeners: number;
};
}
export interface TrackMetadata {
bridge: {
views: number;
};
}
export class CustomError extends Error {
type?: string;
code?: string;
}
interface BaseInteractionParams {
executionId: string;
}
export interface BaseSlashCommandParams extends BaseInteractionParams {
interaction: ChatInputCommandInteraction;
client?: ExtendedClient;
}
export interface BaseAutocompleteParams extends BaseInteractionParams {
interaction: AutocompleteInteraction;
}
export interface BaseComponentParams extends BaseInteractionParams {
interaction: MessageComponentInteraction;
referenceId?: string;
}
export type BaseSlashCommandReturnType = Promise<Message<boolean> | void>;
export type BaseAutocompleteReturnType = Promise<ApplicationCommandOptionChoiceData | void>;
export type BaseComponentReturnType = Promise<Message<boolean> | void>;
abstract class BaseInteraction { abstract class BaseInteraction {
protected getLoggerBase( protected getLoggerBase(
@@ -146,3 +107,8 @@ export abstract class BaseComponentInteraction extends BaseInteraction {
abstract execute(params: BaseComponentParams): BaseComponentReturnType; abstract execute(params: BaseComponentParams): BaseComponentReturnType;
} }
export class CustomError extends Error {
type?: string;
code?: string;
}
+1 -1
View File
@@ -14,7 +14,7 @@ import { handleComponent } from '../../handlers/interactionComponentHandler';
import { handleError } from '../../handlers/interactionErrorHandler'; import { handleError } from '../../handlers/interactionErrorHandler';
import loggerModule from '../../services/logger'; import loggerModule from '../../services/logger';
import { ExtendedClient } from '../../types/clientTypes'; import { ExtendedClient } from '../../types/clientTypes';
import { CustomError } from '../../types/interactionTypes'; import { CustomError } from '../../classes/interactions';
module.exports = { module.exports = {
name: Events.InteractionCreate, name: Events.InteractionCreate,
+1
View File
@@ -26,6 +26,7 @@ module.exports = {
logger.error(error, "player.events.on('error'): Player queue encountered error event"); logger.error(error, "player.events.on('error'): Player queue encountered error event");
// TODO: check for access to send message to channel to avoid possible DiscordAPIError - Missing Access
await queue.metadata?.channel.send({ await queue.metadata?.channel.send({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
@@ -2,7 +2,7 @@ import { AutocompleteInteraction } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../services/logger'; import loggerModule from '../services/logger';
import { ExtendedClient } from '../types/clientTypes'; import { ExtendedClient } from '../types/clientTypes';
import { BaseAutocompleteInteraction } from '../types/interactionTypes'; import { BaseAutocompleteInteraction } from '../classes/interactions';
export const handleAutocomplete = async ( export const handleAutocomplete = async (
interaction: AutocompleteInteraction, interaction: AutocompleteInteraction,
+1 -1
View File
@@ -2,7 +2,7 @@ import { ChatInputCommandInteraction } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../services/logger'; import loggerModule from '../services/logger';
import { ExtendedClient } from '../types/clientTypes'; import { ExtendedClient } from '../types/clientTypes';
import { BaseSlashCommandInteraction } from '../types/interactionTypes'; import { BaseSlashCommandInteraction } from '../classes/interactions';
import { cannotSendMessageInChannel } from '../utils/validation/permissionValidator'; import { cannotSendMessageInChannel } from '../utils/validation/permissionValidator';
export const handleCommand = async ( export const handleCommand = async (
+1 -1
View File
@@ -2,7 +2,7 @@ import { MessageComponentInteraction } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../services/logger'; import loggerModule from '../services/logger';
import { ExtendedClient } from '../types/clientTypes'; import { ExtendedClient } from '../types/clientTypes';
import { BaseComponentInteraction } from '../types/interactionTypes'; import { BaseComponentInteraction } from '../classes/interactions';
import { cannotSendMessageInChannel } from '../utils/validation/permissionValidator'; import { cannotSendMessageInChannel } from '../utils/validation/permissionValidator';
export const handleComponent = async ( export const handleComponent = async (
+1 -1
View File
@@ -10,7 +10,7 @@ import {
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../services/logger'; import loggerModule from '../services/logger';
import { BotOptions, EmbedOptions } from '../types/configTypes'; import { BotOptions, EmbedOptions } from '../types/configTypes';
import { CustomError } from '../types/interactionTypes'; import { CustomError } from '../classes/interactions';
const embedOptions: EmbedOptions = config.get('embedOptions'); const embedOptions: EmbedOptions = config.get('embedOptions');
const botOptions: BotOptions = config.get('botOptions'); const botOptions: BotOptions = config.get('botOptions');
+2 -3
View File
@@ -1,14 +1,13 @@
import 'dotenv/config'; import 'dotenv/config';
import config from 'config'; import config from 'config';
import { Client, Shard, ShardEvents, ShardingManager } from 'discord.js'; import { Client, Shard, ShardEvents, ShardingManager, ShardingManagerOptions } from 'discord.js';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from './services/logger'; import loggerModule from './services/logger';
import { ShardingOptions } from './types/configTypes';
const shardingOptions: ShardingOptions = config.get('shardingOptions'); const shardingOptions: ShardingManagerOptions = config.get('shardingOptions');
const manager: ShardingManager = new ShardingManager('./dist/bot.js', { const manager: ShardingManager = new ShardingManager('./dist/bot.js', {
token: process.env.DISCORD_BOT_TOKEN, token: process.env.DISCORD_BOT_TOKEN,
+4 -7
View File
@@ -1,13 +1,10 @@
import { LyricsData, lyricsExtractor } from '@discord-player/extractor'; import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
import { Player, SearchResult, useMainPlayer } from 'discord-player'; import { Player, SearchResult, useMainPlayer } from 'discord-player';
import { ApplicationCommandOptionChoiceData } from 'discord.js'; import { ApplicationCommandOptionChoiceData } from 'discord.js';
import { import { BaseAutocompleteParams, BaseAutocompleteReturnType } from '../../types/interactionTypes';
BaseAutocompleteInteraction, import { BaseAutocompleteInteraction } from '../../classes/interactions';
BaseAutocompleteParams,
BaseAutocompleteReturnType
} from '../../types/interactionTypes';
// TODO: create interface for recent query object // TODO: create type for recent query object
const recentQueries = new Map(); const recentQueries = new Map();
class LyricsAutocomplete extends BaseAutocompleteInteraction { class LyricsAutocomplete extends BaseAutocompleteInteraction {
@@ -34,7 +31,7 @@ class LyricsAutocomplete extends BaseAutocompleteInteraction {
const genius = lyricsExtractor(); const genius = lyricsExtractor();
const lyricsResult: LyricsData = (await genius.search(query).catch(() => null)) as LyricsData; const lyricsResult: LyricsData = (await genius.search(query).catch(() => null)) as LyricsData;
// TODO: Update TS Type for lyricsResult and create response object interface // TODO: Update TS Type for lyricsResult and create response object type
let response: ApplicationCommandOptionChoiceData<string>[] = []; let response: ApplicationCommandOptionChoiceData<string>[] = [];
if (!lyricsResult) { if (!lyricsResult) {
+3 -6
View File
@@ -1,12 +1,9 @@
import { Player, SearchResult, useMainPlayer } from 'discord-player'; import { Player, SearchResult, useMainPlayer } from 'discord-player';
import { ApplicationCommandOptionChoiceData } from 'discord.js'; import { ApplicationCommandOptionChoiceData } from 'discord.js';
import { import { BaseAutocompleteParams, BaseAutocompleteReturnType } from '../../types/interactionTypes';
BaseAutocompleteInteraction, import { BaseAutocompleteInteraction } from '../../classes/interactions';
BaseAutocompleteParams,
BaseAutocompleteReturnType
} from '../../types/interactionTypes';
// TODO: create interface for recent query object // TODO: create type for recent query object
const recentQueries = new Map(); const recentQueries = new Map();
class PlayAutocomplete extends BaseAutocompleteInteraction { class PlayAutocomplete extends BaseAutocompleteInteraction {
+3 -8
View File
@@ -1,15 +1,10 @@
import { EmbedBuilder, SlashCommandBuilder, SlashCommandNumberOption, SlashCommandStringOption } from 'discord.js'; import { EmbedBuilder, SlashCommandBuilder, SlashCommandNumberOption, SlashCommandStringOption } from 'discord.js';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
class HelpCommand extends BaseSlashCommandInteraction { class HelpCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
const data = new SlashCommandBuilder() const data = new SlashCommandBuilder().setName('help').setDescription('Show the list of bot commands.');
.setName('help')
.setDescription('Show the list of bot commands.');
super(data); super(data);
} }
+2 -5
View File
@@ -2,11 +2,8 @@ import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
import osu from 'node-os-utils'; import osu from 'node-os-utils';
// @ts-ignore // @ts-ignore
import { version } from '../../../../package.json'; import { version } from '../../../../package.json';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted'; import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
class StatusCommand extends BaseSlashCommandInteraction { class StatusCommand extends BaseSlashCommandInteraction {
+3 -8
View File
@@ -14,11 +14,8 @@ import {
StringSelectMenuOptionBuilder StringSelectMenuOptionBuilder
} from 'discord.js'; } from 'discord.js';
import { FFmpegFilterOption, FFmpegFilterOptions } from '../../../types/configTypes'; import { FFmpegFilterOption, FFmpegFilterOptions } from '../../../types/configTypes';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator'; import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
@@ -26,9 +23,7 @@ const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions
class FiltersCommand extends BaseSlashCommandInteraction { class FiltersCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
const data = new SlashCommandBuilder() const data = new SlashCommandBuilder().setName('filters').setDescription('Toggle various audio filters.');
.setName('filters')
.setDescription('Toggle various audio filters.');
super(data); super(data);
} }
+2 -5
View File
@@ -1,10 +1,7 @@
import { GuildQueue, useQueue } from 'discord-player'; import { GuildQueue, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { queueDoesNotExist } from '../../../utils/validation/queueValidator'; import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
+2 -5
View File
@@ -1,10 +1,7 @@
import { GuildQueue, QueueRepeatMode, useQueue } from 'discord-player'; import { GuildQueue, QueueRepeatMode, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder, SlashCommandStringOption } from 'discord.js'; import { EmbedBuilder, GuildMember, SlashCommandBuilder, SlashCommandStringOption } from 'discord.js';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { queueDoesNotExist } from '../../../utils/validation/queueValidator'; import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
+2 -5
View File
@@ -1,11 +1,8 @@
import { LyricsData, lyricsExtractor } from '@discord-player/extractor'; import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
import { GuildQueue, Player, QueryType, useMainPlayer, useQueue } from 'discord-player'; import { GuildQueue, Player, QueryType, useMainPlayer, useQueue } from 'discord-player';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator'; import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
+11 -16
View File
@@ -11,12 +11,8 @@ import {
SlashCommandBuilder SlashCommandBuilder
} from 'discord.js'; } from 'discord.js';
import { PlayerOptions } from '../../../types/configTypes'; import { PlayerOptions } from '../../../types/configTypes';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType, TrackMetadata } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType,
TrackMetadata
} from '../../../types/interactionTypes';
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator'; import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
@@ -36,7 +32,7 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
const queue: GuildQueue = useQueue(interaction.guild!.id)!; const queue: GuildQueue = useQueue(interaction.guild!.id)!;
// TODO: define TS type/interface for validators // TODO: define TS type for validators
const validators = [ const validators = [
() => notInVoiceChannel({ interaction, executionId }), () => notInVoiceChannel({ interaction, executionId }),
() => notInSameVoiceChannel({ interaction, queue, executionId }), () => notInSameVoiceChannel({ interaction, queue, executionId }),
@@ -128,6 +124,13 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
const loopModeUserString: string = loopModesFormatted.get(queue.repeatMode)!; const loopModeUserString: string = loopModesFormatted.get(queue.repeatMode)!;
const getRepeatModeMessage = (repeatMode: number): string => {
const icon = repeatMode === 3 ? this.embedOptions.icons.autoplay : this.embedOptions.icons.loop;
return `**${icon} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.\n\n`;
};
const repeatModeString: string = queue.repeatMode === 0 ? '' : getRepeatModeMessage(queue.repeatMode);
logger.debug('Successfully retrieved information about the current track.'); logger.debug('Successfully retrieved information about the current track.');
logger.debug('Sending info embed with action row components.'); logger.debug('Sending info embed with action row components.');
@@ -145,15 +148,7 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
`**[${currentTrack.title}](${currentTrack.raw.url ?? currentTrack.url})**` + `**[${currentTrack.title}](${currentTrack.raw.url ?? currentTrack.url})**` +
`\nRequested by: <@${currentTrack.requestedBy?.id}>` + `\nRequested by: <@${currentTrack.requestedBy?.id}>` +
`\n ${bar}\n\n` + `\n ${bar}\n\n` +
`${ `${repeatModeString}`
queue.repeatMode === 0
? ''
: `**${
queue.repeatMode === 3
? this.embedOptions.icons.autoplay
: this.embedOptions.icons.loop
} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.`
}`
) )
.addFields( .addFields(
{ {
+2 -5
View File
@@ -1,11 +1,8 @@
import { GuildQueue, Track, useQueue } from 'discord-player'; import { GuildQueue, Track, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator'; import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
+2 -6
View File
@@ -1,13 +1,9 @@
import config from 'config'; import config from 'config';
import { GuildQueue, useMainPlayer, useQueue } from 'discord-player'; import { GuildQueue, useMainPlayer, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction, CustomError } from '../../../classes/interactions';
import { PlayerOptions } from '../../../types/configTypes'; import { PlayerOptions } from '../../../types/configTypes';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction,
BaseSlashCommandParams,
BaseSlashCommandReturnType,
CustomError
} from '../../../types/interactionTypes';
import { cannotJoinVoiceOrTalk } from '../../../utils/validation/permissionValidator'; import { cannotJoinVoiceOrTalk } from '../../../utils/validation/permissionValidator';
import { transformQuery } from '../../../utils/validation/searchQueryValidator'; import { transformQuery } from '../../../utils/validation/searchQueryValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
+9 -14
View File
@@ -1,16 +1,12 @@
import config from 'config'; import config from 'config';
import { GuildQueue, PlayerTimestamp, Track, useQueue } from 'discord-player'; import { GuildQueue, PlayerTimestamp, Track, useQueue } from 'discord-player';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { EmbedOptions, PlayerOptions } from '../../../types/configTypes'; import { PlayerOptions } from '../../../types/configTypes';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { queueDoesNotExist } from '../../../utils/validation/queueValidator'; import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
const embedOptions: EmbedOptions = config.get('embedOptions');
const playerOptions: PlayerOptions = config.get('playerOptions'); const playerOptions: PlayerOptions = config.get('playerOptions');
class QueueCommand extends BaseSlashCommandInteraction { class QueueCommand extends BaseSlashCommandInteraction {
@@ -97,13 +93,12 @@ class QueueCommand extends BaseSlashCommandInteraction {
const loopModeUserString: string = loopModesFormatted.get(queue.repeatMode)!; const loopModeUserString: string = loopModesFormatted.get(queue.repeatMode)!;
const repeatModeString: string = `${ const getRepeatModeMessage = (repeatMode: number): string => {
queue.repeatMode === 0 const icon = repeatMode === 3 ? this.embedOptions.icons.autoplay : this.embedOptions.icons.loop;
? '' return `**${icon} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.\n\n`;
: `**${ };
queue.repeatMode === 3 ? embedOptions.icons.autoplay : embedOptions.icons.loop
} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.\n\n` const repeatModeString: string = queue.repeatMode === 0 ? '' : getRepeatModeMessage(queue.repeatMode);
}`;
if (!currentTrack) { if (!currentTrack) {
logger.debug('Queue exists but there is no current track.'); logger.debug('Queue exists but there is no current track.');
+2 -5
View File
@@ -1,10 +1,7 @@
import { GuildQueue, Track, useQueue } from 'discord-player'; import { GuildQueue, Track, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { queueDoesNotExist } from '../../../utils/validation/queueValidator'; import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
+3 -9
View File
@@ -1,10 +1,7 @@
import { GuildQueue, useQueue } from 'discord-player'; import { GuildQueue, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator'; import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
@@ -14,10 +11,7 @@ class SeekCommand extends BaseSlashCommandInteraction {
.setName('seek') .setName('seek')
.setDescription('Seek to a duration in the current track.') .setDescription('Seek to a duration in the current track.')
.addStringOption((option) => .addStringOption((option) =>
option option.setName('duration').setDescription('Duration in format 00:00:00 (HH:mm:ss).').setRequired(true)
.setName('duration')
.setDescription('Duration in format 00:00:00 (HH:mm:ss).')
.setRequired(true)
); );
super(data); super(data);
} }
+2 -5
View File
@@ -1,10 +1,7 @@
import { GuildQueue, useQueue } from 'discord-player'; import { GuildQueue, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { queueDoesNotExist, queueIsEmpty } from '../../../utils/validation/queueValidator'; import { queueDoesNotExist, queueIsEmpty } from '../../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
+10 -15
View File
@@ -1,10 +1,7 @@
import { GuildQueue, Track, useQueue } from 'discord-player'; import { GuildQueue, Track, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator'; import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
@@ -134,6 +131,13 @@ class SkipCommand extends BaseSlashCommandInteraction {
const loopModeUserString: string = loopModesFormatted.get(queue.repeatMode)!; const loopModeUserString: string = loopModesFormatted.get(queue.repeatMode)!;
const getRepeatModeMessage = (repeatMode: number): string => {
const icon = repeatMode === 3 ? this.embedOptions.icons.autoplaying : this.embedOptions.icons.looping;
return `**${icon} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.`;
};
const repeatModeString: string = queue.repeatMode === 0 ? '' : getRepeatModeMessage(queue.repeatMode);
let authorName: string; let authorName: string;
if (interaction.member instanceof GuildMember) { if (interaction.member instanceof GuildMember) {
@@ -153,16 +157,7 @@ class SkipCommand extends BaseSlashCommandInteraction {
.setDescription( .setDescription(
`**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${ `**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
skippedTrack.title skippedTrack.title
}](${skippedTrack.raw.url ?? skippedTrack.url})**` + }](${skippedTrack.raw.url ?? skippedTrack.url})**` + `\n\n${repeatModeString}`
`${
queue.repeatMode === 0
? ''
: `\n\n**${
queue.repeatMode === 3
? this.embedOptions.icons.autoplaying
: this.embedOptions.icons.looping
} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.`
}`
) )
.setThumbnail(skippedTrack.thumbnail) .setThumbnail(skippedTrack.thumbnail)
.setColor(this.embedOptions.colors.success) .setColor(this.embedOptions.colors.success)
+2 -5
View File
@@ -1,10 +1,7 @@
import { GuildQueue, useQueue } from 'discord-player'; import { GuildQueue, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { queueDoesNotExist } from '../../../utils/validation/queueValidator'; import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
+2 -5
View File
@@ -1,10 +1,7 @@
import { GuildQueue, useQueue } from 'discord-player'; import { GuildQueue, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { queueDoesNotExist } from '../../../utils/validation/queueValidator'; import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
+2 -5
View File
@@ -1,9 +1,6 @@
import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator'; import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
class GuildsCommand extends BaseSlashCommandInteraction { class GuildsCommand extends BaseSlashCommandInteraction {
+2 -5
View File
@@ -1,10 +1,7 @@
import { ApplicationCommandOption, ApplicationCommandOptionData, EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { ApplicationCommandOption, ApplicationCommandOptionData, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { ExtendedClient } from '../../../types/clientTypes'; import { ExtendedClient } from '../../../types/clientTypes';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator'; import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
class ReloadCommand extends BaseSlashCommandInteraction { class ReloadCommand extends BaseSlashCommandInteraction {
+2 -6
View File
@@ -1,11 +1,7 @@
import { EmbedBuilder, EmbedField, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, EmbedField, SlashCommandBuilder } from 'discord.js';
import { ExtendedClient } from '../../../types/clientTypes'; import { ExtendedClient } from '../../../types/clientTypes';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType, ShardInfo } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType,
ShardInfo
} from '../../../types/interactionTypes';
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator'; import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
class ShardsCommand extends BaseSlashCommandInteraction { class ShardsCommand extends BaseSlashCommandInteraction {
@@ -2,11 +2,8 @@ import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
import osu from 'node-os-utils'; import osu from 'node-os-utils';
// @ts-ignore // @ts-ignore
import { dependencies, version } from '../../../../package.json'; import { dependencies, version } from '../../../../package.json';
import { import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
BaseSlashCommandInteraction, import { BaseSlashCommandInteraction } from '../../../classes/interactions';
BaseSlashCommandParams,
BaseSlashCommandReturnType
} from '../../../types/interactionTypes';
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted'; import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator'; import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
@@ -1,6 +1,7 @@
import { GuildQueue, useQueue } from 'discord-player'; import { GuildQueue, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember } from 'discord.js'; import { EmbedBuilder, GuildMember } from 'discord.js';
import { BaseComponentInteraction, BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes'; import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
import { BaseComponentInteraction } from '../../classes/interactions';
import { queueDoesNotExist } from '../../utils/validation/queueValidator'; import { queueDoesNotExist } from '../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
@@ -2,7 +2,8 @@ import config from 'config';
import { GuildQueue, QueueFilters, useQueue } from 'discord-player'; import { GuildQueue, QueueFilters, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember, StringSelectMenuInteraction } from 'discord.js'; import { EmbedBuilder, GuildMember, StringSelectMenuInteraction } from 'discord.js';
import { FFmpegFilterOption, FFmpegFilterOptions } from '../../types/configTypes'; import { FFmpegFilterOption, FFmpegFilterOptions } from '../../types/configTypes';
import { BaseComponentInteraction, BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes'; import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
import { BaseComponentInteraction } from '../../classes/interactions';
import { queueDoesNotExist } from '../../utils/validation/queueValidator'; import { queueDoesNotExist } from '../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions'); const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
@@ -1,6 +1,7 @@
import { GuildQueue, Track, useQueue } from 'discord-player'; import { GuildQueue, Track, useQueue } from 'discord-player';
import { EmbedBuilder, GuildMember } from 'discord.js'; import { EmbedBuilder, GuildMember } from 'discord.js';
import { BaseComponentInteraction, BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes'; import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
import { BaseComponentInteraction } from '../../classes/interactions';
import { queueDoesNotExist, queueNoCurrentTrack } from '../../utils/validation/queueValidator'; import { queueDoesNotExist, queueNoCurrentTrack } from '../../utils/validation/queueValidator';
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
@@ -79,7 +80,14 @@ class NowplayingSkipButton extends BaseComponentInteraction {
[3, 'autoplay'] [3, 'autoplay']
]); ]);
const repeatModeUserString: string = loopModesFormatted.get(queue.repeatMode)!; const loopModeUserString: string = loopModesFormatted.get(queue.repeatMode)!;
const getRepeatModeMessage = (repeatMode: number): string => {
const icon = repeatMode === 3 ? this.embedOptions.icons.autoplaying : this.embedOptions.icons.looping;
return `**${icon} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.`;
};
const repeatModeString: string = queue.repeatMode === 0 ? '' : getRepeatModeMessage(queue.repeatMode);
let authorName: string; let authorName: string;
@@ -100,16 +108,7 @@ class NowplayingSkipButton extends BaseComponentInteraction {
.setDescription( .setDescription(
`**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${ `**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
skippedTrack.title skippedTrack.title
}](${skippedTrack.raw.url ?? skippedTrack.url})**` + }](${skippedTrack.raw.url ?? skippedTrack.url})**` + `\n\n${repeatModeString}`
`${
queue.repeatMode === 0
? ''
: `\n\n**${
queue.repeatMode === 3
? this.embedOptions.icons.autoplaying
: this.embedOptions.icons.looping
} Looping**\nLoop mode is set to ${repeatModeUserString}. You can change it with **\`/loop\`**.`
}`
) )
.setThumbnail(skippedTrack.thumbnail) .setThumbnail(skippedTrack.thumbnail)
.setColor(this.embedOptions.colors.success) .setColor(this.embedOptions.colors.success)
+7 -3
View File
@@ -1,11 +1,15 @@
import { Client, Collection } from 'discord.js'; import { Client, Collection } from 'discord.js';
import { BaseAutocompleteInteraction, BaseComponentInteraction, BaseSlashCommandInteraction } from './interactionTypes'; import {
BaseAutocompleteInteraction,
BaseComponentInteraction,
BaseSlashCommandInteraction
} from '../classes/interactions';
type RegisterClientInteractionsFunction = (params: { client: Client; executionId: string }) => void; type RegisterClientInteractionsFunction = (params: { client: Client; executionId: string }) => void;
export interface ExtendedClient extends Client { export type ExtendedClient = {
registerClientInteractions?: RegisterClientInteractionsFunction; registerClientInteractions?: RegisterClientInteractionsFunction;
slashCommandInteractions?: Collection<string, BaseSlashCommandInteraction>; slashCommandInteractions?: Collection<string, BaseSlashCommandInteraction>;
autocompleteInteractions?: Collection<string, BaseAutocompleteInteraction>; autocompleteInteractions?: Collection<string, BaseAutocompleteInteraction>;
componentInteractions?: Collection<string, BaseComponentInteraction>; componentInteractions?: Collection<string, BaseComponentInteraction>;
} } & Client;
+19 -21
View File
@@ -1,35 +1,33 @@
import { ActivityType, ColorResolvable, PresenceUpdateStatus, ShardingManagerOptions } from 'discord.js'; import { ActivityType, ColorResolvable, PresenceUpdateStatus } from 'discord.js';
import { LogLevel } from './serviceTypes'; import { LogLevel } from './serviceTypes';
export interface BotOptions { export type BotOptions = {
name: string; name: string;
botInviteUrl: string; botInviteUrl: string;
serverInviteUrl: string; serverInviteUrl: string;
} };
export interface ShardingOptions extends ShardingManagerOptions {} export type CustomLoggerOptions = {
export interface CustomLoggerOptions {
minimumLogLevel: LogLevel; minimumLogLevel: LogLevel;
minimumLogLevelConsole: LogLevel; minimumLogLevelConsole: LogLevel;
discordPlayerDebug: boolean; discordPlayerDebug: boolean;
} };
export interface SystemOptions { export type SystemOptions = {
systemGuildIds: string[]; systemGuildIds: string[];
systemMessageChannelId: string; systemMessageChannelId: string;
systemUserId: string; systemUserId: string;
} };
export interface PresenceStatusOptions { export type PresenceStatusOptions = {
status: PresenceUpdateStatus; status: PresenceUpdateStatus;
activities: { activities: {
name: string; name: string;
type: ActivityType; type: ActivityType;
}[]; }[];
} };
export interface EmbedOptions { export type EmbedOptions = {
info: { info: {
fallbackThumbnailUrl: string; fallbackThumbnailUrl: string;
fallbackIconUrl: string; fallbackIconUrl: string;
@@ -85,9 +83,9 @@ export interface EmbedOptions {
sourceSpotify: string; sourceSpotify: string;
liveTrack: string; liveTrack: string;
}; };
} };
export interface PlayerOptions { export type PlayerOptions = {
leaveOnEmpty: boolean; leaveOnEmpty: boolean;
leaveOnEmptyCooldown: number; leaveOnEmptyCooldown: number;
leaveOnEnd: boolean; leaveOnEnd: boolean;
@@ -107,22 +105,22 @@ export interface PlayerOptions {
leftChar: string; leftChar: string;
rightChar: string; rightChar: string;
}; };
} };
export interface FFmpegFilterOption { export type FFmpegFilterOption = {
label: string; label: string;
value: string; value: string;
description: string; description: string;
emoji: string; emoji: string;
} };
export interface FFmpegFilterOptions { export type FFmpegFilterOptions = {
threadAmount: string; threadAmount: string;
availableFilters: FFmpegFilterOption[]; availableFilters: FFmpegFilterOption[];
} };
export interface LoadTestOptions { export type LoadTestOptions = {
enabled: boolean; enabled: boolean;
trackUrl: string; trackUrl: string;
channelIdsToJoin: string[]; channelIdsToJoin: string[];
} };
+2 -2
View File
@@ -7,11 +7,11 @@ export type ClientEventArguments = unknown[];
export type ProcessEventArguments = unknown[]; export type ProcessEventArguments = unknown[];
export type PlayerEventArguments = unknown[]; export type PlayerEventArguments = unknown[];
export interface ExtendedGuildQueuePlayerNode extends GuildQueuePlayerNode<unknown> { export type ExtendedGuildQueuePlayerNode = {
metadata: metadata:
| undefined | undefined
| { | {
client: ExtendedClient; client: ExtendedClient;
channel: BaseGuildTextChannel; channel: BaseGuildTextChannel;
}; };
} } & GuildQueuePlayerNode<unknown>;
File renamed without changes.
+50
View File
@@ -0,0 +1,50 @@
import {
ApplicationCommandOptionChoiceData,
AutocompleteInteraction,
ChatInputCommandInteraction,
Message,
MessageComponentInteraction
} from 'discord.js';
import { ExtendedClient } from './clientTypes';
export type ShardInfo = {
shardId: number;
memUsage: number;
guildCount: number;
guildMemberCount: number;
playerStatistics: {
activeVoiceConnections: number;
totalTracks: number;
totalListeners: number;
};
};
export type TrackMetadata = {
bridge: {
views: number;
};
};
type BaseInteractionParams = {
executionId: string;
};
export type BaseSlashCommandParams = {
interaction: ChatInputCommandInteraction;
client?: ExtendedClient;
} & BaseInteractionParams;
export type BaseAutocompleteParams = {
interaction: AutocompleteInteraction;
} & BaseInteractionParams;
export type BaseComponentParams = {
interaction: MessageComponentInteraction;
referenceId?: string;
} & BaseInteractionParams;
export type BaseSlashCommandReturnType = Promise<Message<boolean> | void>;
export type BaseAutocompleteReturnType = Promise<ApplicationCommandOptionChoiceData | void>;
export type BaseComponentReturnType = Promise<Message<boolean> | void>;
+2 -2
View File
@@ -1,6 +1,6 @@
import { Client } from 'discord.js'; import { Client } from 'discord.js';
export interface CreatePlayerParams { export type CreatePlayerParams = {
client: Client; client: Client;
executionId: string; executionId: string;
} };
File renamed without changes.
+32 -32
View File
@@ -3,94 +3,94 @@ import { ChatInputCommandInteraction, MessageComponentInteraction } from 'discor
import { ExtendedClient } from './clientTypes'; import { ExtendedClient } from './clientTypes';
export interface RegisterEventListenersParams { export type RegisterEventListenersParams = {
client: ExtendedClient; client: ExtendedClient;
player: Player; player: Player;
executionId: string; executionId: string;
} };
export interface RegisterClientInteractionsParams { export type RegisterClientInteractionsParams = {
client: ExtendedClient; client: ExtendedClient;
executionId: string; executionId: string;
} };
export interface CustomEvent { export type CustomEvent = {
name: string; name: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
execute: (...args: any) => void; execute: (...args: any) => void;
once?: boolean; once?: boolean;
isDebug?: boolean; isDebug?: boolean;
isPlayerEvent?: boolean; isPlayerEvent?: boolean;
} };
export interface NotInVoiceChannelParams { export type NotInVoiceChannelParams = {
interaction: ChatInputCommandInteraction | MessageComponentInteraction; interaction: ChatInputCommandInteraction | MessageComponentInteraction;
executionId: string; executionId: string;
} };
export interface NotInSameVoiceChannelParams { export type NotInSameVoiceChannelParams = {
interaction: ChatInputCommandInteraction | MessageComponentInteraction; interaction: ChatInputCommandInteraction | MessageComponentInteraction;
queue: GuildQueue; queue: GuildQueue;
executionId: string; executionId: string;
} };
export interface NotValidGuildIdParams { export type NotValidGuildIdParams = {
interaction: ChatInputCommandInteraction | MessageComponentInteraction; interaction: ChatInputCommandInteraction | MessageComponentInteraction;
executionId: string; executionId: string;
} };
export interface TransformQueryParams { export type TransformQueryParams = {
query: string; query: string;
executionId: string; executionId: string;
} };
export interface QueueDoesNotExistParams { export type QueueDoesNotExistParams = {
interaction: ChatInputCommandInteraction | MessageComponentInteraction; interaction: ChatInputCommandInteraction | MessageComponentInteraction;
queue: GuildQueue; queue: GuildQueue;
executionId: string; executionId: string;
} };
export interface QueueNoCurrentTrackParams { export type QueueNoCurrentTrackParams = {
interaction: ChatInputCommandInteraction | MessageComponentInteraction; interaction: ChatInputCommandInteraction | MessageComponentInteraction;
queue: GuildQueue; queue: GuildQueue;
executionId: string; executionId: string;
} };
export interface QueueIsEmptyParams { export type QueueIsEmptyParams = {
interaction: ChatInputCommandInteraction | MessageComponentInteraction; interaction: ChatInputCommandInteraction | MessageComponentInteraction;
queue: GuildQueue; queue: GuildQueue;
executionId: string; executionId: string;
} };
export interface CannotJoinVoiceOrTalkParams { export type CannotJoinVoiceOrTalkParams = {
interaction: ChatInputCommandInteraction | MessageComponentInteraction; interaction: ChatInputCommandInteraction | MessageComponentInteraction;
executionId: string; executionId: string;
} };
export interface CannotSendMessageInChannelParams { export type CannotSendMessageInChannelParams = {
interaction: ChatInputCommandInteraction | MessageComponentInteraction; interaction: ChatInputCommandInteraction | MessageComponentInteraction;
executionId: string; executionId: string;
} };
export interface GetUptimeFormattedParams { export type GetUptimeFormattedParams = {
executionId: string; executionId: string;
} };
export interface StartLoadTestParams { export type StartLoadTestParams = {
client: ExtendedClient; client: ExtendedClient;
executionId: string; executionId: string;
} };
export interface PostBotStatsParams { export type PostBotStatsParams = {
client: ExtendedClient; client: ExtendedClient;
executionId: string; executionId: string;
} };
export interface PostBotStatsSite { export type PostBotStatsSite = {
enabled: boolean; enabled: boolean;
hostname: string; hostname: string;
path: string; path: string;
method: string; method: string;
body: object; body: object;
token: string; token: string;
} };
+10 -10
View File
@@ -1,14 +1,14 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2020", // Specify ECMAScript target version "target": "ES2020",
"module": "commonjs", // Specify module code generation "module": "CommonJS",
"outDir": "./dist", // Output directory for compiled files "outDir": "./dist",
"rootDir": "./src", // Root directory of source files "rootDir": "./src",
"strict": true, // Enable strict type-checking options "strict": true,
"esModuleInterop": true, // Enables ES module interop "esModuleInterop": true,
"skipLibCheck": true, // Skip type checking of declaration files "skipLibCheck": true,
"forceConsistentCasingInFileNames": true // Disallow inconsistently-cased references to the same file "forceConsistentCasingInFileNames": true
}, },
"include": ["src/**/*.ts", "src/types/**/*.ts"], // Source files to be compiled "include": ["src/**/*.ts"],
"exclude": ["node_modules"] // Exclude node_modules from compilation "exclude": ["node_modules"]
} }