mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 22:15:29 +00:00
fix: Fixed most imports and some typescript changes
This commit is contained in:
1 parent
1a7f800ba2
commit
0d9f4bd404
60 files changed
+488
-265
No files matched your search
+2
-1
@@ -49,6 +49,7 @@
|
|||||||
"curly": ["error", "all"],
|
"curly": ["error", "all"],
|
||||||
"no-console": ["error"],
|
"no-console": ["error"],
|
||||||
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
|
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
|
||||||
"@typescript-eslint/explicit-module-boundary-types": "off"
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||||
|
"@typescript-eslint/ban-ts-comment": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -24,7 +24,7 @@
|
|||||||
"start-pretty-no-ignore": "node ./dist/index.js | pino-pretty",
|
"start-pretty-no-ignore": "node ./dist/index.js | pino-pretty",
|
||||||
"deploy": "node ./dist/utils/deploySlashCommands.js",
|
"deploy": "node ./dist/utils/deploySlashCommands.js",
|
||||||
"deploy-pretty": "node ./dist/utils/deploySlashCommands.js | pino-pretty --ignore environment,source,module,action,name,context,executionId,shardId,guildId",
|
"deploy-pretty": "node ./dist/utils/deploySlashCommands.js | pino-pretty --ignore environment,source,module,action,name,context,executionId,shardId,guildId",
|
||||||
"eslint": "eslint ./"
|
"eslint": "eslint ./src"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discord-player/extractor": "^4.4.2-dev.1",
|
"@discord-player/extractor": "^4.4.2-dev.1",
|
||||||
|
|||||||
+12
-10
@@ -1,13 +1,15 @@
|
|||||||
require('dotenv').config();
|
import 'dotenv/config';
|
||||||
const { registerEventListeners } = require('./utils/registerEventListeners.js');
|
import { registerEventListeners } from './utils/registerEventListeners';
|
||||||
const { registerClientCommands } = require('./utils/registerClientCommands.js');
|
import { registerClientCommands } from './utils/registerClientCommands';
|
||||||
const { createClient } = require('./utils/factory/createClient.js');
|
import { createClient } from './utils/factory/createClient';
|
||||||
const { createPlayer } = require('./utils/factory/createPlayer.js');
|
import { createPlayer } from './utils/factory/createPlayer';
|
||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import loggerModule from './services/logger';
|
||||||
|
import { ExtendedClient } from './types/clientTypes';
|
||||||
|
import { Client } from 'discord.js';
|
||||||
|
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('./services/logger').child({
|
|
||||||
source: 'bot.js',
|
source: 'bot.js',
|
||||||
module: 'shardingClient',
|
module: 'shardingClient',
|
||||||
name: 'shardingClient',
|
name: 'shardingClient',
|
||||||
@@ -16,14 +18,14 @@ const logger = require('./services/logger').child({
|
|||||||
});
|
});
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const client = await createClient({ executionId });
|
const client: ExtendedClient = await createClient({ executionId });
|
||||||
const player = await createPlayer({ client, executionId });
|
const player = await createPlayer({ client, executionId });
|
||||||
|
|
||||||
client.on('allShardsReady', async () => {
|
client.on('allShardsReady', async () => {
|
||||||
client.registerClientCommands = registerClientCommands;
|
client.registerClientCommands = registerClientCommands;
|
||||||
registerEventListeners({ client, player, executionId });
|
registerEventListeners({ client, player, executionId });
|
||||||
registerClientCommands({ client, executionId });
|
registerClientCommands({ client, executionId });
|
||||||
client.emit('ready', client);
|
client.emit('ready', client as Client);
|
||||||
});
|
});
|
||||||
|
|
||||||
client.login(process.env.DISCORD_BOT_TOKEN);
|
client.login(process.env.DISCORD_BOT_TOKEN);
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const botOptions = config.get('botOptions');
|
const botOptions = config.get('botOptions');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import { SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -10,7 +12,7 @@ module.exports = {
|
|||||||
.setDMPermission(false)
|
.setDMPermission(false)
|
||||||
.setNSFW(false),
|
.setNSFW(false),
|
||||||
execute: async ({ interaction, client, executionId }) => {
|
execute: async ({ interaction, client, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'help.js',
|
source: 'help.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/help',
|
name: '/help',
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
const { getUptimeFormatted } = require('../../utils/system/getUptimeFormatted');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import { getUptimeFormatted } from '../../utils/system/getUptimeFormatted';
|
||||||
|
import{ SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
import osu from 'node-os-utils';
|
import osu from 'node-os-utils';
|
||||||
const { version } = require('../../../package.json');
|
// @ts-ignore
|
||||||
|
import { version } from '../../../package.json';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
@@ -14,7 +17,7 @@ module.exports = {
|
|||||||
.setDMPermission(false)
|
.setDMPermission(false)
|
||||||
.setNSFW(false),
|
.setNSFW(false),
|
||||||
execute: async ({ interaction, client, executionId }) => {
|
execute: async ({ interaction, client, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'status.js',
|
source: 'status.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/status',
|
name: '/status',
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const ffmpegFilterOptions = config.get('ffmpegFilterOptions');
|
const ffmpegFilterOptions = config.get('ffmpegFilterOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
import { notInVoiceChannel, notInSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../utils/validation/queueValidator';
|
||||||
const {
|
import {
|
||||||
SlashCommandBuilder,
|
SlashCommandBuilder,
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
ActionRowBuilder,
|
ActionRowBuilder,
|
||||||
StringSelectMenuBuilder,
|
StringSelectMenuBuilder,
|
||||||
StringSelectMenuOptionBuilder,
|
StringSelectMenuOptionBuilder,
|
||||||
ButtonBuilder
|
ButtonBuilder
|
||||||
} = require('discord.js');
|
} from 'discord.js';
|
||||||
const { useQueue } = require('discord-player');
|
import { useQueue } from 'discord-player';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
@@ -22,7 +24,7 @@ module.exports = {
|
|||||||
.setDMPermission(false)
|
.setDMPermission(false)
|
||||||
.setNSFW(false),
|
.setNSFW(false),
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'filters.js',
|
source: 'filters.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/filters',
|
name: '/filters',
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import { notInVoiceChannel, notInSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const { useQueue } = require('discord-player');
|
import{ SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
|
import { useQueue } from 'discord-player';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
@@ -13,7 +15,7 @@ module.exports = {
|
|||||||
.setDMPermission(false)
|
.setDMPermission(false)
|
||||||
.setNSFW(false),
|
.setNSFW(false),
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'leave.js',
|
source: 'leave.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/leave',
|
name: '/leave',
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const botOptions = config.get('botOptions');
|
const botOptions = config.get('botOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
import { notInVoiceChannel, notInSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const { queueDoesNotExist } = require('../../utils/validation/queueValidator');
|
import { queueDoesNotExist } from '../../utils/validation/queueValidator';
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import{ SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
const { useQueue } = require('discord-player');
|
import { useQueue } from 'discord-player';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
@@ -27,7 +29,7 @@ module.exports = {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'loop.js',
|
source: 'loop.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/loop',
|
name: '/loop',
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
import { notInVoiceChannel, notInSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../utils/validation/queueValidator';
|
||||||
const { useMainPlayer, useQueue, QueryType } = require('discord-player');
|
import { SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
const { lyricsExtractor } = require('@discord-player/extractor');
|
import { useMainPlayer, useQueue, QueryType } from 'discord-player';
|
||||||
|
import { lyricsExtractor } from '@discord-player/extractor';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
const recentQueries = new Map();
|
const recentQueries = new Map();
|
||||||
|
|
||||||
const loggerTempplate = require('../../services/logger').child({
|
const loggerTemplate = loggerModule.child({
|
||||||
source: 'lyrics.js',
|
source: 'lyrics.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/lyrics'
|
name: '/lyrics'
|
||||||
@@ -32,7 +34,7 @@ module.exports = {
|
|||||||
.setAutocomplete(true)
|
.setAutocomplete(true)
|
||||||
),
|
),
|
||||||
autocomplete: async ({ interaction, executionId }) => {
|
autocomplete: async ({ interaction, executionId }) => {
|
||||||
const logger = loggerTempplate.child({
|
const logger = loggerTemplate.child({
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
shardId: interaction.guild.shardId,
|
shardId: interaction.guild.shardId,
|
||||||
guildId: interaction.guild.id
|
guildId: interaction.guild.id
|
||||||
@@ -92,7 +94,7 @@ module.exports = {
|
|||||||
return interaction.respond(response);
|
return interaction.respond(response);
|
||||||
},
|
},
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger = loggerTempplate.child({
|
const logger = loggerTemplate.child({
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
shardId: interaction.guild.shardId,
|
shardId: interaction.guild.shardId,
|
||||||
guildId: interaction.guild.id
|
guildId: interaction.guild.id
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const playerOptions = config.get('playerOptions');
|
const playerOptions = config.get('playerOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
import { notInVoiceChannel, notInSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../utils/validation/queueValidator';
|
||||||
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');
|
import { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder } from 'discord.js';
|
||||||
const { useQueue } = require('discord-player');
|
import { useQueue } from 'discord-player';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
@@ -15,7 +17,7 @@ module.exports = {
|
|||||||
.setDMPermission(false)
|
.setDMPermission(false)
|
||||||
.setNSFW(false),
|
.setNSFW(false),
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'nowplaying.js',
|
source: 'nowplaying.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/nowplaying',
|
name: '/nowplaying',
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
import { notInVoiceChannel, notInSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../utils/validation/queueValidator';
|
||||||
const { useQueue } = require('discord-player');
|
import{ SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
|
import { useQueue } from 'discord-player';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
@@ -14,7 +16,7 @@ module.exports = {
|
|||||||
.setDMPermission(false)
|
.setDMPermission(false)
|
||||||
.setNSFW(false),
|
.setNSFW(false),
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'pause.js',
|
source: 'pause.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/pause',
|
name: '/pause',
|
||||||
|
|||||||
+13
-11
@@ -1,16 +1,18 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const botOptions = config.get('botOptions');
|
const botOptions = config.get('botOptions');
|
||||||
const playerOptions = config.get('playerOptions');
|
const playerOptions = config.get('playerOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
import { notInVoiceChannel, notInSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const { cannotJoinVoiceOrTalk } = require('../../utils/validation/permissionValidator');
|
import { cannotJoinVoiceOrTalk } from '../../utils/validation/permissionValidator';
|
||||||
const { transformQuery } = require('../../utils/validation/searchQueryValidator');
|
import { transformQuery } from '../../utils/validation/searchQueryValidator';
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import { SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
const { useMainPlayer, useQueue } = require('discord-player');
|
import { useMainPlayer, useQueue } from 'discord-player';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
|
||||||
const recentQueries = new Map();
|
const recentQueries = new Map();
|
||||||
|
|
||||||
const loggerTempplate = require('../../services/logger').child({
|
const loggerTemplate = loggerModule.child({
|
||||||
source: 'play.js',
|
source: 'play.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/play'
|
name: '/play'
|
||||||
@@ -34,7 +36,7 @@ module.exports = {
|
|||||||
.setAutocomplete(true)
|
.setAutocomplete(true)
|
||||||
),
|
),
|
||||||
autocomplete: async ({ interaction, executionId }) => {
|
autocomplete: async ({ interaction, executionId }) => {
|
||||||
const logger = loggerTempplate.child({
|
const logger = loggerTemplate.child({
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
shardId: interaction.guild.shardId,
|
shardId: interaction.guild.shardId,
|
||||||
guildId: interaction.guild.id
|
guildId: interaction.guild.id
|
||||||
@@ -86,7 +88,7 @@ module.exports = {
|
|||||||
return interaction.respond(response);
|
return interaction.respond(response);
|
||||||
},
|
},
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger = loggerTempplate.child({
|
const logger = loggerTemplate.child({
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
shardId: interaction.guild.shardId,
|
shardId: interaction.guild.shardId,
|
||||||
guildId: interaction.guild.id
|
guildId: interaction.guild.id
|
||||||
@@ -213,7 +215,7 @@ module.exports = {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
(error.type === 'TypeError' &&
|
(error.type === 'TypeError' &&
|
||||||
(error.message.includes('Cannot read properties of null (reading \'createStream\')') ||
|
(error.message.includes("Cannot read properties of null (reading 'createStream')") ||
|
||||||
error.message.includes('Failed to fetch resources for ytdl streaming'))) ||
|
error.message.includes('Failed to fetch resources for ytdl streaming'))) ||
|
||||||
error.message.includes('Could not extract stream for this track')
|
error.message.includes('Could not extract stream for this track')
|
||||||
) {
|
) {
|
||||||
@@ -248,7 +250,7 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error.message === 'Cannot read properties of null (reading \'createStream\')') {
|
if (error.message === "Cannot read properties of null (reading 'createStream')") {
|
||||||
// Can happen if /play then /leave before track starts playing
|
// Can happen if /play then /leave before track starts playing
|
||||||
logger.warn(error, 'Found track but failed to play back audio. Voice connection might be unavailable.');
|
logger.warn(error, 'Found track but failed to play back audio. Voice connection might be unavailable.');
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const playerOptions = config.get('playerOptions');
|
const playerOptions = config.get('playerOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
import { notInVoiceChannel, notInSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import{ SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
const { useQueue } = require('discord-player');
|
import { useQueue } from 'discord-player';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
@@ -15,7 +17,7 @@ module.exports = {
|
|||||||
.setNSFW(false)
|
.setNSFW(false)
|
||||||
.addNumberOption((option) => option.setName('page').setDescription('Page number of the queue').setMinValue(1)),
|
.addNumberOption((option) => option.setName('page').setDescription('Page number of the queue').setMinValue(1)),
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'queue.js',
|
source: 'queue.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/queue',
|
name: '/queue',
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const { queueDoesNotExist } = require('../../utils/validation/queueValidator');
|
import { notInVoiceChannel, notInSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import { queueDoesNotExist } from '../../utils/validation/queueValidator';
|
||||||
const { useQueue } = require('discord-player');
|
import{ SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
|
import { useQueue } from 'discord-player';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
@@ -21,7 +23,7 @@ module.exports = {
|
|||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
),
|
),
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'remove.js',
|
source: 'remove.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/remove',
|
name: '/remove',
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
import { notInVoiceChannel, notInSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../utils/validation/queueValidator';
|
||||||
const { useQueue } = require('discord-player');
|
import{ SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
|
import { useQueue } from 'discord-player';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
@@ -20,7 +22,7 @@ module.exports = {
|
|||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
),
|
),
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'seek.js',
|
source: 'seek.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/seek',
|
name: '/seek',
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const { queueDoesNotExist, queueIsEmpty } = require('../../utils/validation/queueValidator');
|
import { notInVoiceChannel, notInSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import { queueDoesNotExist, queueIsEmpty } from '../../utils/validation/queueValidator';
|
||||||
const { useQueue } = require('discord-player');
|
import{ SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
|
import { useQueue } from 'discord-player';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
@@ -14,7 +16,7 @@ module.exports = {
|
|||||||
.setDMPermission(false)
|
.setDMPermission(false)
|
||||||
.setNSFW(false),
|
.setNSFW(false),
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'shuffle.js',
|
source: 'shuffle.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/shuffle',
|
name: '/shuffle',
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
import { notInVoiceChannel, notInSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../utils/validation/queueValidator';
|
||||||
const { useQueue } = require('discord-player');
|
import { SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
|
import { useQueue } from 'discord-player';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
@@ -17,7 +19,7 @@ module.exports = {
|
|||||||
option.setName('tracknumber').setDescription('Track number to skip to in the queue.').setMinValue(1)
|
option.setName('tracknumber').setDescription('Track number to skip to in the queue.').setMinValue(1)
|
||||||
),
|
),
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'skip.js',
|
source: 'skip.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/skip',
|
name: '/skip',
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import { notInVoiceChannel, notInSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const { useQueue } = require('discord-player');
|
import{ SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
|
import { useQueue } from 'discord-player';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
@@ -13,7 +15,7 @@ module.exports = {
|
|||||||
.setDMPermission(false)
|
.setDMPermission(false)
|
||||||
.setNSFW(false),
|
.setNSFW(false),
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'stop.js',
|
source: 'stop.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/stop',
|
name: '/stop',
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const { queueDoesNotExist } = require('../../utils/validation/queueValidator');
|
import { notInVoiceChannel, notInSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import { queueDoesNotExist } from '../../utils/validation/queueValidator';
|
||||||
const { useQueue } = require('discord-player');
|
import{ SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
|
import { useQueue } from 'discord-player';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
@@ -21,7 +23,7 @@ module.exports = {
|
|||||||
.setMaxValue(100)
|
.setMaxValue(100)
|
||||||
),
|
),
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'volume.js',
|
source: 'volume.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/volume',
|
name: '/volume',
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
const { notValidGuildId } = require('../../utils/validation/systemCommandValidator');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import { notValidGuildId } from '../../utils/validation/systemCommandValidator';
|
||||||
|
import{ SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isSystemCommand: true,
|
isSystemCommand: true,
|
||||||
@@ -13,7 +15,7 @@ module.exports = {
|
|||||||
.setDMPermission(false)
|
.setDMPermission(false)
|
||||||
.setNSFW(false),
|
.setNSFW(false),
|
||||||
execute: async ({ interaction, client, executionId }) => {
|
execute: async ({ interaction, client, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'guilds.js',
|
source: 'guilds.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/guilds',
|
name: '/guilds',
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
const { notValidGuildId } = require('../../utils/validation/systemCommandValidator');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import { notValidGuildId } from '../../utils/validation/systemCommandValidator';
|
||||||
|
import{ SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isSystemCommand: true,
|
isSystemCommand: true,
|
||||||
@@ -13,7 +15,7 @@ module.exports = {
|
|||||||
.setDMPermission(false)
|
.setDMPermission(false)
|
||||||
.setNSFW(false),
|
.setNSFW(false),
|
||||||
execute: async ({ interaction, client, executionId }) => {
|
execute: async ({ interaction, client, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'reload.js',
|
source: 'reload.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/reload',
|
name: '/reload',
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
const { notValidGuildId } = require('../../utils/validation/systemCommandValidator');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
import { notValidGuildId } from '../../utils/validation/systemCommandValidator';
|
||||||
|
import{ SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isSystemCommand: true,
|
isSystemCommand: true,
|
||||||
@@ -30,7 +32,7 @@ module.exports = {
|
|||||||
|
|
||||||
.addNumberOption((option) => option.setName('page').setDescription('Page number to show').setMinValue(1)),
|
.addNumberOption((option) => option.setName('page').setDescription('Page number to show').setMinValue(1)),
|
||||||
execute: async ({ interaction, client, executionId }) => {
|
execute: async ({ interaction, client, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'shards.js',
|
source: 'shards.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/shards',
|
name: '/shards',
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { notValidGuildId } from '../../utils/validation/systemCommandValidator';
|
||||||
const { notValidGuildId } = require('../../utils/validation/systemCommandValidator');
|
import { getUptimeFormatted } from '../../utils/system/getUptimeFormatted';
|
||||||
const { getUptimeFormatted } = require('../../utils/system/getUptimeFormatted');
|
import { SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
|
||||||
import osu from 'node-os-utils';
|
import osu from 'node-os-utils';
|
||||||
const { version, dependencies } = require('../../../package.json');
|
// @ts-ignore
|
||||||
|
import { version, dependencies } from '../../../package.json';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isSystemCommand: true,
|
isSystemCommand: true,
|
||||||
@@ -16,7 +20,7 @@ module.exports = {
|
|||||||
.setDMPermission(false)
|
.setDMPermission(false)
|
||||||
.setNSFW(false),
|
.setNSFW(false),
|
||||||
execute: async ({ interaction, client, executionId }) => {
|
execute: async ({ interaction, client, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'systemstatus.js',
|
source: 'systemstatus.js',
|
||||||
module: 'slashCommand',
|
module: 'slashCommand',
|
||||||
name: '/systemstatus',
|
name: '/systemstatus',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
const { Events } = require('discord.js');
|
import { Events } from 'discord.js';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.Debug,
|
name: Events.Debug,
|
||||||
@@ -7,8 +8,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (message) => {
|
execute: async (message) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'debug.js',
|
source: 'debug.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'clientDebug',
|
name: 'clientDebug',
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const systemOptions = config.get('systemOptions');
|
const systemOptions = config.get('systemOptions');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
import { EmbedBuilder } from 'discord.js';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'disconnect',
|
name: 'disconnect',
|
||||||
@@ -10,8 +12,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (client) => {
|
execute: async (client) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'disconnect.js',
|
source: 'disconnect.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'clientDisconnect',
|
name: 'clientDisconnect',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
const { Events } = require('discord.js');
|
import { Events } from 'discord.js';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.Error,
|
name: Events.Error,
|
||||||
@@ -7,8 +8,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (error) => {
|
execute: async (error) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'error.js',
|
source: 'error.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'clientError',
|
name: 'clientError',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const { Events } = require('discord.js');
|
import { Events } from 'discord.js';
|
||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.GuildCreate,
|
name: Events.GuildCreate,
|
||||||
@@ -7,8 +8,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (guild) => {
|
execute: async (guild) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'guildCreate.js',
|
source: 'guildCreate.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'guildCreate',
|
name: 'guildCreate',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const { Events } = require('discord.js');
|
import { Events } from 'discord.js';
|
||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.GuildDelete,
|
name: Events.GuildDelete,
|
||||||
@@ -7,8 +8,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (guild) => {
|
execute: async (guild) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'guildDelete.js',
|
source: 'guildDelete.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'guildDelete',
|
name: 'guildDelete',
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const systemOptions = config.get('systemOptions');
|
const systemOptions = config.get('systemOptions');
|
||||||
const presenceStatusOptions = config.get('presenceStatusOptions');
|
const presenceStatusOptions = config.get('presenceStatusOptions');
|
||||||
const loadTestOptions = config.get('loadTestOptions');
|
const loadTestOptions = config.get('loadTestOptions');
|
||||||
const { postBotStats } = require('../../utils/other/postBotStats.js');
|
import { postBotStats } from '../../utils/other/postBotStats';
|
||||||
const { startLoadTest } = require('../../utils/other/startLoadTest');
|
import { startLoadTest } from '../../utils/other/startLoadTest';
|
||||||
const { Events, EmbedBuilder } = require('discord.js');
|
import { Events, EmbedBuilder } from 'discord.js';
|
||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.ClientReady,
|
name: Events.ClientReady,
|
||||||
@@ -14,8 +16,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (client) => {
|
execute: async (client) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'ready.js',
|
source: 'ready.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'clientReady',
|
name: 'clientReady',
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const systemOptions = config.get('systemOptions');
|
const systemOptions = config.get('systemOptions');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
import { EmbedBuilder } from 'discord.js';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'reconnecting',
|
name: 'reconnecting',
|
||||||
@@ -10,8 +12,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (client) => {
|
execute: async (client) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'reconnecting.js',
|
source: 'reconnecting.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'clientReconnecting',
|
name: 'clientReconnecting',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
const { Events } = require('discord.js');
|
import { Events } from 'discord.js';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.Warn,
|
name: Events.Warn,
|
||||||
@@ -7,8 +8,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (warning) => {
|
execute: async (warning) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'warn.js',
|
source: 'warn.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'clientWarn',
|
name: 'clientWarn',
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const botOptions = config.get('botOptions');
|
const botOptions = config.get('botOptions');
|
||||||
const { cannotSendMessageInChannel } = require('../../utils/validation/permissionValidator');
|
import { cannotSendMessageInChannel } from '../../utils/validation/permissionValidator';
|
||||||
const { Events, EmbedBuilder } = require('discord.js');
|
import { Events, EmbedBuilder } from 'discord.js';
|
||||||
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
const { v4: uuidv4 } = require('uuid');
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.InteractionCreate,
|
name: Events.InteractionCreate,
|
||||||
isDebug: false,
|
isDebug: false,
|
||||||
execute: async (interaction, { client }) => {
|
execute: async (interaction, { client }) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'interactionCreate.js',
|
source: 'interactionCreate.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'interactionCreate',
|
name: 'interactionCreate',
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'debug',
|
name: 'debug',
|
||||||
@@ -6,8 +7,7 @@ module.exports = {
|
|||||||
isPlayerEvent: false,
|
isPlayerEvent: false,
|
||||||
execute: async (message) => {
|
execute: async (message) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'generalDebug.js',
|
source: 'generalDebug.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'playerGeneralDebug',
|
name: 'playerGeneralDebug',
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const botOptions = config.get('botOptions');
|
const botOptions = config.get('botOptions');
|
||||||
const systemOptions = config.get('systemOptions');
|
const systemOptions = config.get('systemOptions');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
import { EmbedBuilder } from 'discord.js';
|
||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
// Emitted when the player queue encounters error (general error with queue)
|
// Emitted when the player queue encounters error (general error with queue)
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -12,8 +14,7 @@ module.exports = {
|
|||||||
isPlayerEvent: true,
|
isPlayerEvent: true,
|
||||||
execute: async (queue, error) => {
|
execute: async (queue, error) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'generalError.js',
|
source: 'generalError.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'playerGeneralError',
|
name: 'playerGeneralError',
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'error',
|
name: 'error',
|
||||||
@@ -6,8 +7,7 @@ module.exports = {
|
|||||||
isPlayerEvent: true,
|
isPlayerEvent: true,
|
||||||
execute: async (message) => {
|
execute: async (message) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'playerDebug.js',
|
source: 'playerDebug.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'playerDebug',
|
name: 'playerDebug',
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const botOptions = config.get('botOptions');
|
const botOptions = config.get('botOptions');
|
||||||
const systemOptions = config.get('systemOptions');
|
const systemOptions = config.get('systemOptions');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
import { EmbedBuilder } from 'discord.js';
|
||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
// Emitted when the player encounters an error while streaming audio track
|
// Emitted when the player encounters an error while streaming audio track
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -12,8 +14,7 @@ module.exports = {
|
|||||||
isPlayerEvent: true,
|
isPlayerEvent: true,
|
||||||
execute: async (queue, error) => {
|
execute: async (queue, error) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'playerError.js',
|
source: 'playerError.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'playerError',
|
name: 'playerError',
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const botOptions = config.get('botOptions');
|
const botOptions = config.get('botOptions');
|
||||||
const systemOptions = config.get('systemOptions');
|
const systemOptions = config.get('systemOptions');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
import { EmbedBuilder } from 'discord.js';
|
||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
// Emitted when the audio player fails to load the stream for a track
|
// Emitted when the audio player fails to load the stream for a track
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -12,8 +14,7 @@ module.exports = {
|
|||||||
isPlayerEvent: true,
|
isPlayerEvent: true,
|
||||||
execute: async (queue, track) => {
|
execute: async (queue, track) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'playerSkip.js',
|
source: 'playerSkip.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'playerSkip',
|
name: 'playerSkip',
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'playerStart',
|
name: 'playerStart',
|
||||||
@@ -6,8 +7,7 @@ module.exports = {
|
|||||||
isPlayerEvent: true,
|
isPlayerEvent: true,
|
||||||
execute: async (queue, track) => {
|
execute: async (queue, track) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'playerStart.js',
|
source: 'playerStart.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'playerStart',
|
name: 'playerStart',
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'uncaughtException',
|
name: 'uncaughtException',
|
||||||
isDebug: false,
|
isDebug: false,
|
||||||
execute: async (error) => {
|
execute: async (error) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'uncaughtException.js',
|
source: 'uncaughtException.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'uncaughtException',
|
name: 'uncaughtException',
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'unhandledRejection',
|
name: 'unhandledRejection',
|
||||||
isDebug: false,
|
isDebug: false,
|
||||||
execute: async (error) => {
|
execute: async (error) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
const logger = loggerModule.child({
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
source: 'unhandledRejection.js',
|
source: 'unhandledRejection.js',
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'unhandledRejection',
|
name: 'unhandledRejection',
|
||||||
|
|||||||
+9
-7
@@ -1,9 +1,11 @@
|
|||||||
require('dotenv').config();
|
import 'dotenv/config';
|
||||||
import config from 'config';
|
import config from 'config';
|
||||||
const shardingOptions = config.get('shardingOptions');
|
import { Client, Shard } from 'discord.js';
|
||||||
|
import { ShardingManager, ShardEvents } from 'discord.js';
|
||||||
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import loggerModule from './services/logger';
|
||||||
|
|
||||||
const { ShardingManager, ShardEvents } = require('discord.js');
|
const shardingOptions: object = config.get('shardingOptions');
|
||||||
const { v4: uuidv4 } = require('uuid');
|
|
||||||
|
|
||||||
const manager = new ShardingManager('./dist/bot.js', {
|
const manager = new ShardingManager('./dist/bot.js', {
|
||||||
token: process.env.DISCORD_BOT_TOKEN,
|
token: process.env.DISCORD_BOT_TOKEN,
|
||||||
@@ -12,10 +14,10 @@ const manager = new ShardingManager('./dist/bot.js', {
|
|||||||
|
|
||||||
const readyShards = new Set();
|
const readyShards = new Set();
|
||||||
|
|
||||||
manager.on('shardCreate', (shard) => {
|
manager.on('shardCreate', (shard: Shard) => {
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
|
||||||
const logger = require('./services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'index.js',
|
source: 'index.js',
|
||||||
module: 'shardingManager',
|
module: 'shardingManager',
|
||||||
name: 'shardingManager',
|
name: 'shardingManager',
|
||||||
@@ -29,7 +31,7 @@ manager.on('shardCreate', (shard) => {
|
|||||||
shard.on(ShardEvents.Ready, () => {
|
shard.on(ShardEvents.Ready, () => {
|
||||||
readyShards.add(shard.id);
|
readyShards.add(shard.id);
|
||||||
if (readyShards.size === manager.totalShards) {
|
if (readyShards.size === manager.totalShards) {
|
||||||
manager.broadcastEval((client) => client.emit('allShardsReady'));
|
manager.broadcastEval((client: Client) => client.emit('allShardsReady'));
|
||||||
logger.info('All shards ready, bot is now online.');
|
logger.info('All shards ready, bot is now online.');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -76,5 +76,5 @@ const logLevelConfig = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const logger = pino(logLevelConfig, transport);
|
const logger = pino(logLevelConfig, transport);
|
||||||
|
export default logger;
|
||||||
module.exports = logger;
|
module.exports = logger;
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { Client } from 'discord.js';
|
||||||
|
|
||||||
|
type RegisterClientCommandsFunction = (params: { client: Client; executionId: string }) => void;
|
||||||
|
|
||||||
|
export interface ExtendedClient extends Client {
|
||||||
|
registerClientCommands?: RegisterClientCommandsFunction;
|
||||||
|
}
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
import { ActivityType, PresenceUpdateStatus, ColorResolvable } from 'discord.js';
|
||||||
|
export interface BotOptions {
|
||||||
|
name: string;
|
||||||
|
botInviteUrl: string;
|
||||||
|
serverInviteUrl: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ShardingOptions {
|
||||||
|
totalShards: string;
|
||||||
|
shardList: string;
|
||||||
|
mode: string;
|
||||||
|
respawn: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LoggerOptions {
|
||||||
|
minimumLogLevel: string;
|
||||||
|
minimumLogLevelConsole: string;
|
||||||
|
discordPlayerDebug: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SystemOptions {
|
||||||
|
systemGuildIds: string[];
|
||||||
|
systemMessageChannelId: string;
|
||||||
|
systemUserId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PresenceStatusOptions {
|
||||||
|
status: PresenceUpdateStatus;
|
||||||
|
activities: {
|
||||||
|
name: string;
|
||||||
|
type: ActivityType;
|
||||||
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EmbedOptions {
|
||||||
|
info: {
|
||||||
|
fallbackThumbnailUrl: string;
|
||||||
|
};
|
||||||
|
colors: {
|
||||||
|
success: ColorResolvable;
|
||||||
|
warning: ColorResolvable;
|
||||||
|
error: ColorResolvable;
|
||||||
|
info: ColorResolvable;
|
||||||
|
note: ColorResolvable;
|
||||||
|
};
|
||||||
|
icons: {
|
||||||
|
logo: string;
|
||||||
|
beta: string;
|
||||||
|
new: string;
|
||||||
|
rule: string;
|
||||||
|
support: string;
|
||||||
|
bot: string;
|
||||||
|
server: string;
|
||||||
|
discord: string;
|
||||||
|
audioPlaying: string;
|
||||||
|
audioStartedPlaying: string;
|
||||||
|
success: string;
|
||||||
|
error: string;
|
||||||
|
warning: string;
|
||||||
|
disable: string;
|
||||||
|
enable: string;
|
||||||
|
disabled: string;
|
||||||
|
enabled: string;
|
||||||
|
nextTrack: string;
|
||||||
|
previousTrack: string;
|
||||||
|
pauseResumeTrack: string;
|
||||||
|
shuffleQueue: string;
|
||||||
|
loop: string;
|
||||||
|
loopAction: string;
|
||||||
|
autoplay: string;
|
||||||
|
autoplayAction: string;
|
||||||
|
looping: string;
|
||||||
|
autoplaying: string;
|
||||||
|
skipped: string;
|
||||||
|
back: string;
|
||||||
|
pauseResumed: string;
|
||||||
|
shuffled: string;
|
||||||
|
volume: string;
|
||||||
|
volumeIsMuted: string;
|
||||||
|
volumeChanged: string;
|
||||||
|
volumeMuted: string;
|
||||||
|
queue: string;
|
||||||
|
sourceArbitrary: string;
|
||||||
|
sourceAppleMusic: string;
|
||||||
|
sourceYouTube: string;
|
||||||
|
sourceSoundCloud: string;
|
||||||
|
sourceSpotify: string;
|
||||||
|
liveTrack: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PlayerOptions {
|
||||||
|
leaveOnEmpty: boolean;
|
||||||
|
leaveOnEmptyCooldown: number;
|
||||||
|
leaveOnEnd: boolean;
|
||||||
|
leaveonEndCooldown: number;
|
||||||
|
leaveOnStop: boolean;
|
||||||
|
leaveOnStopCooldown: number;
|
||||||
|
defaultVolume: number;
|
||||||
|
maxQueueSize: number;
|
||||||
|
maxHistorySize: number;
|
||||||
|
bufferingTimeout: number;
|
||||||
|
connectionTimeout: number;
|
||||||
|
progressBar: {
|
||||||
|
length: number;
|
||||||
|
timecodes: boolean;
|
||||||
|
separator: string;
|
||||||
|
indicator: string;
|
||||||
|
leftChar: string;
|
||||||
|
rightChar: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FFmpegFilterOption {
|
||||||
|
label: string;
|
||||||
|
value: string;
|
||||||
|
description: string;
|
||||||
|
emoji: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FFmpegFilterOptions {
|
||||||
|
threadAmount: string;
|
||||||
|
availableFilters: FFmpegFilterOption[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LoadTestOptions {
|
||||||
|
enabled: boolean;
|
||||||
|
trackUrl: string;
|
||||||
|
channelIdsToJoin: string[];
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import { Client } from 'discord.js';
|
||||||
|
|
||||||
|
export interface CreatePlayerParams {
|
||||||
|
client: Client;
|
||||||
|
executionId: string;
|
||||||
|
}
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
require('dotenv').config();
|
import 'dotenv/config';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
const { REST, Routes } = require('discord.js');
|
import { REST, Routes } from 'discord.js';
|
||||||
import config from 'config';
|
import config from 'config';
|
||||||
const { v4: uuidv4 } = require('uuid');
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import loggerModule from '../services/logger';
|
||||||
const systemOptions = config.get('systemOptions');
|
const systemOptions = config.get('systemOptions');
|
||||||
|
|
||||||
const executionId = uuidv4();
|
const executionId = uuidv4();
|
||||||
|
|
||||||
const logger = require('../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'deploySlashCommands.js',
|
source: 'deploySlashCommands.js',
|
||||||
module: 'deploy',
|
module: 'deploy',
|
||||||
name: 'deploySlashCommands',
|
name: 'deploySlashCommands',
|
||||||
@@ -24,6 +25,7 @@ for (const folder of commandFolders) {
|
|||||||
.filter((file) => file.endsWith('.js'));
|
.filter((file) => file.endsWith('.js'));
|
||||||
|
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const command = require(`../commands/${folder}/${file}`);
|
const command = require(`../commands/${folder}/${file}`);
|
||||||
command.isSystemCommand
|
command.isSystemCommand
|
||||||
? systemCommands.push(command.data.toJSON())
|
? systemCommands.push(command.data.toJSON())
|
||||||
@@ -72,7 +74,7 @@ const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_BOT_TOKEN)
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(
|
logger.error(
|
||||||
error,
|
error,
|
||||||
'Failed to refresh system slash commands. Make sure the bot is in the system guilds specified in \'systemOptions\'.'
|
"Failed to refresh system slash commands. Make sure the bot is in the system guilds specified in 'systemOptions'."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import Discord from 'discord.js';
|
import Discord from 'discord.js';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
import { Client } from 'discord.js';
|
||||||
|
|
||||||
exports.createClient = async ({ executionId }) => {
|
export const createClient = async ({ executionId }: { executionId: string }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'createClient.js',
|
source: 'createClient.js',
|
||||||
module: 'utilFactory',
|
module: 'utilFactory',
|
||||||
name: 'createClient',
|
name: 'createClient',
|
||||||
@@ -12,7 +14,7 @@ exports.createClient = async ({ executionId }) => {
|
|||||||
try {
|
try {
|
||||||
logger.debug('Creating discord.js client...');
|
logger.debug('Creating discord.js client...');
|
||||||
|
|
||||||
const client = new Discord.Client({
|
const client: Client = new Discord.Client({
|
||||||
intents: [Discord.GatewayIntentBits.Guilds, Discord.GatewayIntentBits.GuildVoiceStates],
|
intents: [Discord.GatewayIntentBits.Guilds, Discord.GatewayIntentBits.GuildVoiceStates],
|
||||||
makeCache: Discord.Options.cacheWithLimits({
|
makeCache: Discord.Options.cacheWithLimits({
|
||||||
...Discord.Options.DefaultMakeCacheSettings,
|
...Discord.Options.DefaultMakeCacheSettings,
|
||||||
@@ -22,7 +24,7 @@ exports.createClient = async ({ executionId }) => {
|
|||||||
ReactionManager: 0,
|
ReactionManager: 0,
|
||||||
GuildMemberManager: {
|
GuildMemberManager: {
|
||||||
maxSize: 50,
|
maxSize: 50,
|
||||||
keepOverLimit: (member) => member.id === client.user.id
|
keepOverLimit: (member) => member.id === client.user?.id
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
sweepers: {
|
sweepers: {
|
||||||
@@ -33,7 +35,7 @@ exports.createClient = async ({ executionId }) => {
|
|||||||
},
|
},
|
||||||
users: {
|
users: {
|
||||||
interval: 3600,
|
interval: 3600,
|
||||||
filter: () => (user) => user.id !== client.user.id
|
filter: () => (user) => user.id !== client.user?.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
const { Player } = require('discord-player');
|
import { Player } from 'discord-player';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
import { CreatePlayerParams } from '../../types/playerTypes';
|
||||||
|
|
||||||
exports.createPlayer = async ({ client, executionId }) => {
|
export const createPlayer = async ({ client, executionId }: CreatePlayerParams) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'createPlayer.js',
|
source: 'createPlayer.js',
|
||||||
module: 'utilFactory',
|
module: 'utilFactory',
|
||||||
name: 'createPlayer',
|
name: 'createPlayer',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
shardId: client.shard.ids[0]
|
shardId: client.shard?.ids[0]
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -27,6 +29,7 @@ exports.createPlayer = async ({ client, executionId }) => {
|
|||||||
|
|
||||||
// make player accessible from anywhere in the application
|
// make player accessible from anywhere in the application
|
||||||
// primarily to be able to use it in broadcastEval and other sharding methods
|
// primarily to be able to use it in broadcastEval and other sharding methods
|
||||||
|
// @ts-ignore
|
||||||
global.player = player;
|
global.player = player;
|
||||||
|
|
||||||
await player.extractors.loadDefault();
|
await player.extractors.loadDefault();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const cookies = require(path.resolve('./cookies.json'));
|
const cookies = require(path.resolve('./cookies.json'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import https from 'node:https';
|
import https from 'node:https';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
exports.postBotStats = async ({ client, executionId }) => {
|
export const postBotStats = async ({ client, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'postBotStats.js',
|
source: 'postBotStats.js',
|
||||||
module: 'utilOther',
|
module: 'utilOther',
|
||||||
name: 'postBotStats',
|
name: 'postBotStats',
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
const loadTestOptions = config.get('loadTestOptions');
|
const loadTestOptions = config.get('loadTestOptions');
|
||||||
|
|
||||||
exports.startLoadTest = async ({ client, executionId }) => {
|
export const startLoadTest = async ({ client, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'startLoadTest.js',
|
source: 'startLoadTest.js',
|
||||||
module: 'utilOther',
|
module: 'utilOther',
|
||||||
name: 'startLoadTest',
|
name: 'startLoadTest',
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
const { Collection } = require('discord.js');
|
import { Collection } from 'discord.js';
|
||||||
|
import loggerModule from '../services/logger';
|
||||||
|
|
||||||
exports.registerClientCommands = ({ client, executionId }) => {
|
export const registerClientCommands = ({ client, executionId }) => {
|
||||||
const logger = require('../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'registerClientCommands.js',
|
source: 'registerClientCommands.js',
|
||||||
module: 'register',
|
module: 'register',
|
||||||
name: 'registerClientCommands',
|
name: 'registerClientCommands',
|
||||||
@@ -27,6 +28,7 @@ exports.registerClientCommands = ({ client, executionId }) => {
|
|||||||
delete require.cache[require.resolve(`../commands/${folder}/${file}`)];
|
delete require.cache[require.resolve(`../commands/${folder}/${file}`)];
|
||||||
|
|
||||||
// register command
|
// register command
|
||||||
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const command = require(`../commands/${folder}/${file}`);
|
const command = require(`../commands/${folder}/${file}`);
|
||||||
client.commands.delete(command.data.name);
|
client.commands.delete(command.data.name);
|
||||||
client.commands.set(command.data.name, command);
|
client.commands.set(command.data.name, command);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import config from 'config';
|
import config from 'config';
|
||||||
|
import loggerModule from '../services/logger';
|
||||||
const loggerOptions = config.get('loggerOptions');
|
const loggerOptions = config.get('loggerOptions');
|
||||||
|
|
||||||
exports.registerEventListeners = ({ client, player, executionId }) => {
|
export const registerEventListeners = ({ client, player, executionId }) => {
|
||||||
const logger = require('../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'registerEventListeners.js',
|
source: 'registerEventListeners.js',
|
||||||
module: 'register',
|
module: 'register',
|
||||||
name: 'registerEventListeners',
|
name: 'registerEventListeners',
|
||||||
@@ -24,6 +24,7 @@ exports.registerEventListeners = ({ client, player, executionId }) => {
|
|||||||
.filter((file) => file.endsWith('.js'));
|
.filter((file) => file.endsWith('.js'));
|
||||||
|
|
||||||
for (const file of eventFiles) {
|
for (const file of eventFiles) {
|
||||||
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const event = require(`../events/${folder}/${file}`);
|
const event = require(`../events/${folder}/${file}`);
|
||||||
switch (folder) {
|
switch (folder) {
|
||||||
case 'client':
|
case 'client':
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
exports.getUptimeFormatted = async ({ executionId }) => {
|
import loggerModule from '../../services/logger';
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
|
export const getUptimeFormatted = async ({ executionId }) => {
|
||||||
|
const logger = loggerModule.child({
|
||||||
source: 'getUptimeFormatted.js',
|
source: 'getUptimeFormatted.js',
|
||||||
module: 'utilSystem',
|
module: 'utilSystem',
|
||||||
name: 'getUptimeFormatted',
|
name: 'getUptimeFormatted',
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
const { EmbedBuilder } = require('discord.js');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
import { EmbedBuilder } from 'discord.js';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
exports.cannotJoinVoiceOrTalk = async ({ interaction, executionId }) => {
|
export const cannotJoinVoiceOrTalk = async ({ interaction, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'permissionValidator.js',
|
source: 'permissionValidator.js',
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'cannotJoinVoiceOrTalk',
|
name: 'cannotJoinVoiceOrTalk',
|
||||||
@@ -34,8 +36,8 @@ exports.cannotJoinVoiceOrTalk = async ({ interaction, executionId }) => {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.cannotSendMessageInChannel = async ({ interaction, executionId }) => {
|
export const cannotSendMessageInChannel = async ({ interaction, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'permissionValidator.js',
|
source: 'permissionValidator.js',
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'cannotSendMessageInChannel',
|
name: 'cannotSendMessageInChannel',
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
const { EmbedBuilder } = require('discord.js');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
import { EmbedBuilder } from 'discord.js';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
|
|
||||||
exports.queueDoesNotExist = async ({ interaction, queue, executionId }) => {
|
export const queueDoesNotExist = async ({ interaction, queue, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'queueValidator.js',
|
source: 'queueValidator.js',
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'queueDoesNotExist',
|
name: 'queueDoesNotExist',
|
||||||
@@ -30,8 +32,8 @@ exports.queueDoesNotExist = async ({ interaction, queue, executionId }) => {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.queueNoCurrentTrack = async ({ interaction, queue, executionId }) => {
|
export const queueNoCurrentTrack = async ({ interaction, queue, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'queueValidator.js',
|
source: 'queueValidator.js',
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'queueNoCurrentTrack',
|
name: 'queueNoCurrentTrack',
|
||||||
@@ -58,8 +60,8 @@ exports.queueNoCurrentTrack = async ({ interaction, queue, executionId }) => {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.queueIsEmpty = async ({ interaction, queue, executionId }) => {
|
export const queueIsEmpty = async ({ interaction, queue, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'queueValidator.js',
|
source: 'queueValidator.js',
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'queueIsEmpty',
|
name: 'queueIsEmpty',
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
exports.transformQuery = async ({ query, executionId }) => {
|
import loggerModule from '../../services/logger';
|
||||||
const logger = require('../../services/logger').child({
|
|
||||||
|
export const transformQuery = async ({ query, executionId }) => {
|
||||||
|
const logger = loggerModule.child({
|
||||||
source: 'searchQueryValidator.js',
|
source: 'searchQueryValidator.js',
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'transformQuery',
|
name: 'transformQuery',
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
import config from 'config';
|
import loggerModule from '../../services/logger';
|
||||||
const embedOptions = config.get('embedOptions');
|
|
||||||
const systemOptions = config.get('systemOptions');
|
|
||||||
const { EmbedBuilder } = require('discord.js');
|
|
||||||
|
|
||||||
exports.notValidGuildId = async ({ interaction, executionId }) => {
|
import config from 'config';
|
||||||
const logger = require('../../services/logger').child({
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
const systemOptions = config.get('systemOptions');
|
||||||
|
import { EmbedBuilder } from 'discord.js';
|
||||||
|
|
||||||
|
export const notValidGuildId = async ({ interaction, executionId }) => {
|
||||||
|
const logger = loggerModule.child({
|
||||||
source: 'systemCommandValidator.js',
|
source: 'systemCommandValidator.js',
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'notValidGuildId',
|
name: 'notValidGuildId',
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
|
import loggerModule from '../../services/logger';
|
||||||
import config from 'config';
|
import config from 'config';
|
||||||
const embedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
import { EmbedBuilder } from 'discord.js';
|
||||||
|
|
||||||
exports.notInVoiceChannel = async ({ interaction, executionId }) => {
|
export const notInVoiceChannel = async ({ interaction, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'voiceChannelValidator.js',
|
source: 'voiceChannelValidator.js',
|
||||||
module: 'validator',
|
module: 'validator',
|
||||||
name: 'notInVoiceChannel',
|
name: 'notInVoiceChannel',
|
||||||
@@ -30,8 +32,8 @@ exports.notInVoiceChannel = async ({ interaction, executionId }) => {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.notInSameVoiceChannel = async ({ interaction, queue, executionId }) => {
|
export const notInSameVoiceChannel = async ({ interaction, queue, executionId }) => {
|
||||||
const logger = require('../../services/logger').child({
|
const logger = loggerModule.child({
|
||||||
source: 'voiceChannelValidator.js',
|
source: 'voiceChannelValidator.js',
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'notInSameVoiceChannel',
|
name: 'notInSameVoiceChannel',
|
||||||
|
|||||||
+1
-1
@@ -9,6 +9,6 @@
|
|||||||
"skipLibCheck": true, // Skip type checking of declaration files
|
"skipLibCheck": true, // Skip type checking of declaration files
|
||||||
"forceConsistentCasingInFileNames": true // Disallow inconsistently-cased references to the same file
|
"forceConsistentCasingInFileNames": true // Disallow inconsistently-cased references to the same file
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts"], // Source files to be compiled
|
"include": ["src/**/*.ts", "src/types/**/*.ts"], // Source files to be compiled
|
||||||
"exclude": ["node_modules"] // Exclude node_modules from compilation
|
"exclude": ["node_modules"] // Exclude node_modules from compilation
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user