mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 22:15:29 +00:00
88 files changed
+650
-485
No files matched your search
@@ -290,6 +290,48 @@
|
|||||||
"durationLongerThanTrackDuration": "{{icon}} **Oops!**\nYou entered **`{{wrongDuration}}`**, which is a timestamp longer than the duration of the current track.\n\nPlease try a timestamp that is less than the duration of the track (**{{trackDuration}}**).",
|
"durationLongerThanTrackDuration": "{{icon}} **Oops!**\nYou entered **`{{wrongDuration}}`**, which is a timestamp longer than the duration of the current track.\n\nPlease try a timestamp that is less than the duration of the track (**{{trackDuration}}**).",
|
||||||
"seekingToTimestamp": "{{icon}} **Seeking to timestamp**\nSeeking to **`{{duration}}`** in current track."
|
"seekingToTimestamp": "{{icon}} **Seeking to timestamp**\nSeeking to **`{{duration}}`** in current track."
|
||||||
},
|
},
|
||||||
|
"settings": {
|
||||||
|
"metadata": {
|
||||||
|
"name": "settings",
|
||||||
|
"description": "Configure various options for bot behavior in this server.",
|
||||||
|
"options": {
|
||||||
|
"bot-language": {
|
||||||
|
"name": "bot-language",
|
||||||
|
"description": "Set the language for the bot.",
|
||||||
|
"options": {
|
||||||
|
"language": {
|
||||||
|
"name": "language",
|
||||||
|
"description": "Language to use for the bot in messages.",
|
||||||
|
"choices": {
|
||||||
|
"en-US": "English",
|
||||||
|
"no": "Norwegian",
|
||||||
|
"ro": "Romanian",
|
||||||
|
"en-ES": "Spanish"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default-volume": {
|
||||||
|
"name": "default-volume",
|
||||||
|
"description": "Set the default volume for the bot.",
|
||||||
|
"options": {
|
||||||
|
"percentage": {
|
||||||
|
"name": "percentage",
|
||||||
|
"description": "Volume percentage: From 0% to 100%."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"action-permissions": {
|
||||||
|
"name": "action-permissions",
|
||||||
|
"description": "Set the roles required to perform certain actions."
|
||||||
|
},
|
||||||
|
"view": {
|
||||||
|
"name": "view",
|
||||||
|
"description": "View the current settings for the bot."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"shards": {
|
"shards": {
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "shards",
|
"name": "shards",
|
||||||
|
|||||||
Generated
+4
-4
@@ -13,7 +13,7 @@
|
|||||||
"@discord-player/extractor": "^4.4.6",
|
"@discord-player/extractor": "^4.4.6",
|
||||||
"@discord-player/opus": "^0.1.2",
|
"@discord-player/opus": "^0.1.2",
|
||||||
"@discordjs/rest": "^2.2.0",
|
"@discordjs/rest": "^2.2.0",
|
||||||
"@prisma/client": "^5.8.1",
|
"@prisma/client": "^5.9.0",
|
||||||
"config": "^3.3.10",
|
"config": "^3.3.10",
|
||||||
"discord-player": "^6.6.7",
|
"discord-player": "^6.6.7",
|
||||||
"discord-voip": "^0.1.3",
|
"discord-voip": "^0.1.3",
|
||||||
@@ -1537,9 +1537,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@prisma/client": {
|
"node_modules/@prisma/client": {
|
||||||
"version": "5.8.1",
|
"version": "5.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.9.0.tgz",
|
||||||
"integrity": "sha512-xQtMPfbIwLlbm0VVIVQY2yqQVOxPwRQhvIp7Z3m2900g1bu/zRHKhYZJQWELqmjl6d8YwBy0K2NvMqh47v1ubw==",
|
"integrity": "sha512-dHvFZgCT0BpRS+gRhk3S+50DstXMmVowxbrPeUJaK7sjNq5OhzfpT/OGE1kq9z5Q8WmOwIXJXyxP8O2CmP+nSg==",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.13"
|
"node": ">=16.13"
|
||||||
|
|||||||
+2
-2
@@ -27,7 +27,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node .",
|
"start": "node .",
|
||||||
"deploy": "node ./dist/utils/deploySlashCommands.js",
|
"deploy": "node ./dist/startup/deploySlashCommands.js",
|
||||||
"predev": "npx prisma generate && npx prisma db push",
|
"predev": "npx prisma generate && npx prisma db push",
|
||||||
"dev": "concurrently --names \"TSC,TOC,BOT\" --prefix-colors \"yellow,blue,green\" \"npx tsc -w\" \"nodemon -w locales/en -x npm run toc\" \"nodemon -x npm run start\"",
|
"dev": "concurrently --names \"TSC,TOC,BOT\" --prefix-colors \"yellow,blue,green\" \"npx tsc -w\" \"nodemon -w locales/en -x npm run toc\" \"nodemon -x npm run start\"",
|
||||||
"eslint": "eslint ./src --fix",
|
"eslint": "eslint ./src --fix",
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
"@discord-player/extractor": "^4.4.6",
|
"@discord-player/extractor": "^4.4.6",
|
||||||
"@discord-player/opus": "^0.1.2",
|
"@discord-player/opus": "^0.1.2",
|
||||||
"@discordjs/rest": "^2.2.0",
|
"@discordjs/rest": "^2.2.0",
|
||||||
"@prisma/client": "^5.8.1",
|
"@prisma/client": "^5.9.0",
|
||||||
"config": "^3.3.10",
|
"config": "^3.3.10",
|
||||||
"discord-player": "^6.6.7",
|
"discord-player": "^6.6.7",
|
||||||
"discord-voip": "^0.1.3",
|
"discord-voip": "^0.1.3",
|
||||||
|
|||||||
+12
-10
@@ -1,19 +1,21 @@
|
|||||||
generator client {
|
generator client {
|
||||||
provider = "prisma-client-js"
|
provider = "prisma-client-js"
|
||||||
}
|
}
|
||||||
|
|
||||||
datasource db {
|
datasource db {
|
||||||
provider = "sqlite"
|
provider = "sqlite"
|
||||||
url = "file:./dev.db"
|
url = "file:./dev.db"
|
||||||
}
|
}
|
||||||
|
|
||||||
model Guild {
|
model GuildConfig {
|
||||||
id String @id @default(cuid())
|
defaultVolume Int @default(50)
|
||||||
guildId String @unique
|
locale String @default("en-US")
|
||||||
|
actionPermissions String?
|
||||||
|
|
||||||
locale String @default("en-US")
|
guildId String @id @unique
|
||||||
defaultVolume Int @default(50)
|
|
||||||
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
@@map("guild_config")
|
||||||
}
|
}
|
||||||
+5
-5
@@ -6,12 +6,12 @@ import { Player } from 'discord-player';
|
|||||||
import { Client } from 'discord.js';
|
import { Client } 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 './common/services/logger';
|
||||||
import { ExtendedClient } from './types/clientTypes';
|
import { ExtendedClient } from './types/clientTypes';
|
||||||
import { createClient } from './utils/factory/createClient';
|
import { createClient } from './common/factory/createClient';
|
||||||
import { createPlayer } from './utils/factory/createPlayer';
|
import { createPlayer } from './common/factory/createPlayer';
|
||||||
import { registerClientInteractions } from './utils/registerClientInteractions';
|
import { registerClientInteractions } from './startup/registerClientInteractions';
|
||||||
import { registerEventListeners } from './utils/registerEventListeners';
|
import { registerEventListeners } from './startup/registerEventListeners';
|
||||||
|
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerModule.child({
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ 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 { BotOptions, EmbedOptions, PlayerOptions } from '../types/configTypes';
|
import { BotOptions, EmbedOptions, PlayerOptions } from '../../types/configTypes';
|
||||||
import {
|
import {
|
||||||
BaseAutocompleteParams,
|
BaseAutocompleteParams,
|
||||||
BaseAutocompleteReturnType,
|
BaseAutocompleteReturnType,
|
||||||
@@ -24,8 +24,8 @@ import {
|
|||||||
BaseInteractionParams,
|
BaseInteractionParams,
|
||||||
BaseSlashCommandParams,
|
BaseSlashCommandParams,
|
||||||
BaseSlashCommandReturnType
|
BaseSlashCommandReturnType
|
||||||
} from '../types/interactionTypes';
|
} from '../../types/interactionTypes';
|
||||||
import { Validator, ValidatorParams } from '../types/utilTypes';
|
import { Validator, ValidatorParams } from '../../types/utilTypes';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
abstract class BaseInteraction {
|
abstract class BaseInteraction {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import Discord, { Client } from 'discord.js';
|
import Discord, { Client } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../services/logger';
|
||||||
|
|
||||||
export const createClient = async ({ executionId }: { executionId: string }): Promise<Client> => {
|
export const createClient = async ({ executionId }: { executionId: string }): Promise<Client> => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerModule.child({
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
import { IPRotationConfig, Player } from 'discord-player';
|
import { IPRotationConfig, Player } from 'discord-player';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../services/logger';
|
||||||
import { CreatePlayerParams } from '../../types/playerTypes';
|
import { CreatePlayerParams } from '../../types/playerTypes';
|
||||||
|
|
||||||
export const createPlayer = async ({ client, executionId }: CreatePlayerParams): Promise<Player> => {
|
export const createPlayer = async ({ client, executionId }: CreatePlayerParams): Promise<Player> => {
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
import { usePrismaClient } from './prismaClient';
|
||||||
|
import loggerModule from './logger';
|
||||||
|
import { Logger } from 'pino';
|
||||||
|
import { Interaction, MessageComponentInteraction } from 'discord.js';
|
||||||
|
|
||||||
|
const prisma = usePrismaClient();
|
||||||
|
|
||||||
|
function getLogger(executionId: string, interaction?: Interaction | MessageComponentInteraction): Logger {
|
||||||
|
return loggerModule.child({
|
||||||
|
module: 'databaseService',
|
||||||
|
name: 'guildDatabaseService',
|
||||||
|
executionId: executionId,
|
||||||
|
shardId: interaction?.guild?.shardId ?? 'N/A'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export type GuildConfig = {
|
||||||
|
defaultVolume?: number;
|
||||||
|
locale?: string;
|
||||||
|
actionPermissions?: Record<string, string[]>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const guildDatabaseClient = {
|
||||||
|
async getGuildConfig(
|
||||||
|
guildId: string,
|
||||||
|
executionId: string,
|
||||||
|
interaction?: Interaction | MessageComponentInteraction
|
||||||
|
) {
|
||||||
|
const logger = getLogger(executionId, interaction);
|
||||||
|
logger.debug(`Getting config for guild ${guildId} from database.`);
|
||||||
|
const config = await prisma.guildConfig.findUnique({
|
||||||
|
where: { guildId: guildId }
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!config) {
|
||||||
|
logger.debug(`No config found for guild ${guildId}.`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = {
|
||||||
|
...config,
|
||||||
|
actionPermissions: deserializeActionPermissions(config.actionPermissions ?? '')
|
||||||
|
};
|
||||||
|
|
||||||
|
return response;
|
||||||
|
},
|
||||||
|
|
||||||
|
async createOrUpdateGuildConfig(
|
||||||
|
executionId: string,
|
||||||
|
guildId: string,
|
||||||
|
configData: GuildConfig,
|
||||||
|
interaction?: Interaction | MessageComponentInteraction
|
||||||
|
) {
|
||||||
|
const logger = getLogger(executionId, interaction);
|
||||||
|
logger.debug(`Creating or updating guild config for guild ${guildId} in database.`);
|
||||||
|
|
||||||
|
const validConfig = validateGuildConfig(logger, configData);
|
||||||
|
return await prisma.guildConfig.upsert({
|
||||||
|
where: { guildId: guildId },
|
||||||
|
update: {
|
||||||
|
...validConfig
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
guildId: guildId,
|
||||||
|
...validConfig
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
async deleteGuildConfig(
|
||||||
|
executionId: string,
|
||||||
|
guildId: string,
|
||||||
|
interaction?: Interaction | MessageComponentInteraction
|
||||||
|
) {
|
||||||
|
const logger = getLogger(executionId, interaction);
|
||||||
|
logger.debug(`Deleting guild ${guildId} and config from database.`);
|
||||||
|
|
||||||
|
return await prisma.guildConfig.delete({
|
||||||
|
where: { guildId: guildId }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export function validateGuildConfig(logger: Logger, configData: GuildConfig) {
|
||||||
|
if (configData.defaultVolume && (configData.defaultVolume < 0 || configData.defaultVolume > 100)) {
|
||||||
|
logger.debug(`defaultVolume ${configData.defaultVolume} is not between 0 and 100`);
|
||||||
|
throw new Error('defaultVolume must be between 0 and 100');
|
||||||
|
}
|
||||||
|
|
||||||
|
// get available locale from i18next?
|
||||||
|
if (configData.locale && !['en-US', 'no', 'ro', 'en-ES'].includes(configData.locale)) {
|
||||||
|
logger.debug(`locale ${configData.locale} is not in list of available locales`);
|
||||||
|
throw new Error(`locale ${configData.locale} is not in list of available locales`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: validate actionPermissions
|
||||||
|
|
||||||
|
const validConfig = {
|
||||||
|
defaultVolume: configData.defaultVolume,
|
||||||
|
locale: configData.locale,
|
||||||
|
actionPermissions: serializeActionPermissions(configData.actionPermissions ?? {})
|
||||||
|
};
|
||||||
|
|
||||||
|
return validConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
function serializeActionPermissions(permissions: Record<string, string[]>): string {
|
||||||
|
return JSON.stringify(permissions);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deserializeActionPermissions(serializedPermissions: string): Record<string, string[]> {
|
||||||
|
return JSON.parse(serializedPermissions);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default guildDatabaseClient;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
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';
|
||||||
|
|
||||||
// Retrieve logger options from config
|
// Retrieve logger options from config
|
||||||
const loggerOptions: CustomLoggerOptions = config.get('loggerOptions');
|
const loggerOptions: CustomLoggerOptions = config.get('loggerOptions');
|
||||||
@@ -2,7 +2,7 @@ import { PrismaClient } from '@prisma/client';
|
|||||||
|
|
||||||
let prisma: PrismaClient | undefined;
|
let prisma: PrismaClient | undefined;
|
||||||
|
|
||||||
export const getPrismaClient = () => {
|
export const usePrismaClient = () => {
|
||||||
if (!prisma) {
|
if (!prisma) {
|
||||||
prisma = new PrismaClient();
|
prisma = new PrismaClient();
|
||||||
}
|
}
|
||||||
File renamed without changes.
@@ -1,6 +1,6 @@
|
|||||||
import { QueueRepeatMode } from 'discord-player';
|
import { QueueRepeatMode } from 'discord-player';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { EmbedOptions } from '../types/configTypes';
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
|
||||||
export function formatDuration(durationMs: number): string {
|
export function formatDuration(durationMs: number): string {
|
||||||
const durationDate: Date = new Date(0);
|
const durationDate: Date = new Date(0);
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../services/logger';
|
||||||
import { GetUptimeFormattedParams } from '../../types/utilTypes';
|
import { GetUptimeFormattedParams } from '../../types/utilTypes';
|
||||||
import { formatDuration } from '../../common/formattingUtils';
|
import { formatDuration } from './formattingUtils';
|
||||||
|
|
||||||
export const getUptimeFormatted = ({ executionId }: GetUptimeFormattedParams): string => {
|
export const getUptimeFormatted = ({ executionId }: GetUptimeFormattedParams): string => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerModule.child({
|
||||||
@@ -13,8 +13,10 @@ import { lstatSync, readdirSync } from 'fs';
|
|||||||
import i18n from 'i18next';
|
import i18n from 'i18next';
|
||||||
import i18nextFsBackend, { FsBackendOptions } from 'i18next-fs-backend';
|
import i18nextFsBackend, { FsBackendOptions } from 'i18next-fs-backend';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
export const translatorInstance = i18n.createInstance();
|
export const translatorInstance = i18n.createInstance();
|
||||||
const localeDir = join(__dirname, '..', '..', 'locales');
|
const localeDir = join(__dirname, '..', '..', '..', 'locales');
|
||||||
|
|
||||||
translatorInstance.use(i18nextFsBackend).init<FsBackendOptions>({
|
translatorInstance.use(i18nextFsBackend).init<FsBackendOptions>({
|
||||||
initImmediate: false,
|
initImmediate: false,
|
||||||
fallbackLng: 'en',
|
fallbackLng: 'en',
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { GuildQueueStatisticsMetadata } from 'discord-player';
|
import { GuildQueueStatisticsMetadata } from 'discord-player';
|
||||||
import { Client, Guild } from 'discord.js';
|
import { Client, Guild } from 'discord.js';
|
||||||
import { PlayerStatistics, ShardPlayerStatistics } from '../types/utilTypes';
|
import { PlayerStatistics, ShardPlayerStatistics } from '../../types/utilTypes';
|
||||||
|
|
||||||
async function fetchGuildsPerShard(client?: Client): Promise<Map<string, Guild>[]> {
|
async function fetchGuildsPerShard(client?: Client): Promise<Map<string, Guild>[]> {
|
||||||
if (!client || !client.shard) {
|
if (!client || !client.shard) {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import osu from 'node-os-utils';
|
import osu from 'node-os-utils';
|
||||||
import { ExtendedClient } from '../types/clientTypes';
|
import { ExtendedClient } from '../../types/clientTypes';
|
||||||
import { fetchTotalGuildStatistics, fetchTotalPlayerStatistics } from '../utils/shardUtils';
|
import { fetchTotalGuildStatistics, fetchTotalPlayerStatistics } from './shardUtils';
|
||||||
import { getUptimeFormatted } from '../utils/system/getUptimeFormatted';
|
import { getUptimeFormatted } from './getUptimeFormatted';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
export async function getBotStatistics(
|
export async function getBotStatistics(
|
||||||
+28
-32
@@ -9,11 +9,11 @@ import {
|
|||||||
VoiceChannel
|
VoiceChannel
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { InteractionValidationError } from '../../classes/interactions';
|
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 { useServerTranslator } from '../../common/localeUtil';
|
import { useServerTranslator } from '../utils/localeUtil';
|
||||||
|
|
||||||
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) => {
|
||||||
@@ -32,7 +32,7 @@ export const checkVoicePermissionJoinAndTalk = async ({ interaction, executionId
|
|||||||
interaction.type === InteractionType.ApplicationCommand ? interaction.commandName : interaction.customId;
|
interaction.type === InteractionType.ApplicationCommand ? interaction.commandName : interaction.customId;
|
||||||
|
|
||||||
if (channel instanceof VoiceChannel && (!channel.joinable || !channel.speakable)) {
|
if (channel instanceof VoiceChannel && (!channel.joinable || !channel.speakable)) {
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -49,7 +49,8 @@ export const checkVoicePermissionJoinAndTalk = async ({ interaction, executionId
|
|||||||
: interaction.user.username,
|
: interaction.user.username,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
@@ -83,34 +84,29 @@ export const checkChannelPermissionViewable = async ({ interaction, executionId
|
|||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// we can still send ephemeral replies in channels we can't view, so sending message to user instead
|
logger.debug(
|
||||||
if (!interaction.deferred && !interaction.replied) {
|
'Sending ephemeral message in channel about insufficient permissions to send message in channel.'
|
||||||
logger.debug('Interaction was not deferred or replied to yet. Deferring reply as ephemeral.');
|
);
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.reply({
|
||||||
|
embeds: [
|
||||||
logger.debug(
|
new EmbedBuilder()
|
||||||
'Sending ephemeral message in channel about insufficient permissions to send message in channel.'
|
.setDescription(
|
||||||
);
|
translator('validation.cannotSendMessageInChannel', {
|
||||||
await interaction.editReply({
|
icon: embedOptions.icons.warning,
|
||||||
embeds: [
|
channel: `<#${channel.id}>`
|
||||||
new EmbedBuilder()
|
|
||||||
.setDescription(
|
|
||||||
translator('validation.cannotSendMessageInChannel', {
|
|
||||||
icon: embedOptions.icons.warning,
|
|
||||||
channel: `<#${channel.id}>`
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.setColor(embedOptions.colors.warning)
|
|
||||||
.setFooter({
|
|
||||||
text:
|
|
||||||
interaction.member instanceof GuildMember
|
|
||||||
? interaction.member.nickname || interaction.user.username
|
|
||||||
: interaction.user.username,
|
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
|
||||||
})
|
})
|
||||||
]
|
)
|
||||||
});
|
.setColor(embedOptions.colors.warning)
|
||||||
}
|
.setFooter({
|
||||||
|
text:
|
||||||
|
interaction.member instanceof GuildMember
|
||||||
|
? interaction.member.nickname || interaction.user.username
|
||||||
|
: interaction.user.username,
|
||||||
|
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||||
|
})
|
||||||
|
],
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
if (error.message == 'The reply to this interaction has already been sent or deferred.') {
|
if (error.message == 'The reply to this interaction has already been sent or deferred.') {
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
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 { 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 { useServerTranslator } from '../../common/localeUtil';
|
import { useServerTranslator } from '../utils/localeUtil';
|
||||||
import { formatSlashCommand } from '../../common/formattingUtils';
|
import { formatSlashCommand } from '../utils/formattingUtils';
|
||||||
|
|
||||||
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) => {
|
||||||
@@ -23,7 +23,7 @@ export const checkQueueExists = async ({ interaction, queue, executionId }: Vali
|
|||||||
interaction.type === InteractionType.ApplicationCommand ? interaction.commandName : interaction.customId;
|
interaction.type === InteractionType.ApplicationCommand ? interaction.commandName : interaction.customId;
|
||||||
|
|
||||||
if (!queue) {
|
if (!queue) {
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -40,7 +40,8 @@ export const checkQueueExists = async ({ interaction, queue, executionId }: Vali
|
|||||||
: interaction.user.username,
|
: interaction.user.username,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.debug(`User tried to use command '${interactionIdentifier}' but there was no queue.`);
|
logger.debug(`User tried to use command '${interactionIdentifier}' but there was no queue.`);
|
||||||
@@ -64,7 +65,7 @@ export const checkHistoryExists = async ({ interaction, history, executionId }:
|
|||||||
interaction.type === InteractionType.ApplicationCommand ? interaction.commandName : interaction.customId;
|
interaction.type === InteractionType.ApplicationCommand ? interaction.commandName : interaction.customId;
|
||||||
|
|
||||||
if (!history) {
|
if (!history) {
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -81,7 +82,8 @@ export const checkHistoryExists = async ({ interaction, history, executionId }:
|
|||||||
: interaction.user.username,
|
: interaction.user.username,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.debug(`User tried to use command '${interactionIdentifier}' but there was no history.`);
|
logger.debug(`User tried to use command '${interactionIdentifier}' but there was no history.`);
|
||||||
@@ -105,7 +107,7 @@ export const checkQueueCurrentTrack = async ({ interaction, queue, executionId }
|
|||||||
interaction.type === InteractionType.ApplicationCommand ? interaction.commandName : interaction.customId;
|
interaction.type === InteractionType.ApplicationCommand ? interaction.commandName : interaction.customId;
|
||||||
|
|
||||||
if (queue && !queue.currentTrack) {
|
if (queue && !queue.currentTrack) {
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -122,7 +124,8 @@ export const checkQueueCurrentTrack = async ({ interaction, queue, executionId }
|
|||||||
: interaction.user.username,
|
: interaction.user.username,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.debug(`User tried to use command '${interactionIdentifier}' but there was no current track.`);
|
logger.debug(`User tried to use command '${interactionIdentifier}' but there was no current track.`);
|
||||||
@@ -146,7 +149,7 @@ export const checkQueueEmpty = async ({ interaction, queue, executionId }: Valid
|
|||||||
interaction.type === InteractionType.ApplicationCommand ? interaction.commandName : interaction.customId;
|
interaction.type === InteractionType.ApplicationCommand ? interaction.commandName : interaction.customId;
|
||||||
|
|
||||||
if (queue && queue.tracks.data.length === 0) {
|
if (queue && queue.tracks.data.length === 0) {
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -163,7 +166,8 @@ export const checkQueueEmpty = async ({ interaction, queue, executionId }: Valid
|
|||||||
: interaction.user.username,
|
: interaction.user.username,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.debug(`User tried to use command '${interactionIdentifier}' but there was no tracks in the queue.`);
|
logger.debug(`User tried to use command '${interactionIdentifier}' but there was no tracks in the queue.`);
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../services/logger';
|
||||||
import { TransformQueryParams } from '../../types/utilTypes';
|
import { TransformQueryParams } from '../../types/utilTypes';
|
||||||
|
|
||||||
export const transformQuery = ({ query, executionId }: TransformQueryParams) => {
|
export const transformQuery = ({ query, executionId }: TransformQueryParams) => {
|
||||||
+7
-6
@@ -1,12 +1,12 @@
|
|||||||
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 { 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 { useServerTranslator } from '../../common/localeUtil';
|
import { useServerTranslator } from '../utils/localeUtil';
|
||||||
import { formatSlashCommand } from '../../common/formattingUtils';
|
import { formatSlashCommand } from '../utils/formattingUtils';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const systemOptions: SystemOptions = config.get('systemOptions');
|
const systemOptions: SystemOptions = config.get('systemOptions');
|
||||||
@@ -24,7 +24,7 @@ export const checkValidGuildId = async ({ interaction, executionId }: ValidatorP
|
|||||||
interaction.type === InteractionType.ApplicationCommand ? interaction.commandName : interaction.customId;
|
interaction.type === InteractionType.ApplicationCommand ? interaction.commandName : interaction.customId;
|
||||||
|
|
||||||
if (interaction.guildId && !systemOptions.systemGuildIds.includes(interaction.guildId)) {
|
if (interaction.guildId && !systemOptions.systemGuildIds.includes(interaction.guildId)) {
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -34,7 +34,8 @@ export const checkValidGuildId = async ({ interaction, executionId }: ValidatorP
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(embedOptions.colors.warning)
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
+9
-7
@@ -1,11 +1,11 @@
|
|||||||
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 { 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 { useServerTranslator } from '../../common/localeUtil';
|
import { useServerTranslator } from '../utils/localeUtil';
|
||||||
|
|
||||||
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) => {
|
||||||
@@ -22,7 +22,7 @@ export const checkInVoiceChannel = async ({ interaction, executionId }: Validato
|
|||||||
interaction.type === InteractionType.ApplicationCommand ? interaction.commandName : interaction.customId;
|
interaction.type === InteractionType.ApplicationCommand ? interaction.commandName : interaction.customId;
|
||||||
|
|
||||||
if (interaction.member instanceof GuildMember && !interaction.member.voice.channel) {
|
if (interaction.member instanceof GuildMember && !interaction.member.voice.channel) {
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -35,7 +35,8 @@ export const checkInVoiceChannel = async ({ interaction, executionId }: Validato
|
|||||||
text: interaction.member.nickname || interaction.user.username,
|
text: interaction.member.nickname || interaction.user.username,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.debug(`User tried to use command '${interactionIdentifier}' but was not in a voice channel.`);
|
logger.debug(`User tried to use command '${interactionIdentifier}' but was not in a voice channel.`);
|
||||||
@@ -67,7 +68,7 @@ export const checkSameVoiceChannel = async ({ interaction, queue, executionId }:
|
|||||||
interaction.member instanceof GuildMember &&
|
interaction.member instanceof GuildMember &&
|
||||||
interaction.member.voice.channel?.id !== queue.dispatcher.channel.id
|
interaction.member.voice.channel?.id !== queue.dispatcher.channel.id
|
||||||
) {
|
) {
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -81,7 +82,8 @@ export const checkSameVoiceChannel = async ({ interaction, queue, executionId }:
|
|||||||
text: interaction.member.nickname || interaction.user.username,
|
text: interaction.member.nickname || interaction.user.username,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.debug(`User tried to use command '${interactionIdentifier}' but was not in the same voice channel.`);
|
logger.debug(`User tried to use command '${interactionIdentifier}' but was not in the same voice channel.`);
|
||||||
@@ -1,7 +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 { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../../common/services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.Debug,
|
name: Events.Debug,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ 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 '../../common/services/logger';
|
||||||
import { ExtendedClient } from '../../types/clientTypes';
|
import { ExtendedClient } from '../../types/clientTypes';
|
||||||
import { EmbedOptions, SystemOptions } from '../../types/configTypes';
|
import { EmbedOptions, SystemOptions } from '../../types/configTypes';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +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 { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../../common/services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.Error,
|
name: Events.Error,
|
||||||
|
|||||||
@@ -1,7 +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 { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../../common/services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.GuildCreate,
|
name: Events.GuildCreate,
|
||||||
|
|||||||
@@ -1,7 +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 { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../../common/services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.GuildDelete,
|
name: Events.GuildDelete,
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ 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 '../../common/services/logger';
|
||||||
import { ExtendedClient } from '../../types/clientTypes';
|
import { ExtendedClient } from '../../types/clientTypes';
|
||||||
import { EmbedOptions, LoadTestOptions, SystemOptions } from '../../types/configTypes';
|
import { EmbedOptions, LoadTestOptions, SystemOptions } from '../../types/configTypes';
|
||||||
import { postBotStats } from '../../utils/other/postBotStats';
|
import { postBotStats } from '../../startup/postBotStats';
|
||||||
import { startLoadTest } from '../../utils/other/startLoadTest';
|
import { startLoadTest } from '../../startup/startLoadTest';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const systemOptions: SystemOptions = config.get('systemOptions');
|
const systemOptions: SystemOptions = config.get('systemOptions');
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ 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 '../../common/services/logger';
|
||||||
import { ExtendedClient } from '../../types/clientTypes';
|
import { ExtendedClient } from '../../types/clientTypes';
|
||||||
import { EmbedOptions, SystemOptions } from '../../types/configTypes';
|
import { EmbedOptions, SystemOptions } from '../../types/configTypes';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +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 { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../../common/services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.Warn,
|
name: Events.Warn,
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import {
|
|||||||
} from 'discord.js';
|
} 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 { CustomError } from '../../classes/interactions';
|
import { CustomError } from '../../common/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 '../../common/services/logger';
|
||||||
import { ExtendedClient } from '../../types/clientTypes';
|
import { ExtendedClient } from '../../types/clientTypes';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
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 '../../common/services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'debug',
|
name: 'debug',
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ 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 '../../common/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';
|
||||||
import { useLanguageTranslator } from '../../common/localeUtil';
|
import { useLanguageTranslator } from '../../common/utils/localeUtil';
|
||||||
|
|
||||||
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,6 +1,6 @@
|
|||||||
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 '../../common/services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'error',
|
name: 'error',
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ 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 '../../common/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';
|
||||||
import { useLanguageTranslator } from '../../common/localeUtil';
|
import { useLanguageTranslator } from '../../common/utils/localeUtil';
|
||||||
|
|
||||||
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,6 +1,6 @@
|
|||||||
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
|
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
|
||||||
import { randomUUID as uuidv4 } from 'node:crypto';
|
import { randomUUID as uuidv4 } from 'node:crypto';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../../common/services/logger';
|
||||||
import { Track } from 'discord-player';
|
import { Track } from 'discord-player';
|
||||||
import { Snowflake } from 'discord.js';
|
import { Snowflake } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import { Track, TrackSkipReason } from 'discord-player';
|
|||||||
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 '../../common/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';
|
||||||
import { useLanguageTranslator } from '../../common/localeUtil';
|
import { useLanguageTranslator } from '../../common/utils/localeUtil';
|
||||||
|
|
||||||
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,9 +1,9 @@
|
|||||||
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
|
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
|
||||||
import { useLanguageTranslator } from '../../common/localeUtil';
|
import { useLanguageTranslator } from '../../common/utils/localeUtil';
|
||||||
import { EmbedBuilder, LocaleString } from 'discord.js';
|
import { EmbedBuilder, LocaleString } from 'discord.js';
|
||||||
import { EmbedOptions } from '../../types/configTypes';
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
import { randomUUID as uuidv4 } from 'node:crypto';
|
import { randomUUID as uuidv4 } from 'node:crypto';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../../common/services/logger';
|
||||||
import { Track } from 'discord-player';
|
import { Track } from 'discord-player';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import config from 'config';
|
import config from 'config';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Track } from 'discord-player';
|
import { Track } from 'discord-player';
|
||||||
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 '../../common/services/logger';
|
||||||
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
|
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
|
||||||
import { User } from 'discord.js';
|
import { User } from 'discord.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
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 '../../common/services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'uncaughtException',
|
name: 'uncaughtException',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
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 '../../common/services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'unhandledRejection',
|
name: 'unhandledRejection',
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { AutocompleteInteraction } from 'discord.js';
|
import { AutocompleteInteraction } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { BaseAutocompleteInteraction } from '../classes/interactions';
|
import { BaseAutocompleteInteraction } from '../common/classes/interactions';
|
||||||
import loggerModule from '../services/logger';
|
import loggerModule from '../common/services/logger';
|
||||||
import { ExtendedClient } from '../types/clientTypes';
|
import { ExtendedClient } from '../types/clientTypes';
|
||||||
|
|
||||||
export const handleAutocomplete = async (
|
export const handleAutocomplete = async (
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { ChatInputCommandInteraction } from 'discord.js';
|
import { ChatInputCommandInteraction } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { BaseSlashCommandInteraction } from '../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../common/classes/interactions';
|
||||||
import loggerModule from '../services/logger';
|
import loggerModule from '../common/services/logger';
|
||||||
import { ExtendedClient } from '../types/clientTypes';
|
import { ExtendedClient } from '../types/clientTypes';
|
||||||
import { checkChannelPermissionViewable } from '../utils/validation/permissionValidator';
|
import { checkChannelPermissionViewable } from '../common/validation/permissionValidator';
|
||||||
|
|
||||||
export const handleCommand = async (
|
export const handleCommand = async (
|
||||||
interaction: ChatInputCommandInteraction,
|
interaction: ChatInputCommandInteraction,
|
||||||
@@ -17,9 +17,6 @@ export const handleCommand = async (
|
|||||||
executionId: executionId
|
executionId: executionId
|
||||||
});
|
});
|
||||||
|
|
||||||
await interaction.deferReply();
|
|
||||||
logger.debug('Interaction deferred.');
|
|
||||||
|
|
||||||
await checkChannelPermissionViewable({ interaction, executionId });
|
await checkChannelPermissionViewable({ interaction, executionId });
|
||||||
|
|
||||||
const slashCommand: BaseSlashCommandInteraction = client.slashCommandInteractions!.get(
|
const slashCommand: BaseSlashCommandInteraction = client.slashCommandInteractions!.get(
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { MessageComponentInteraction } from 'discord.js';
|
import { MessageComponentInteraction } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { BaseComponentInteraction } from '../classes/interactions';
|
import { BaseComponentInteraction } from '../common/classes/interactions';
|
||||||
import loggerModule from '../services/logger';
|
import loggerModule from '../common/services/logger';
|
||||||
import { ExtendedClient } from '../types/clientTypes';
|
import { ExtendedClient } from '../types/clientTypes';
|
||||||
import { checkChannelPermissionViewable } from '../utils/validation/permissionValidator';
|
import { checkChannelPermissionViewable } from '../common/validation/permissionValidator';
|
||||||
|
|
||||||
export const handleComponent = async (
|
export const handleComponent = async (
|
||||||
interaction: MessageComponentInteraction,
|
interaction: MessageComponentInteraction,
|
||||||
@@ -17,9 +17,6 @@ export const handleComponent = async (
|
|||||||
executionId: executionId
|
executionId: executionId
|
||||||
});
|
});
|
||||||
|
|
||||||
await interaction.deferReply();
|
|
||||||
logger.debug('Interaction deferred.');
|
|
||||||
|
|
||||||
const componentId: string = interactionIdentifier.split('_')[0];
|
const componentId: string = interactionIdentifier.split('_')[0];
|
||||||
const referenceId: string = interactionIdentifier.split('_')[1];
|
const referenceId: string = interactionIdentifier.split('_')[1];
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import {
|
|||||||
MessageComponentInteraction
|
MessageComponentInteraction
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { CustomError, InteractionValidationError } from '../classes/interactions';
|
import { CustomError, InteractionValidationError } from '../common/classes/interactions';
|
||||||
import loggerModule from '../services/logger';
|
import loggerModule from '../common/services/logger';
|
||||||
import { BotOptions, EmbedOptions } from '../types/configTypes';
|
import { BotOptions, EmbedOptions } from '../types/configTypes';
|
||||||
import { useServerTranslator } from '../common/localeUtil';
|
import { useServerTranslator } from '../common/utils/localeUtil';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const botOptions: BotOptions = config.get('botOptions');
|
const botOptions: BotOptions = config.get('botOptions');
|
||||||
@@ -62,7 +62,8 @@ export const handleError = async (
|
|||||||
return;
|
return;
|
||||||
case false:
|
case false:
|
||||||
logger.debug('Responding with error embed');
|
logger.debug('Responding with error embed');
|
||||||
return await interaction.editReply(errorReply);
|
interaction.deferred ? await interaction.editReply(errorReply) : await interaction.reply(errorReply);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else if (interaction instanceof MessageComponentInteraction) {
|
} else if (interaction instanceof MessageComponentInteraction) {
|
||||||
switch (interaction.replied) {
|
switch (interaction.replied) {
|
||||||
@@ -74,7 +75,8 @@ export const handleError = async (
|
|||||||
return;
|
return;
|
||||||
case false:
|
case false:
|
||||||
logger.debug('Responding with error embed');
|
logger.debug('Responding with error embed');
|
||||||
return await interaction.editReply(errorReply);
|
interaction.deferred ? await interaction.editReply(errorReply) : await interaction.reply(errorReply);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.debug(
|
logger.debug(
|
||||||
|
|||||||
+3
-3
@@ -6,8 +6,8 @@ import { Client, Shard, ShardEvents, ShardingManager, ShardingManagerOptions } f
|
|||||||
import { randomUUID as uuidv4 } from 'node:crypto';
|
import { randomUUID as uuidv4 } from 'node:crypto';
|
||||||
import { exec } from 'child_process';
|
import { exec } from 'child_process';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from './services/logger';
|
import loggerModule from './common/services/logger';
|
||||||
import { getPrismaClient } from './services/prismaClient';
|
import { usePrismaClient } from './common/services/prismaClient';
|
||||||
const shardingOptions: ShardingManagerOptions = 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', {
|
||||||
@@ -27,7 +27,7 @@ manager.on('shardCreate', (shard: Shard) => {
|
|||||||
shardId: 'manager'
|
shardId: 'manager'
|
||||||
});
|
});
|
||||||
|
|
||||||
const prisma = getPrismaClient();
|
const prisma = usePrismaClient();
|
||||||
|
|
||||||
process.on('SIGINT', async () => {
|
process.on('SIGINT', async () => {
|
||||||
await prisma.$disconnect();
|
await prisma.$disconnect();
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ 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 { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { BaseAutocompleteInteraction } from '../../classes/interactions';
|
import { BaseAutocompleteInteraction } from '../../common/classes/interactions';
|
||||||
import { getTrackName, isQueryTooShort, shouldUseLastQuery } from '../../common/autocompleteUtils';
|
import { getTrackName, isQueryTooShort, shouldUseLastQuery } from '../../common/utils/autocompleteUtils';
|
||||||
import { BaseAutocompleteParams, BaseAutocompleteReturnType, RecentQuery } from '../../types/interactionTypes';
|
import { BaseAutocompleteParams, BaseAutocompleteReturnType, RecentQuery } from '../../types/interactionTypes';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { useUserTranslator } from '../../common/localeUtil';
|
import { useUserTranslator } from '../../common/utils/localeUtil';
|
||||||
class LyricsAutocomplete extends BaseAutocompleteInteraction {
|
class LyricsAutocomplete extends BaseAutocompleteInteraction {
|
||||||
private recentQueries = new Map<string, RecentQuery>();
|
private recentQueries = new Map<string, RecentQuery>();
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
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 { BaseAutocompleteInteraction } from '../../classes/interactions';
|
import { BaseAutocompleteInteraction } from '../../common/classes/interactions';
|
||||||
import { getTrackName, isQueryTooShort, shouldUseLastQuery } from '../../common/autocompleteUtils';
|
import { getTrackName, isQueryTooShort, shouldUseLastQuery } from '../../common/utils/autocompleteUtils';
|
||||||
import { BaseAutocompleteParams, BaseAutocompleteReturnType, RecentQuery } from '../../types/interactionTypes';
|
import { BaseAutocompleteParams, BaseAutocompleteReturnType, RecentQuery } from '../../types/interactionTypes';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { useUserTranslator } from '../../common/localeUtil';
|
import { useUserTranslator } from '../../common/utils/localeUtil';
|
||||||
import { transformQuery } from '../../utils/validation/searchQueryValidator';
|
import { transformQuery } from '../../common/validation/searchQueryValidator';
|
||||||
|
|
||||||
class PlayAutocomplete extends BaseAutocompleteInteraction {
|
class PlayAutocomplete extends BaseAutocompleteInteraction {
|
||||||
private recentQueries = new Map<string, RecentQuery>();
|
private recentQueries = new Map<string, RecentQuery>();
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, MessageComponentInteraction } from 'discord.js';
|
import { EmbedBuilder, MessageComponentInteraction } from 'discord.js';
|
||||||
import { BaseComponentInteraction } from '../../classes/interactions';
|
import { BaseComponentInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { useServerTranslator } from '../../common/localeUtil';
|
import { useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils';
|
import { formatRepeatModeDetailed } from '../../common/utils/formattingUtils';
|
||||||
|
|
||||||
class ActionPauseResumeButton extends BaseComponentInteraction {
|
class ActionPauseResumeButton extends BaseComponentInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -27,10 +27,6 @@ class ActionPauseResumeButton extends BaseComponentInteraction {
|
|||||||
checkQueueCurrentTrack
|
checkQueueCurrentTrack
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!queue || (queue.tracks.data.length === 0 && !queue.currentTrack)) {
|
|
||||||
return await this.handleNoQueue(interaction, translator);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (queue.currentTrack!.id !== referenceId) {
|
if (queue.currentTrack!.id !== referenceId) {
|
||||||
return await this.handleAlreadySkipped(interaction, translator);
|
return await this.handleAlreadySkipped(interaction, translator);
|
||||||
}
|
}
|
||||||
@@ -48,24 +44,8 @@ class ActionPauseResumeButton extends BaseComponentInteraction {
|
|||||||
return await this.handleSuccess(interaction, currentTrack, queue, translator);
|
return await this.handleSuccess(interaction, currentTrack, queue, translator);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleNoQueue(interaction: MessageComponentInteraction, translator: TFunction) {
|
|
||||||
return await interaction.editReply({
|
|
||||||
embeds: [
|
|
||||||
new EmbedBuilder()
|
|
||||||
.setDescription(
|
|
||||||
translator('validation.queueNoCurrentTrack', {
|
|
||||||
icon: this.embedOptions.icons.warning,
|
|
||||||
playCommand: formatSlashCommand('play', translator)
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.setColor(this.embedOptions.colors.warning)
|
|
||||||
],
|
|
||||||
components: []
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private async handleAlreadySkipped(interaction: MessageComponentInteraction, translator: TFunction) {
|
private async handleAlreadySkipped(interaction: MessageComponentInteraction, translator: TFunction) {
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -75,7 +55,8 @@ class ActionPauseResumeButton extends BaseComponentInteraction {
|
|||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
],
|
],
|
||||||
components: []
|
components: [],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +79,7 @@ class ActionPauseResumeButton extends BaseComponentInteraction {
|
|||||||
.setThumbnail(track.thumbnail)
|
.setThumbnail(track.thumbnail)
|
||||||
.setColor(this.embedOptions.colors.success);
|
.setColor(this.embedOptions.colors.success);
|
||||||
|
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [successEmbed],
|
embeds: [successEmbed],
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { GuildQueue, GuildQueueHistory, Track, useHistory, useQueue } from 'discord-player';
|
import { GuildQueue, GuildQueueHistory, Track, useHistory, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, MessageComponentInteraction } from 'discord.js';
|
import { EmbedBuilder, MessageComponentInteraction } from 'discord.js';
|
||||||
import { BaseComponentInteraction } from '../../classes/interactions';
|
import { BaseComponentInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { useServerTranslator } from '../../common/localeUtil';
|
import { useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { formatSlashCommand } from '../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|
||||||
class ActionPreviousButton extends BaseComponentInteraction {
|
class ActionPreviousButton extends BaseComponentInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -29,10 +29,6 @@ class ActionPreviousButton extends BaseComponentInteraction {
|
|||||||
checkQueueCurrentTrack
|
checkQueueCurrentTrack
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!queue || (queue.tracks.data.length === 0 && !queue.currentTrack)) {
|
|
||||||
return await this.handleNoQueue(interaction, translator);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (queue.currentTrack!.id !== referenceId) {
|
if (queue.currentTrack!.id !== referenceId) {
|
||||||
return await this.handleAlreadySkipped(interaction, translator);
|
return await this.handleAlreadySkipped(interaction, translator);
|
||||||
}
|
}
|
||||||
@@ -62,7 +58,7 @@ class ActionPreviousButton extends BaseComponentInteraction {
|
|||||||
translator: TFunction
|
translator: TFunction
|
||||||
) {
|
) {
|
||||||
logger.debug('No tracks in history.');
|
logger.debug('No tracks in history.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -72,28 +68,13 @@ class ActionPreviousButton extends BaseComponentInteraction {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private async handleNoQueue(interaction: MessageComponentInteraction, translator: TFunction) {
|
|
||||||
return await interaction.editReply({
|
|
||||||
embeds: [
|
|
||||||
new EmbedBuilder()
|
|
||||||
.setDescription(
|
|
||||||
translator('validation.queueNoCurrentTrack', {
|
|
||||||
icon: this.embedOptions.icons.warning,
|
|
||||||
playCommand: formatSlashCommand('play', translator)
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.setColor(this.embedOptions.colors.warning)
|
|
||||||
],
|
],
|
||||||
components: []
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleAlreadySkipped(interaction: MessageComponentInteraction, translator: TFunction) {
|
private async handleAlreadySkipped(interaction: MessageComponentInteraction, translator: TFunction) {
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -103,7 +84,8 @@ class ActionPreviousButton extends BaseComponentInteraction {
|
|||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
],
|
],
|
||||||
components: []
|
components: [],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +105,7 @@ class ActionPreviousButton extends BaseComponentInteraction {
|
|||||||
.setThumbnail(recoveredTrack.thumbnail)
|
.setThumbnail(recoveredTrack.thumbnail)
|
||||||
.setColor(this.embedOptions.colors.success);
|
.setColor(this.embedOptions.colors.success);
|
||||||
|
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [successEmbed],
|
embeds: [successEmbed],
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, MessageComponentInteraction } from 'discord.js';
|
import { EmbedBuilder, MessageComponentInteraction } from 'discord.js';
|
||||||
import { BaseComponentInteraction } from '../../classes/interactions';
|
import { BaseComponentInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { useServerTranslator } from '../../common/localeUtil';
|
import { useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils';
|
import { formatRepeatModeDetailed } from '../../common/utils/formattingUtils';
|
||||||
|
|
||||||
class ActionSkipButton extends BaseComponentInteraction {
|
class ActionSkipButton extends BaseComponentInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -27,10 +27,6 @@ class ActionSkipButton extends BaseComponentInteraction {
|
|||||||
checkQueueCurrentTrack
|
checkQueueCurrentTrack
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!queue || (queue.tracks.data.length === 0 && !queue.currentTrack)) {
|
|
||||||
return await this.handleNoQueue(interaction, translator);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (queue.currentTrack!.id !== referenceId) {
|
if (queue.currentTrack!.id !== referenceId) {
|
||||||
return await this.handleAlreadySkipped(interaction, translator);
|
return await this.handleAlreadySkipped(interaction, translator);
|
||||||
}
|
}
|
||||||
@@ -43,24 +39,8 @@ class ActionSkipButton extends BaseComponentInteraction {
|
|||||||
return await this.handleSuccess(interaction, skippedTrack, queue, translator);
|
return await this.handleSuccess(interaction, skippedTrack, queue, translator);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleNoQueue(interaction: MessageComponentInteraction, translator: TFunction) {
|
|
||||||
return await interaction.editReply({
|
|
||||||
embeds: [
|
|
||||||
new EmbedBuilder()
|
|
||||||
.setDescription(
|
|
||||||
translator('validation.queueNoCurrentTrack', {
|
|
||||||
icon: this.embedOptions.icons.warning,
|
|
||||||
playCommand: formatSlashCommand('play', translator)
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.setColor(this.embedOptions.colors.warning)
|
|
||||||
],
|
|
||||||
components: []
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private async handleAlreadySkipped(interaction: MessageComponentInteraction, translator: TFunction) {
|
private async handleAlreadySkipped(interaction: MessageComponentInteraction, translator: TFunction) {
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -70,7 +50,8 @@ class ActionSkipButton extends BaseComponentInteraction {
|
|||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
],
|
],
|
||||||
components: []
|
components: [],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +74,7 @@ class ActionSkipButton extends BaseComponentInteraction {
|
|||||||
.setThumbnail(skippedTrack.thumbnail)
|
.setThumbnail(skippedTrack.thumbnail)
|
||||||
.setColor(this.embedOptions.colors.success);
|
.setColor(this.embedOptions.colors.success);
|
||||||
|
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [successEmbed],
|
embeds: [successEmbed],
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { GuildQueue, useQueue } from 'discord-player';
|
import { GuildQueue, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder } from 'discord.js';
|
import { EmbedBuilder } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { BaseComponentInteraction } from '../../classes/interactions';
|
import { BaseComponentInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { useServerTranslator } from '../../common/localeUtil';
|
import { useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
|
|
||||||
class FiltersDisableButtonComponent extends BaseComponentInteraction {
|
class FiltersDisableButtonComponent extends BaseComponentInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -28,7 +28,7 @@ class FiltersDisableButtonComponent extends BaseComponentInteraction {
|
|||||||
this.resetFilters(queue, logger);
|
this.resetFilters(queue, logger);
|
||||||
|
|
||||||
logger.debug('Responding with success embed.');
|
logger.debug('Responding with success embed.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedUserAuthor(interaction))
|
.setAuthor(this.getEmbedUserAuthor(interaction))
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
import { BiquadFilters, EqualizerConfigurationPreset, GuildQueue, QueueFilters, useQueue } from 'discord-player';
|
import { BiquadFilters, EqualizerConfigurationPreset, GuildQueue, QueueFilters, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, Message, StringSelectMenuInteraction } from 'discord.js';
|
import { EmbedBuilder, InteractionResponse, StringSelectMenuInteraction } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { BaseComponentInteraction } from '../../classes/interactions';
|
import { BaseComponentInteraction } from '../../common/classes/interactions';
|
||||||
import {
|
import {
|
||||||
EqualizerFilterOptions,
|
EqualizerFilterOptions,
|
||||||
BiquadFilterOptions,
|
BiquadFilterOptions,
|
||||||
@@ -10,9 +10,9 @@ import {
|
|||||||
FilterOption
|
FilterOption
|
||||||
} from '../../types/configTypes';
|
} from '../../types/configTypes';
|
||||||
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { useServerTranslator } from '../../common/localeUtil';
|
import { useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
||||||
@@ -84,7 +84,7 @@ class FiltersSelectMenuComponent extends BaseComponentInteraction {
|
|||||||
queue: GuildQueue,
|
queue: GuildQueue,
|
||||||
filterType: string,
|
filterType: string,
|
||||||
translator: TFunction
|
translator: TFunction
|
||||||
): Promise<Message> {
|
): Promise<InteractionResponse<boolean>> {
|
||||||
this.addFfmpegNormalizerIfRequired(selectMenuInteraction);
|
this.addFfmpegNormalizerIfRequired(selectMenuInteraction);
|
||||||
this.toggleFfmpegFilters(selectMenuInteraction, queue, logger);
|
this.toggleFfmpegFilters(selectMenuInteraction, queue, logger);
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ class FiltersSelectMenuComponent extends BaseComponentInteraction {
|
|||||||
queue: GuildQueue,
|
queue: GuildQueue,
|
||||||
filterType: string,
|
filterType: string,
|
||||||
translator: TFunction
|
translator: TFunction
|
||||||
): Promise<Message> {
|
): Promise<InteractionResponse<boolean>> {
|
||||||
this.toggleBiquadFilter(selectMenuInteraction, queue, logger);
|
this.toggleBiquadFilter(selectMenuInteraction, queue, logger);
|
||||||
|
|
||||||
logger.debug('Responding with success embed.');
|
logger.debug('Responding with success embed.');
|
||||||
@@ -111,7 +111,7 @@ class FiltersSelectMenuComponent extends BaseComponentInteraction {
|
|||||||
queue: GuildQueue,
|
queue: GuildQueue,
|
||||||
filterType: string,
|
filterType: string,
|
||||||
translator: TFunction
|
translator: TFunction
|
||||||
): Promise<Message> {
|
): Promise<InteractionResponse<boolean>> {
|
||||||
this.toggleEqualizerFilter(selectMenuInteraction, queue, logger);
|
this.toggleEqualizerFilter(selectMenuInteraction, queue, logger);
|
||||||
|
|
||||||
logger.debug('Responding with success embed.');
|
logger.debug('Responding with success embed.');
|
||||||
@@ -198,9 +198,9 @@ class FiltersSelectMenuComponent extends BaseComponentInteraction {
|
|||||||
interaction: StringSelectMenuInteraction,
|
interaction: StringSelectMenuInteraction,
|
||||||
filterType: string,
|
filterType: string,
|
||||||
translator: TFunction
|
translator: TFunction
|
||||||
): Promise<Message> {
|
): Promise<InteractionResponse<boolean>> {
|
||||||
logger.debug('Responding with success embed.');
|
logger.debug('Responding with success embed.');
|
||||||
return interaction.editReply({
|
return interaction.reply({
|
||||||
embeds: [this.buildSuccessEmbed(interaction, filterType, translator)],
|
embeds: [this.buildSuccessEmbed(interaction, filterType, translator)],
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
@@ -277,9 +277,9 @@ class FiltersSelectMenuComponent extends BaseComponentInteraction {
|
|||||||
logger: Logger,
|
logger: Logger,
|
||||||
interaction: StringSelectMenuInteraction,
|
interaction: StringSelectMenuInteraction,
|
||||||
translator: TFunction
|
translator: TFunction
|
||||||
): Promise<Message> {
|
): Promise<InteractionResponse<boolean>> {
|
||||||
logger.debug('Responding with success embed.');
|
logger.debug('Responding with success embed.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedUserAuthor(interaction))
|
.setAuthor(this.getEmbedUserAuthor(interaction))
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { GuildQueue, GuildQueueHistory, Track, useHistory, useQueue } from 'discord-player';
|
import { GuildQueue, GuildQueueHistory, Track, useHistory, useQueue } from 'discord-player';
|
||||||
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkHistoryExists, checkQueueCurrentTrack } from '../../utils/validation/queueValidator';
|
import { checkHistoryExists, checkQueueCurrentTrack } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatSlashCommand } from '../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|
||||||
class BackCommand extends BaseSlashCommandInteraction {
|
class BackCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -73,7 +73,7 @@ class BackCommand extends BaseSlashCommandInteraction {
|
|||||||
translator: TFunction
|
translator: TFunction
|
||||||
) {
|
) {
|
||||||
logger.debug('Specified track position was higher than total tracks.');
|
logger.debug('Specified track position was higher than total tracks.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -85,7 +85,8 @@ class BackCommand extends BaseSlashCommandInteraction {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +112,7 @@ class BackCommand extends BaseSlashCommandInteraction {
|
|||||||
translator: TFunction
|
translator: TFunction
|
||||||
) {
|
) {
|
||||||
logger.debug('No tracks in history.');
|
logger.debug('No tracks in history.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -121,7 +122,8 @@ class BackCommand extends BaseSlashCommandInteraction {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +132,7 @@ class BackCommand extends BaseSlashCommandInteraction {
|
|||||||
interaction: ChatInputCommandInteraction,
|
interaction: ChatInputCommandInteraction,
|
||||||
translator: TFunction
|
translator: TFunction
|
||||||
) {
|
) {
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedUserAuthor(interaction))
|
.setAuthor(this.getEmbedUserAuthor(interaction))
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
StringSelectMenuOptionBuilder
|
StringSelectMenuOptionBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import {
|
import {
|
||||||
BiquadFilterOptions,
|
BiquadFilterOptions,
|
||||||
EqualizerFilterOptions,
|
EqualizerFilterOptions,
|
||||||
@@ -24,9 +24,9 @@ import {
|
|||||||
FilterOption
|
FilterOption
|
||||||
} from '../../types/configTypes';
|
} from '../../types/configTypes';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
||||||
@@ -68,6 +68,9 @@ class FiltersCommand extends BaseSlashCommandInteraction {
|
|||||||
checkQueueCurrentTrack
|
checkQueueCurrentTrack
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
await interaction.deferReply();
|
||||||
|
logger.debug('Interaction deferred.');
|
||||||
|
|
||||||
const filterProvider: string = interaction.options.getString('type') || 'ffmpeg';
|
const filterProvider: string = interaction.options.getString('type') || 'ffmpeg';
|
||||||
|
|
||||||
switch (filterProvider) {
|
switch (filterProvider) {
|
||||||
|
|||||||
@@ -13,9 +13,14 @@ import {
|
|||||||
SlashCommandNumberOption,
|
SlashCommandNumberOption,
|
||||||
SlashCommandStringOption
|
SlashCommandStringOption
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { CommandMetadata, localizeCommand, translatorInstance, useServerTranslator } from '../../common/localeUtil';
|
import {
|
||||||
|
CommandMetadata,
|
||||||
|
localizeCommand,
|
||||||
|
translatorInstance,
|
||||||
|
useServerTranslator
|
||||||
|
} from '../../common/utils/localeUtil';
|
||||||
import { ExtendedClient } from '../../types/clientTypes';
|
import { ExtendedClient } from '../../types/clientTypes';
|
||||||
|
|
||||||
class HelpCommand extends BaseSlashCommandInteraction {
|
class HelpCommand extends BaseSlashCommandInteraction {
|
||||||
@@ -59,7 +64,7 @@ class HelpCommand extends BaseSlashCommandInteraction {
|
|||||||
};
|
};
|
||||||
|
|
||||||
logger.debug('Responding with info embed.');
|
logger.debug('Responding with info embed.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -117,7 +122,7 @@ class HelpCommand extends BaseSlashCommandInteraction {
|
|||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getCommandParams(command: BaseSlashCommandInteraction, locale: LocaleString): string {
|
public getCommandParams(command: BaseSlashCommandInteraction, locale: LocaleString): string {
|
||||||
const commandName = command.data.name;
|
const commandName = command.data.name;
|
||||||
const option = command.data.options[0];
|
const option = command.data.options[0];
|
||||||
|
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ import {
|
|||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkHistoryExists } from '../../utils/validation/queueValidator';
|
import { checkHistoryExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils';
|
import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|
||||||
class HistoryCommand extends BaseSlashCommandInteraction {
|
class HistoryCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -125,7 +125,7 @@ class HistoryCommand extends BaseSlashCommandInteraction {
|
|||||||
};
|
};
|
||||||
|
|
||||||
logger.debug('Responding with info embed.');
|
logger.debug('Responding with info embed.');
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedQueueAuthor(interaction, queue, translator))
|
.setAuthor(this.getEmbedQueueAuthor(interaction, queue, translator))
|
||||||
@@ -169,7 +169,7 @@ class HistoryCommand extends BaseSlashCommandInteraction {
|
|||||||
logger.debug('History exists but there is no current track.');
|
logger.debug('History exists but there is no current track.');
|
||||||
|
|
||||||
logger.debug('Responding with info embed.');
|
logger.debug('Responding with info embed.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedQueueAuthor(interaction, queue, translator))
|
.setAuthor(this.getEmbedQueueAuthor(interaction, queue, translator))
|
||||||
@@ -182,7 +182,8 @@ class HistoryCommand extends BaseSlashCommandInteraction {
|
|||||||
)
|
)
|
||||||
.setFooter(this.getDisplayFullFooterInfo(interaction, history, translator))
|
.setFooter(this.getDisplayFullFooterInfo(interaction, history, translator))
|
||||||
.setColor(this.embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +197,7 @@ class HistoryCommand extends BaseSlashCommandInteraction {
|
|||||||
logger.debug('Specified page was higher than total pages.');
|
logger.debug('Specified page was higher than total pages.');
|
||||||
|
|
||||||
logger.debug('Responding with warning embed.');
|
logger.debug('Responding with warning embed.');
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -207,7 +208,8 @@ class HistoryCommand extends BaseSlashCommandInteraction {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { GuildQueue, useMainPlayer, useQueue } from 'discord-player';
|
import { GuildQueue, useMainPlayer, useQueue } from 'discord-player';
|
||||||
import { ChatInputCommandInteraction, EmbedBuilder, GuildMember, Message, SlashCommandBuilder } from 'discord.js';
|
import { ChatInputCommandInteraction, EmbedBuilder, GuildMember, Message, SlashCommandBuilder } from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { checkVoicePermissionJoinAndTalk } from '../../utils/validation/permissionValidator';
|
import { checkVoicePermissionJoinAndTalk } from '../../common/validation/permissionValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { formatSlashCommand } from '../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
class JoinCommand extends BaseSlashCommandInteraction {
|
class JoinCommand extends BaseSlashCommandInteraction {
|
||||||
@@ -22,6 +22,9 @@ class JoinCommand extends BaseSlashCommandInteraction {
|
|||||||
|
|
||||||
await this.runValidators({ interaction, executionId }, [checkInVoiceChannel, checkVoicePermissionJoinAndTalk]);
|
await this.runValidators({ interaction, executionId }, [checkInVoiceChannel, checkVoicePermissionJoinAndTalk]);
|
||||||
|
|
||||||
|
await interaction.deferReply();
|
||||||
|
logger.debug('Interaction deferred.');
|
||||||
|
|
||||||
const existingQueue = useQueue(interaction.guild!.id);
|
const existingQueue = useQueue(interaction.guild!.id);
|
||||||
|
|
||||||
if (existingQueue) {
|
if (existingQueue) {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { GuildQueue, useQueue } from 'discord-player';
|
import { GuildQueue, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { formatSlashCommand } from '../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|
||||||
class LeaveCommand extends BaseSlashCommandInteraction {
|
class LeaveCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -26,6 +26,9 @@ class LeaveCommand extends BaseSlashCommandInteraction {
|
|||||||
checkQueueExists
|
checkQueueExists
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
await interaction.deferReply();
|
||||||
|
logger.debug('Interaction deferred.');
|
||||||
|
|
||||||
logger.debug('Deleting queue.');
|
logger.debug('Deleting queue.');
|
||||||
this.deleteQueue(queue);
|
this.deleteQueue(queue);
|
||||||
|
|
||||||
|
|||||||
@@ -2,18 +2,18 @@ import { GuildQueue, QueueRepeatMode, useQueue } from 'discord-player';
|
|||||||
import {
|
import {
|
||||||
ChatInputCommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
Message,
|
InteractionResponse,
|
||||||
SlashCommandBuilder,
|
SlashCommandBuilder,
|
||||||
SlashCommandIntegerOption
|
SlashCommandIntegerOption
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatRepeatMode } from '../../common/formattingUtils';
|
import { formatRepeatMode } from '../../common/utils/formattingUtils';
|
||||||
|
|
||||||
class LoopCommand extends BaseSlashCommandInteraction {
|
class LoopCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -74,7 +74,7 @@ class LoopCommand extends BaseSlashCommandInteraction {
|
|||||||
interaction: ChatInputCommandInteraction,
|
interaction: ChatInputCommandInteraction,
|
||||||
currentRepeatMode: QueueRepeatMode,
|
currentRepeatMode: QueueRepeatMode,
|
||||||
translator: TFunction
|
translator: TFunction
|
||||||
): Promise<Message> {
|
): Promise<InteractionResponse<boolean>> {
|
||||||
logger.debug('No repeat mode was provided, responding with current repeat mode.');
|
logger.debug('No repeat mode was provided, responding with current repeat mode.');
|
||||||
|
|
||||||
const repeatModeEmbedIcon =
|
const repeatModeEmbedIcon =
|
||||||
@@ -82,7 +82,7 @@ class LoopCommand extends BaseSlashCommandInteraction {
|
|||||||
const repeatModeEmbedName = formatRepeatMode(currentRepeatMode, translator);
|
const repeatModeEmbedName = formatRepeatMode(currentRepeatMode, translator);
|
||||||
|
|
||||||
logger.debug('Responding with info embed.');
|
logger.debug('Responding with info embed.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -101,11 +101,11 @@ class LoopCommand extends BaseSlashCommandInteraction {
|
|||||||
interaction: ChatInputCommandInteraction,
|
interaction: ChatInputCommandInteraction,
|
||||||
currentRepeatMode: QueueRepeatMode,
|
currentRepeatMode: QueueRepeatMode,
|
||||||
translator: TFunction
|
translator: TFunction
|
||||||
): Promise<Message> {
|
): Promise<InteractionResponse<boolean>> {
|
||||||
const repeatModeEmbedName = formatRepeatMode(currentRepeatMode, translator);
|
const repeatModeEmbedName = formatRepeatMode(currentRepeatMode, translator);
|
||||||
logger.debug(`Loop mode is already set to '${repeatModeEmbedName}'.`);
|
logger.debug(`Loop mode is already set to '${repeatModeEmbedName}'.`);
|
||||||
logger.debug('Responding with warning embed.');
|
logger.debug('Responding with warning embed.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -115,7 +115,8 @@ class LoopCommand extends BaseSlashCommandInteraction {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +127,7 @@ class LoopCommand extends BaseSlashCommandInteraction {
|
|||||||
fromRepeatMode: QueueRepeatMode,
|
fromRepeatMode: QueueRepeatMode,
|
||||||
toRepeatMode: QueueRepeatMode,
|
toRepeatMode: QueueRepeatMode,
|
||||||
translator: TFunction
|
translator: TFunction
|
||||||
): Promise<Message> {
|
): Promise<InteractionResponse<boolean>> {
|
||||||
const newRepeatModeEmbedName = formatRepeatMode(toRepeatMode, translator);
|
const newRepeatModeEmbedName = formatRepeatMode(toRepeatMode, translator);
|
||||||
const getChangedRepeatModeEmbedReply = this.getChangedRepeatModeEmbedReply(
|
const getChangedRepeatModeEmbedReply = this.getChangedRepeatModeEmbedReply(
|
||||||
fromRepeatMode,
|
fromRepeatMode,
|
||||||
@@ -138,7 +139,7 @@ class LoopCommand extends BaseSlashCommandInteraction {
|
|||||||
logger.debug(`Loop mode changed to '${newRepeatModeEmbedName}'.`);
|
logger.debug(`Loop mode changed to '${newRepeatModeEmbedName}'.`);
|
||||||
|
|
||||||
logger.debug('Responding with success embed.');
|
logger.debug('Responding with success embed.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedUserAuthor(interaction))
|
.setAuthor(this.getEmbedUserAuthor(interaction))
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
|
|||||||
import { GuildQueue, Player, QueryType, SearchResult, Track, useMainPlayer, useQueue } from 'discord-player';
|
import { GuildQueue, Player, QueryType, SearchResult, Track, useMainPlayer, useQueue } from 'discord-player';
|
||||||
import { ChatInputCommandInteraction, EmbedBuilder, Message, SlashCommandBuilder } from 'discord.js';
|
import { ChatInputCommandInteraction, EmbedBuilder, Message, SlashCommandBuilder } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
class LyricsCommand extends BaseSlashCommandInteraction {
|
class LyricsCommand extends BaseSlashCommandInteraction {
|
||||||
@@ -38,6 +38,9 @@ class LyricsCommand extends BaseSlashCommandInteraction {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await interaction.deferReply();
|
||||||
|
logger.debug('Interaction deferred.');
|
||||||
|
|
||||||
const geniusSearchQuery: string = this.getGeniusSearchQuery(logger, query, queue);
|
const geniusSearchQuery: string = this.getGeniusSearchQuery(logger, query, queue);
|
||||||
const [playerSearchResult, geniusLyricsResult] = await Promise.all([
|
const [playerSearchResult, geniusLyricsResult] = await Promise.all([
|
||||||
this.getPlayerSearchResult(logger, query),
|
this.getPlayerSearchResult(logger, query),
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||||
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatSlashCommand } from '../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|
||||||
class MoveCommand extends BaseSlashCommandInteraction {
|
class MoveCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -81,7 +81,7 @@ class MoveCommand extends BaseSlashCommandInteraction {
|
|||||||
translator: TFunction
|
translator: TFunction
|
||||||
) {
|
) {
|
||||||
logger.debug('One of the specified track positions was higher than total tracks.');
|
logger.debug('One of the specified track positions was higher than total tracks.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -94,7 +94,8 @@ class MoveCommand extends BaseSlashCommandInteraction {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +106,7 @@ class MoveCommand extends BaseSlashCommandInteraction {
|
|||||||
toPosition: number,
|
toPosition: number,
|
||||||
translator: TFunction
|
translator: TFunction
|
||||||
) {
|
) {
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedUserAuthor(interaction))
|
.setAuthor(this.getEmbedUserAuthor(interaction))
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ import {
|
|||||||
EmbedField,
|
EmbedField,
|
||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType, TrackMetadata } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType, TrackMetadata } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatRepeatModeDetailed } from '../../common/formattingUtils';
|
import { formatRepeatModeDetailed } from '../../common/utils/formattingUtils';
|
||||||
|
|
||||||
class NowPlayingCommand extends BaseSlashCommandInteraction {
|
class NowPlayingCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -88,7 +88,7 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
|
|||||||
};
|
};
|
||||||
|
|
||||||
logger.debug('Sending info embed with action row components.');
|
logger.debug('Sending info embed with action row components.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedQueueAuthor(interaction, queue, translator))
|
.setAuthor(this.getEmbedQueueAuthor(interaction, queue, translator))
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
|
|
||||||
class PauseCommand extends BaseSlashCommandInteraction {
|
class PauseCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -32,7 +32,7 @@ class PauseCommand extends BaseSlashCommandInteraction {
|
|||||||
this.togglePauseState(logger, queue);
|
this.togglePauseState(logger, queue);
|
||||||
|
|
||||||
logger.debug('Responding with success embed.');
|
logger.debug('Responding with success embed.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedUserAuthor(interaction))
|
.setAuthor(this.getEmbedUserAuthor(interaction))
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ import {
|
|||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { BaseSlashCommandInteraction, CustomError } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction, CustomError } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkVoicePermissionJoinAndTalk } from '../../utils/validation/permissionValidator';
|
import { checkVoicePermissionJoinAndTalk } from '../../common/validation/permissionValidator';
|
||||||
import { transformQuery } from '../../utils/validation/searchQueryValidator';
|
import { transformQuery } from '../../common/validation/searchQueryValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatSlashCommand } from '../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|
||||||
class PlayCommand extends BaseSlashCommandInteraction {
|
class PlayCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -43,6 +43,9 @@ class PlayCommand extends BaseSlashCommandInteraction {
|
|||||||
await this.runValidators({ interaction, executionId }, [checkVoicePermissionJoinAndTalk]);
|
await this.runValidators({ interaction, executionId }, [checkVoicePermissionJoinAndTalk]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await interaction.deferReply();
|
||||||
|
logger.debug('Interaction deferred.');
|
||||||
|
|
||||||
const player = useMainPlayer()!;
|
const player = useMainPlayer()!;
|
||||||
const searchQuery = interaction.options.getString('query')!;
|
const searchQuery = interaction.options.getString('query')!;
|
||||||
const transformedQuery = transformQuery({ query: searchQuery, executionId });
|
const transformedQuery = transformQuery({ query: searchQuery, executionId });
|
||||||
@@ -185,10 +188,8 @@ class PlayCommand extends BaseSlashCommandInteraction {
|
|||||||
count: searchResult.tracks.length,
|
count: searchResult.tracks.length,
|
||||||
queueCommand: formatSlashCommand('queue', translator)
|
queueCommand: formatSlashCommand('queue', translator)
|
||||||
});
|
});
|
||||||
if (queue.tracks.data.length != searchResult.tracks.length) {
|
const posistionFirstTrackInPlaylist = queue.tracks.data.length - searchResult.tracks.length + 1;
|
||||||
const posistionFirstTrackInPlaylist = queue.tracks.data.length - searchResult.tracks.length + 1;
|
embedFooter = this.getDisplayFooterTrackPosition(posistionFirstTrackInPlaylist, translator);
|
||||||
embedFooter = this.getDisplayFooterTrackPosition(posistionFirstTrackInPlaylist, translator);
|
|
||||||
}
|
|
||||||
} else if (queue.currentTrack === track && queue.tracks.data.length === 0) {
|
} else if (queue.currentTrack === track && queue.tracks.data.length === 0) {
|
||||||
if (!this.embedOptions.behavior.enablePlayerStartMessages) {
|
if (!this.embedOptions.behavior.enablePlayerStartMessages) {
|
||||||
message =
|
message =
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ import {
|
|||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { formatDuration, formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils';
|
import { formatDuration, formatRepeatModeDetailed, formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
class QueueCommand extends BaseSlashCommandInteraction {
|
class QueueCommand extends BaseSlashCommandInteraction {
|
||||||
@@ -115,7 +115,7 @@ class QueueCommand extends BaseSlashCommandInteraction {
|
|||||||
};
|
};
|
||||||
|
|
||||||
logger.debug('Responding with info embed.');
|
logger.debug('Responding with info embed.');
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedQueueAuthor(interaction, queue, translator))
|
.setAuthor(this.getEmbedQueueAuthor(interaction, queue, translator))
|
||||||
@@ -160,7 +160,7 @@ class QueueCommand extends BaseSlashCommandInteraction {
|
|||||||
logger.debug('Queue exists but there is no current track.');
|
logger.debug('Queue exists but there is no current track.');
|
||||||
|
|
||||||
logger.debug('Responding with info embed.');
|
logger.debug('Responding with info embed.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedQueueAuthor(interaction, queue, translator))
|
.setAuthor(this.getEmbedQueueAuthor(interaction, queue, translator))
|
||||||
@@ -173,7 +173,8 @@ class QueueCommand extends BaseSlashCommandInteraction {
|
|||||||
)
|
)
|
||||||
.setFooter(this.getDisplayFullFooterInfo(interaction, queue, translator))
|
.setFooter(this.getDisplayFullFooterInfo(interaction, queue, translator))
|
||||||
.setColor(this.embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +188,7 @@ class QueueCommand extends BaseSlashCommandInteraction {
|
|||||||
logger.debug('Specified page was higher than total pages.');
|
logger.debug('Specified page was higher than total pages.');
|
||||||
|
|
||||||
logger.debug('Responding with warning embed.');
|
logger.debug('Responding with warning embed.');
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -198,7 +199,8 @@ class QueueCommand extends BaseSlashCommandInteraction {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import {
|
|||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/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 { checkValidGuildId } from '../../utils/validation/systemCommandValidator';
|
import { checkValidGuildId } from '../../common/validation/systemCommandValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
class ReloadCommand extends BaseSlashCommandInteraction {
|
class ReloadCommand extends BaseSlashCommandInteraction {
|
||||||
@@ -27,6 +27,9 @@ class ReloadCommand extends BaseSlashCommandInteraction {
|
|||||||
|
|
||||||
await this.runValidators({ interaction, executionId }, [checkValidGuildId]);
|
await this.runValidators({ interaction, executionId }, [checkValidGuildId]);
|
||||||
|
|
||||||
|
await interaction.deferReply();
|
||||||
|
logger.debug('Interaction deferred.');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.reloadInteractionsAcrossShards(logger, executionId, client!);
|
await this.reloadInteractionsAcrossShards(logger, executionId, client!);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||||
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { formatSlashCommand } from '../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|
||||||
class RemoveCommand extends BaseSlashCommandInteraction {
|
class RemoveCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -134,7 +134,7 @@ class RemoveCommand extends BaseSlashCommandInteraction {
|
|||||||
logger.debug('Start position is higher than end position.');
|
logger.debug('Start position is higher than end position.');
|
||||||
|
|
||||||
logger.debug('Responding with warning embed.');
|
logger.debug('Responding with warning embed.');
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -146,7 +146,8 @@ class RemoveCommand extends BaseSlashCommandInteraction {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
@@ -208,7 +209,7 @@ class RemoveCommand extends BaseSlashCommandInteraction {
|
|||||||
logger.debug(`Removed track '${removedTrack.url}' from queue.`);
|
logger.debug(`Removed track '${removedTrack.url}' from queue.`);
|
||||||
|
|
||||||
logger.debug('Responding with success embed.');
|
logger.debug('Responding with success embed.');
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedUserAuthor(interaction))
|
.setAuthor(this.getEmbedUserAuthor(interaction))
|
||||||
@@ -232,7 +233,7 @@ class RemoveCommand extends BaseSlashCommandInteraction {
|
|||||||
translator: TFunction
|
translator: TFunction
|
||||||
) {
|
) {
|
||||||
logger.debug('Responding with warning embed.');
|
logger.debug('Responding with warning embed.');
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedUserAuthor(interaction))
|
.setAuthor(this.getEmbedUserAuthor(interaction))
|
||||||
@@ -242,7 +243,8 @@ class RemoveCommand extends BaseSlashCommandInteraction {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
@@ -254,7 +256,7 @@ class RemoveCommand extends BaseSlashCommandInteraction {
|
|||||||
translator: TFunction
|
translator: TFunction
|
||||||
) {
|
) {
|
||||||
logger.debug('Responding with success embed.');
|
logger.debug('Responding with success embed.');
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedUserAuthor(interaction))
|
.setAuthor(this.getEmbedUserAuthor(interaction))
|
||||||
@@ -280,7 +282,7 @@ class RemoveCommand extends BaseSlashCommandInteraction {
|
|||||||
logger.debug('Specified track position is higher than total tracks.');
|
logger.debug('Specified track position is higher than total tracks.');
|
||||||
|
|
||||||
logger.debug('Responding with warning embed.');
|
logger.debug('Responding with warning embed.');
|
||||||
await interaction.editReply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -292,7 +294,8 @@ class RemoveCommand extends BaseSlashCommandInteraction {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { GuildQueue, useQueue } from 'discord-player';
|
import { GuildQueue, useQueue } from 'discord-player';
|
||||||
import { ChatInputCommandInteraction, EmbedBuilder, Message, SlashCommandBuilder } from 'discord.js';
|
import { ChatInputCommandInteraction, EmbedBuilder, Message, SlashCommandBuilder } from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatSlashCommand } from '../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|
||||||
class SeekCommand extends BaseSlashCommandInteraction {
|
class SeekCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -33,6 +33,9 @@ class SeekCommand extends BaseSlashCommandInteraction {
|
|||||||
checkQueueCurrentTrack
|
checkQueueCurrentTrack
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
await interaction.deferReply();
|
||||||
|
logger.debug('Interaction deferred.');
|
||||||
|
|
||||||
const durationInputSplit: string[] = interaction.options.getString('duration')!.split(':');
|
const durationInputSplit: string[] = interaction.options.getString('duration')!.split(':');
|
||||||
const formattedDurationString: string = this.parseDurationArray(durationInputSplit);
|
const formattedDurationString: string = this.parseDurationArray(durationInputSplit);
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ import {
|
|||||||
EmbedFooterData,
|
EmbedFooterData,
|
||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/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 { checkValidGuildId } from '../../utils/validation/systemCommandValidator';
|
import { checkValidGuildId } from '../../common/validation/systemCommandValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { localizeCommand } from '../../common/localeUtil';
|
import { localizeCommand } from '../../common/utils/localeUtil';
|
||||||
|
|
||||||
class ShardsCommand extends BaseSlashCommandInteraction {
|
class ShardsCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -43,6 +43,9 @@ class ShardsCommand extends BaseSlashCommandInteraction {
|
|||||||
|
|
||||||
await this.runValidators({ interaction, executionId }, [checkValidGuildId]);
|
await this.runValidators({ interaction, executionId }, [checkValidGuildId]);
|
||||||
|
|
||||||
|
await interaction.deferReply();
|
||||||
|
logger.debug('Interaction deferred.');
|
||||||
|
|
||||||
const shardInfoList: ShardInfo[] = await this.fetchShardInfo(
|
const shardInfoList: ShardInfo[] = await this.fetchShardInfo(
|
||||||
client!,
|
client!,
|
||||||
logger,
|
logger,
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { GuildQueue, useQueue } from 'discord-player';
|
import { GuildQueue, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueEmpty, checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueEmpty, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { formatSlashCommand } from '../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|
||||||
class ShuffleCommand extends BaseSlashCommandInteraction {
|
class ShuffleCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -31,7 +31,7 @@ class ShuffleCommand extends BaseSlashCommandInteraction {
|
|||||||
logger.debug('Shuffled queue tracks.');
|
logger.debug('Shuffled queue tracks.');
|
||||||
|
|
||||||
logger.debug('Responding with success embed.');
|
logger.debug('Responding with success embed.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedUserAuthor(interaction))
|
.setAuthor(this.getEmbedUserAuthor(interaction))
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||||
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils';
|
import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|
||||||
class SkipCommand extends BaseSlashCommandInteraction {
|
class SkipCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -73,7 +73,7 @@ class SkipCommand extends BaseSlashCommandInteraction {
|
|||||||
translator: TFunction
|
translator: TFunction
|
||||||
) {
|
) {
|
||||||
logger.debug('Specified track position was higher than total tracks.');
|
logger.debug('Specified track position was higher than total tracks.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -85,7 +85,8 @@ class SkipCommand extends BaseSlashCommandInteraction {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +112,7 @@ class SkipCommand extends BaseSlashCommandInteraction {
|
|||||||
translator: TFunction
|
translator: TFunction
|
||||||
) {
|
) {
|
||||||
logger.debug('No tracks in queue and no current track.');
|
logger.debug('No tracks in queue and no current track.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -121,7 +122,8 @@ class SkipCommand extends BaseSlashCommandInteraction {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.setColor(this.embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
],
|
||||||
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +133,7 @@ class SkipCommand extends BaseSlashCommandInteraction {
|
|||||||
queue: GuildQueue,
|
queue: GuildQueue,
|
||||||
translator: TFunction
|
translator: TFunction
|
||||||
) {
|
) {
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedUserAuthor(interaction))
|
.setAuthor(this.getEmbedUserAuthor(interaction))
|
||||||
|
|||||||
@@ -10,10 +10,15 @@ import {
|
|||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../common/statusUtils';
|
import {
|
||||||
|
getBotStatistics,
|
||||||
|
getDiscordStatus,
|
||||||
|
getPlayerStatistics,
|
||||||
|
getSystemStatus
|
||||||
|
} from '../../common/utils/statusUtils';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
|
|
||||||
class StatusCommand extends BaseSlashCommandInteraction {
|
class StatusCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -26,6 +31,9 @@ class StatusCommand extends BaseSlashCommandInteraction {
|
|||||||
const logger = this.getLogger(this.name, executionId, interaction);
|
const logger = this.getLogger(this.name, executionId, interaction);
|
||||||
const translator = useServerTranslator(interaction);
|
const translator = useServerTranslator(interaction);
|
||||||
|
|
||||||
|
await interaction.deferReply();
|
||||||
|
logger.debug('Interaction deferred.');
|
||||||
|
|
||||||
const [botStatisticsEmbedString, playerStatisticsEmbedString, systemStatusEmbedString] = await Promise.all([
|
const [botStatisticsEmbedString, playerStatisticsEmbedString, systemStatusEmbedString] = await Promise.all([
|
||||||
getBotStatistics(client!, version, translator),
|
getBotStatistics(client!, version, translator),
|
||||||
getPlayerStatistics(client!, translator),
|
getPlayerStatistics(client!, translator),
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { GuildQueue, QueueRepeatMode, useQueue } from 'discord-player';
|
import { GuildQueue, QueueRepeatMode, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { formatSlashCommand } from '../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|
||||||
class StopCommand extends BaseSlashCommandInteraction {
|
class StopCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -33,7 +33,7 @@ class StopCommand extends BaseSlashCommandInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.debug('Responding with success embed.');
|
logger.debug('Responding with success embed.');
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(this.getEmbedUserAuthor(interaction))
|
.setAuthor(this.getEmbedUserAuthor(interaction))
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { dependencies, version } from '../../../package.json';
|
import { dependencies, version } from '../../../package.json';
|
||||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../common/statusUtils';
|
import {
|
||||||
|
getBotStatistics,
|
||||||
|
getDiscordStatus,
|
||||||
|
getPlayerStatistics,
|
||||||
|
getSystemStatus
|
||||||
|
} from '../../common/utils/statusUtils';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkValidGuildId } from '../../utils/validation/systemCommandValidator';
|
import { checkValidGuildId } from '../../common/validation/systemCommandValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
|
|
||||||
class SystemStatusCommand extends BaseSlashCommandInteraction {
|
class SystemStatusCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -21,6 +26,9 @@ class SystemStatusCommand extends BaseSlashCommandInteraction {
|
|||||||
|
|
||||||
await this.runValidators({ interaction, executionId }, [checkValidGuildId]);
|
await this.runValidators({ interaction, executionId }, [checkValidGuildId]);
|
||||||
|
|
||||||
|
await interaction.deferReply();
|
||||||
|
logger.debug('Interaction deferred.');
|
||||||
|
|
||||||
const [botStatisticsEmbedString, playerStatisticsEmbedString, systemStatusEmbedString] = await Promise.all([
|
const [botStatisticsEmbedString, playerStatisticsEmbedString, systemStatusEmbedString] = await Promise.all([
|
||||||
getBotStatistics(client!, version, translator),
|
getBotStatistics(client!, version, translator),
|
||||||
getPlayerStatistics(client!, translator),
|
getPlayerStatistics(client!, translator),
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { GuildQueue, useQueue } from 'discord-player';
|
import { GuildQueue, useQueue } from 'discord-player';
|
||||||
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../utils/validation/queueValidator';
|
import { checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
class VolumeCommand extends BaseSlashCommandInteraction {
|
class VolumeCommand extends BaseSlashCommandInteraction {
|
||||||
@@ -31,6 +31,9 @@ class VolumeCommand extends BaseSlashCommandInteraction {
|
|||||||
checkQueueExists
|
checkQueueExists
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
await interaction.deferReply();
|
||||||
|
logger.debug('Interaction deferred.');
|
||||||
|
|
||||||
const volume: number = interaction.options.getInteger('percentage')!;
|
const volume: number = interaction.options.getInteger('percentage')!;
|
||||||
|
|
||||||
if (!volume && volume !== 0) {
|
if (!volume && volume !== 0) {
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
import { getPrismaClient } from './prismaClient';
|
|
||||||
|
|
||||||
const prisma = getPrismaClient();
|
|
||||||
|
|
||||||
const guildDatabaseService = {
|
|
||||||
async getAllGuilds() {
|
|
||||||
return await prisma.guild.findMany();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default guildDatabaseService;
|
|
||||||
@@ -5,8 +5,8 @@ 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 { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { BaseSlashCommandInteraction } from '../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../common/classes/interactions';
|
||||||
import loggerModule from '../services/logger';
|
import loggerModule from '../common/services/logger';
|
||||||
import { SystemOptions } from '../types/configTypes';
|
import { SystemOptions } from '../types/configTypes';
|
||||||
|
|
||||||
const systemOptions: SystemOptions = config.get('systemOptions');
|
const systemOptions: SystemOptions = config.get('systemOptions');
|
||||||
@@ -2,9 +2,9 @@ import { Client } from 'discord.js';
|
|||||||
import { ClientRequest, ClientRequestArgs, IncomingMessage } from 'node:http';
|
import { ClientRequest, ClientRequestArgs, IncomingMessage } from 'node:http';
|
||||||
import https from 'node:https';
|
import https from 'node:https';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../common/services/logger';
|
||||||
import { PostBotStatsParams, PostBotStatsSite } from '../../types/utilTypes';
|
import { PostBotStatsParams, PostBotStatsSite } from '../types/utilTypes';
|
||||||
import { fetchTotalGuildStatistics } from '../shardUtils';
|
import { fetchTotalGuildStatistics } from '../common/utils/shardUtils';
|
||||||
|
|
||||||
export const postBotStats = async ({ client, executionId }: PostBotStatsParams) => {
|
export const postBotStats = async ({ client, executionId }: PostBotStatsParams) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerModule.child({
|
||||||
@@ -2,7 +2,7 @@ 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 { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../services/logger';
|
import loggerModule from '../common/services/logger';
|
||||||
import { ExtendedClient } from '../types/clientTypes';
|
import { ExtendedClient } from '../types/clientTypes';
|
||||||
import { RegisterClientInteractionsParams } from '../types/utilTypes';
|
import { RegisterClientInteractionsParams } from '../types/utilTypes';
|
||||||
|
|
||||||
@@ -4,7 +4,7 @@ import { Client } from 'discord.js';
|
|||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../services/logger';
|
import loggerModule from '../common/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';
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
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 '../common/services/logger';
|
||||||
import { LoadTestOptions } from '../../types/configTypes';
|
import { LoadTestOptions } from '../types/configTypes';
|
||||||
import { StartLoadTestParams } from '../../types/utilTypes';
|
import { StartLoadTestParams } from '../types/utilTypes';
|
||||||
|
|
||||||
const loadTestOptions: LoadTestOptions = config.get('loadTestOptions');
|
const loadTestOptions: LoadTestOptions = config.get('loadTestOptions');
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { transformQuery } from '../utils/validation/searchQueryValidator';
|
import { transformQuery } from '../../../common/validation/searchQueryValidator';
|
||||||
|
|
||||||
describe('searchQueryValidator', () => {
|
describe('searchQueryValidator', () => {
|
||||||
it.each(['us', 'nb', 'intl', 'en-us', 'long-code'])(
|
it.each(['us', 'nb', 'intl', 'en-us', 'long-code'])(
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
import helpCommand from '../interactions/slashcommands/help';
|
|
||||||
import { SlashCommandNumberOption } from 'discord.js';
|
|
||||||
import { BaseSlashCommandInteraction } from '../classes/interactions';
|
|
||||||
|
|
||||||
describe('HelpCommand', () => {
|
|
||||||
describe('getCommandParams', () => {
|
|
||||||
it('should return the correct command params', () => {
|
|
||||||
const command = {
|
|
||||||
data: {
|
|
||||||
options: [
|
|
||||||
new SlashCommandNumberOption()
|
|
||||||
.setName('optionname')
|
|
||||||
.setDescription('optionDescription')
|
|
||||||
.setRequired(true)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
} as unknown as BaseSlashCommandInteraction;
|
|
||||||
|
|
||||||
const locale = 'en-US';
|
|
||||||
const commandParams = helpCommand['getCommandParams'](command, locale);
|
|
||||||
|
|
||||||
expect(commandParams).toBe('**`optionname`** ');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return an empty string when no options are present', () => {
|
|
||||||
const command = {
|
|
||||||
data: {
|
|
||||||
options: []
|
|
||||||
}
|
|
||||||
} as unknown as BaseSlashCommandInteraction;
|
|
||||||
|
|
||||||
const locale = 'en-US';
|
|
||||||
const commandParams = helpCommand['getCommandParams'](command, locale);
|
|
||||||
|
|
||||||
expect(commandParams).toBe('');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import helpCommand from '../../../interactions/slashcommands/help';
|
||||||
|
import Discord, { Client, SlashCommandNumberOption, ChatInputCommandInteraction } from 'discord.js';
|
||||||
|
import { BaseSlashCommandInteraction } from '../../../common/classes/interactions';
|
||||||
|
import { ExtendedClient } from '../../../types/clientTypes';
|
||||||
|
|
||||||
|
describe('Discord bot command test', () => {
|
||||||
|
let client: ExtendedClient;
|
||||||
|
let mockInteraction: ChatInputCommandInteraction;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
client = new Client({
|
||||||
|
intents: [Discord.GatewayIntentBits.Guilds, Discord.GatewayIntentBits.GuildVoiceStates]
|
||||||
|
});
|
||||||
|
|
||||||
|
client.slashCommandInteractions = new Discord.Collection<string, BaseSlashCommandInteraction>();
|
||||||
|
client.slashCommandInteractions.set('help', helpCommand);
|
||||||
|
|
||||||
|
mockInteraction = {
|
||||||
|
reply: jest.fn(),
|
||||||
|
commandName: 'help'
|
||||||
|
} as unknown as ChatInputCommandInteraction;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should reply when receiving a valid help command', async () => {
|
||||||
|
// Execute the help command with the mock interaction
|
||||||
|
await helpCommand.execute({
|
||||||
|
executionId: '123',
|
||||||
|
client,
|
||||||
|
interaction: mockInteraction as ChatInputCommandInteraction
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check if the reply method was called
|
||||||
|
expect(mockInteraction.reply).toHaveBeenCalledWith(expect.anything());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('HelpCommand', () => {
|
||||||
|
describe('getCommandParams', () => {
|
||||||
|
it('should return the correct command params', () => {
|
||||||
|
const command = {
|
||||||
|
data: {
|
||||||
|
options: [
|
||||||
|
new SlashCommandNumberOption()
|
||||||
|
.setName('optionname')
|
||||||
|
.setDescription('optionDescription')
|
||||||
|
.setRequired(true)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
} as unknown as BaseSlashCommandInteraction;
|
||||||
|
|
||||||
|
const locale = 'en-US';
|
||||||
|
const commandParams = helpCommand.getCommandParams(command, locale);
|
||||||
|
|
||||||
|
expect(commandParams).toBe('**`optionname`** ');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return an empty string when no options are present', () => {
|
||||||
|
const command = {
|
||||||
|
data: {
|
||||||
|
options: []
|
||||||
|
}
|
||||||
|
} as unknown as BaseSlashCommandInteraction;
|
||||||
|
|
||||||
|
const locale = 'en-US';
|
||||||
|
const commandParams = helpCommand.getCommandParams(command, locale);
|
||||||
|
|
||||||
|
expect(commandParams).toBe('');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Vendored
+1
-1
@@ -3,7 +3,7 @@ import {
|
|||||||
BaseAutocompleteInteraction,
|
BaseAutocompleteInteraction,
|
||||||
BaseComponentInteraction,
|
BaseComponentInteraction,
|
||||||
BaseSlashCommandInteraction
|
BaseSlashCommandInteraction
|
||||||
} from '../classes/interactions';
|
} from '../common/classes/interactions';
|
||||||
|
|
||||||
type RegisterClientInteractionsFunction = (params: { client: Client; executionId: string }) => void;
|
type RegisterClientInteractionsFunction = (params: { client: Client; executionId: string }) => void;
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -47,11 +47,11 @@ export type BaseComponentParams = {
|
|||||||
referenceId?: string;
|
referenceId?: string;
|
||||||
} & BaseInteractionParams;
|
} & BaseInteractionParams;
|
||||||
|
|
||||||
export type BaseSlashCommandReturnType = Promise<Message<boolean> | void>;
|
export type BaseSlashCommandReturnType = Promise<Message<boolean> | InteractionResponse<boolean> | void>;
|
||||||
|
|
||||||
export type BaseAutocompleteReturnType = Promise<ApplicationCommandOptionChoiceData | void>;
|
export type BaseAutocompleteReturnType = Promise<ApplicationCommandOptionChoiceData | void>;
|
||||||
|
|
||||||
export type BaseComponentReturnType = Promise<Message<boolean> | void>;
|
export type BaseComponentReturnType = Promise<Message<boolean> | InteractionResponse<boolean> | void>;
|
||||||
|
|
||||||
export enum FilterType {
|
export enum FilterType {
|
||||||
FFmpeg = 'ffmpeg',
|
FFmpeg = 'ffmpeg',
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
import fs from 'node:fs';
|
|
||||||
import path from 'node:path';
|
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
||||||
const cookies: { name: string; value: string }[] = require(path.resolve('./cookies.json'));
|
|
||||||
|
|
||||||
try {
|
|
||||||
const cookieString: string = cookies
|
|
||||||
.map(({ name, value }: { name: string; value: string }) => {
|
|
||||||
return `${name}=${value}`;
|
|
||||||
})
|
|
||||||
.join('; ');
|
|
||||||
|
|
||||||
fs.writeFile(path.resolve('./cookies.txt'), cookieString, () => {
|
|
||||||
return process.exit(0);
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user