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