mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +00:00
update logger exports
This commit is contained in:
1 parent
cdf37ce503
commit
e1b0aea7fc
62 files changed
+114
-152
No files matched your search
+2
-3
@@ -5,8 +5,7 @@ import 'dotenv/config';
|
|||||||
import { Player } from 'discord-player';
|
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 { loggerService, Logger } from './common/services/logger';
|
||||||
import loggerModule from './common/services/logger';
|
|
||||||
import { ExtendedClient } from './types/clientTypes';
|
import { ExtendedClient } from './types/clientTypes';
|
||||||
import { createClient } from './common/factory/createClient';
|
import { createClient } from './common/factory/createClient';
|
||||||
import { createPlayer } from './common/factory/createPlayer';
|
import { createPlayer } from './common/factory/createPlayer';
|
||||||
@@ -14,7 +13,7 @@ import { registerClientInteractions } from './startup/registerClientInteractions
|
|||||||
import { registerEventListeners } from './startup/registerEventListeners';
|
import { registerEventListeners } from './startup/registerEventListeners';
|
||||||
|
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'shardingClient',
|
module: 'shardingClient',
|
||||||
name: 'shardingClient',
|
name: 'shardingClient',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ import {
|
|||||||
SlashCommandBuilder,
|
SlashCommandBuilder,
|
||||||
SlashCommandSubcommandsOnlyBuilder
|
SlashCommandSubcommandsOnlyBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { loggerService, Logger } 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,
|
||||||
@@ -45,7 +44,7 @@ abstract class BaseInteraction {
|
|||||||
executionId: string,
|
executionId: string,
|
||||||
interaction: Interaction | MessageComponentInteraction
|
interaction: Interaction | MessageComponentInteraction
|
||||||
): Logger {
|
): Logger {
|
||||||
return loggerModule.child({
|
return loggerService.child({
|
||||||
module: module,
|
module: module,
|
||||||
name: name,
|
name: name,
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import Discord, { Client } from 'discord.js';
|
import Discord, { Client } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { loggerService, Logger } 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 = loggerService.child({
|
||||||
module: 'utilFactory',
|
module: 'utilFactory',
|
||||||
name: 'createClient',
|
name: 'createClient',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
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 { loggerService, Logger } 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> => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'utilFactory',
|
module: 'utilFactory',
|
||||||
name: 'createPlayer',
|
name: 'createPlayer',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import { usePrismaClient } from './prismaClient';
|
import { usePrismaClient } from './prismaClient';
|
||||||
import loggerModule from './logger';
|
import { loggerService, Logger } from './logger';
|
||||||
import { Logger } from 'pino';
|
|
||||||
import { Interaction, MessageComponentInteraction } from 'discord.js';
|
import { Interaction, MessageComponentInteraction } from 'discord.js';
|
||||||
|
|
||||||
const prisma = usePrismaClient();
|
const prisma = usePrismaClient();
|
||||||
|
|
||||||
function getLogger(executionId: string, interaction?: Interaction | MessageComponentInteraction): Logger {
|
function getLogger(executionId: string, interaction?: Interaction | MessageComponentInteraction): Logger {
|
||||||
return loggerModule.child({
|
return loggerService.child({
|
||||||
module: 'databaseService',
|
module: 'databaseService',
|
||||||
name: 'guildDatabaseService',
|
name: 'guildDatabaseService',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* 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 as PinoLogger, LoggerOptions } from 'pino';
|
||||||
import { CustomLoggerOptions } from '../../types/configTypes';
|
import { CustomLoggerOptions } from '../../types/configTypes';
|
||||||
import { TargetOptions } from '../../types/serviceTypes';
|
import { TargetOptions } from '../../types/serviceTypes';
|
||||||
|
|
||||||
@@ -103,5 +103,6 @@ const logLevelConfig: LoggerOptions = {
|
|||||||
base: defaultProperties
|
base: defaultProperties
|
||||||
};
|
};
|
||||||
|
|
||||||
const logger: Logger = pino(logLevelConfig, transport);
|
export type Logger = PinoLogger;
|
||||||
export default logger;
|
export const loggerService: Logger = pino(logLevelConfig, transport);
|
||||||
|
export default loggerService;
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
import { Logger } from 'pino';
|
import { loggerService, Logger } from '../services/logger';
|
||||||
import loggerModule from '../services/logger';
|
|
||||||
import { GetUptimeFormattedParams } from '../../types/utilTypes';
|
import { GetUptimeFormattedParams } from '../../types/utilTypes';
|
||||||
import { formatDuration } from './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 = loggerService.child({
|
||||||
module: 'utilSystem',
|
module: 'utilSystem',
|
||||||
name: 'getUptimeFormatted',
|
name: 'getUptimeFormatted',
|
||||||
executionId: executionId
|
executionId: executionId
|
||||||
|
|||||||
@@ -8,16 +8,15 @@ import {
|
|||||||
VoiceBasedChannel,
|
VoiceBasedChannel,
|
||||||
VoiceChannel
|
VoiceChannel
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
|
||||||
import { InteractionValidationError } from '../classes/interactions';
|
import { InteractionValidationError } from '../classes/interactions';
|
||||||
import loggerModule from '../services/logger';
|
import { loggerService, Logger } 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 '../utils/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) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'cannotJoinVoiceOrTalk',
|
name: 'cannotJoinVoiceOrTalk',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
@@ -63,7 +62,7 @@ export const checkVoicePermissionJoinAndTalk = async ({ interaction, executionId
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const checkChannelPermissionViewable = async ({ interaction, executionId }: ValidatorParams) => {
|
export const checkChannelPermissionViewable = async ({ interaction, executionId }: ValidatorParams) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'cannotSendMessageInChannel',
|
name: 'cannotSendMessageInChannel',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
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 { InteractionValidationError } from '../classes/interactions';
|
import { InteractionValidationError } from '../classes/interactions';
|
||||||
import loggerModule from '../services/logger';
|
import { loggerService, Logger } 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 '../utils/localeUtil';
|
import { useServerTranslator } from '../utils/localeUtil';
|
||||||
@@ -10,7 +9,7 @@ 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) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'queueDoesNotExist',
|
name: 'queueDoesNotExist',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
@@ -52,7 +51,7 @@ export const checkQueueExists = async ({ interaction, queue, executionId }: Vali
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const checkHistoryExists = async ({ interaction, history, executionId }: ValidatorParams) => {
|
export const checkHistoryExists = async ({ interaction, history, executionId }: ValidatorParams) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'historyDoesNotExist',
|
name: 'historyDoesNotExist',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
@@ -94,7 +93,7 @@ export const checkHistoryExists = async ({ interaction, history, executionId }:
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const checkQueueCurrentTrack = async ({ interaction, queue, executionId }: ValidatorParams) => {
|
export const checkQueueCurrentTrack = async ({ interaction, queue, executionId }: ValidatorParams) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'queueNoCurrentTrack',
|
name: 'queueNoCurrentTrack',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
@@ -136,7 +135,7 @@ export const checkQueueCurrentTrack = async ({ interaction, queue, executionId }
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const checkQueueEmpty = async ({ interaction, queue, executionId }: ValidatorParams) => {
|
export const checkQueueEmpty = async ({ interaction, queue, executionId }: ValidatorParams) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'queueIsEmpty',
|
name: 'queueIsEmpty',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { Logger } from 'pino';
|
import { loggerService, Logger } 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) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'transformQuery',
|
name: 'transformQuery',
|
||||||
executionId: executionId
|
executionId: executionId
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
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 { InteractionValidationError } from '../classes/interactions';
|
import { InteractionValidationError } from '../classes/interactions';
|
||||||
import loggerModule from '../services/logger';
|
import { loggerService, Logger } 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 '../utils/localeUtil';
|
import { useServerTranslator } from '../utils/localeUtil';
|
||||||
@@ -11,7 +10,7 @@ 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');
|
||||||
export const checkValidGuildId = async ({ interaction, executionId }: ValidatorParams) => {
|
export const checkValidGuildId = async ({ interaction, executionId }: ValidatorParams) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'notValidGuildId',
|
name: 'notValidGuildId',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
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 { InteractionValidationError } from '../classes/interactions';
|
import { InteractionValidationError } from '../classes/interactions';
|
||||||
import loggerModule from '../services/logger';
|
import { loggerService, Logger } 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 '../utils/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) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'validator',
|
module: 'validator',
|
||||||
name: 'notInVoiceChannel',
|
name: 'notInVoiceChannel',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
@@ -47,7 +46,7 @@ export const checkInVoiceChannel = async ({ interaction, executionId }: Validato
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const checkSameVoiceChannel = async ({ interaction, queue, executionId }: ValidatorParams) => {
|
export const checkSameVoiceChannel = async ({ interaction, queue, executionId }: ValidatorParams) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'utilValidation',
|
module: 'utilValidation',
|
||||||
name: 'notInSameVoiceChannel',
|
name: 'notInSameVoiceChannel',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
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 { loggerService, Logger } from '../../common/services/logger';
|
||||||
import loggerModule from '../../common/services/logger';
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.Debug,
|
name: Events.Debug,
|
||||||
@@ -9,7 +8,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (message: string) => {
|
execute: async (message: string) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'clientDebug',
|
name: 'clientDebug',
|
||||||
executionId: executionId
|
executionId: executionId
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
|
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
|
||||||
import { randomUUID as uuidv4 } from 'node:crypto';
|
import { randomUUID as uuidv4 } from 'node:crypto';
|
||||||
import { Logger } from 'pino';
|
import { loggerService, Logger } from '../../common/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';
|
||||||
|
|
||||||
@@ -14,7 +13,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (client: ExtendedClient) => {
|
execute: async (client: ExtendedClient) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'clientDisconnect',
|
name: 'clientDisconnect',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
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 { loggerService, Logger } from '../../common/services/logger';
|
||||||
import loggerModule from '../../common/services/logger';
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.Error,
|
name: Events.Error,
|
||||||
@@ -9,7 +8,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (error: Error) => {
|
execute: async (error: Error) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'clientError',
|
name: 'clientError',
|
||||||
executionId: executionId
|
executionId: executionId
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
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 { loggerService, Logger } from '../../common/services/logger';
|
||||||
import loggerModule from '../../common/services/logger';
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.GuildCreate,
|
name: Events.GuildCreate,
|
||||||
@@ -9,7 +8,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (guild: Guild) => {
|
execute: async (guild: Guild) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'guildCreate',
|
name: 'guildCreate',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
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 { loggerService, Logger } from '../../common/services/logger';
|
||||||
import loggerModule from '../../common/services/logger';
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.GuildDelete,
|
name: Events.GuildDelete,
|
||||||
@@ -9,7 +8,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (guild: Guild) => {
|
execute: async (guild: Guild) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'guildDelete',
|
name: 'guildDelete',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
import { BaseGuildTextChannel, EmbedBuilder, Events, PresenceData } from 'discord.js';
|
import { BaseGuildTextChannel, EmbedBuilder, Events, PresenceData } from 'discord.js';
|
||||||
import { randomUUID as uuidv4 } from 'node:crypto';
|
import { randomUUID as uuidv4 } from 'node:crypto';
|
||||||
import { Logger } from 'pino';
|
import { loggerService, Logger } from '../../common/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 '../../startup/postBotStats';
|
import { postBotStats } from '../../startup/postBotStats';
|
||||||
@@ -18,7 +17,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (client: ExtendedClient) => {
|
execute: async (client: ExtendedClient) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'clientReady',
|
name: 'clientReady',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
@@ -26,7 +25,7 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
logger.debug("Client 'ready' event received after 'allShardsReady' event.");
|
logger.debug("Client 'ready' event received after 'allShardsReady' event.");
|
||||||
await client.user?.setPresence(presenceStatusOptions);
|
client.user?.setPresence(presenceStatusOptions);
|
||||||
|
|
||||||
if (loadTestOptions.enabled) {
|
if (loadTestOptions.enabled) {
|
||||||
// Only call function from shard with id 0
|
// Only call function from shard with id 0
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
|
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
|
||||||
import { randomUUID as uuidv4 } from 'node:crypto';
|
import { randomUUID as uuidv4 } from 'node:crypto';
|
||||||
import { Logger } from 'pino';
|
import { loggerService, Logger } from '../../common/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';
|
||||||
|
|
||||||
@@ -14,7 +13,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (client: ExtendedClient) => {
|
execute: async (client: ExtendedClient) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'clientReconnecting',
|
name: 'clientReconnecting',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
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 { loggerService, Logger } from '../../common/services/logger';
|
||||||
import loggerModule from '../../common/services/logger';
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.Warn,
|
name: Events.Warn,
|
||||||
@@ -9,7 +8,7 @@ module.exports = {
|
|||||||
once: false,
|
once: false,
|
||||||
execute: async (warning: string) => {
|
execute: async (warning: string) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'clientWarn',
|
name: 'clientWarn',
|
||||||
executionId: executionId
|
executionId: executionId
|
||||||
|
|||||||
@@ -7,13 +7,12 @@ import {
|
|||||||
MessageComponentInteraction
|
MessageComponentInteraction
|
||||||
} 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 { CustomError } from '../../common/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 '../../common/services/logger';
|
import { loggerService, Logger } from '../../common/services/logger';
|
||||||
import { ExtendedClient } from '../../types/clientTypes';
|
import { ExtendedClient } from '../../types/clientTypes';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -22,7 +21,7 @@ module.exports = {
|
|||||||
execute: async (interaction: Interaction, { client }: { client: ExtendedClient }) => {
|
execute: async (interaction: Interaction, { client }: { client: ExtendedClient }) => {
|
||||||
const inputTime: number = new Date().getTime();
|
const inputTime: number = new Date().getTime();
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'interactionCreate',
|
name: 'interactionCreate',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { randomUUID as uuidv4 } from 'node:crypto';
|
import { randomUUID as uuidv4 } from 'node:crypto';
|
||||||
import { Logger } from 'pino';
|
import { loggerService, Logger } from '../../common/services/logger';
|
||||||
import loggerModule from '../../common/services/logger';
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'debug',
|
name: 'debug',
|
||||||
@@ -8,7 +7,7 @@ module.exports = {
|
|||||||
isPlayerEvent: false,
|
isPlayerEvent: false,
|
||||||
execute: async (message: string) => {
|
execute: async (message: string) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'playerGeneralDebug',
|
name: 'playerGeneralDebug',
|
||||||
executionId: executionId
|
executionId: executionId
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
|
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
|
||||||
import { randomUUID as uuidv4 } from 'node:crypto';
|
import { randomUUID as uuidv4 } from 'node:crypto';
|
||||||
import { Logger } from 'pino';
|
import { loggerService, Logger } from '../../common/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/utils/localeUtil';
|
import { useLanguageTranslator } from '../../common/utils/localeUtil';
|
||||||
@@ -17,7 +16,7 @@ module.exports = {
|
|||||||
isPlayerEvent: true,
|
isPlayerEvent: true,
|
||||||
execute: async (queue: ExtendedGuildQueuePlayerNode, error: Error) => {
|
execute: async (queue: ExtendedGuildQueuePlayerNode, error: Error) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'playerGeneralError',
|
name: 'playerGeneralError',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { randomUUID as uuidv4 } from 'node:crypto';
|
import { randomUUID as uuidv4 } from 'node:crypto';
|
||||||
import { Logger } from 'pino';
|
import { loggerService, Logger } from '../../common/services/logger';
|
||||||
import loggerModule from '../../common/services/logger';
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'error',
|
name: 'error',
|
||||||
@@ -8,7 +7,7 @@ module.exports = {
|
|||||||
isPlayerEvent: true,
|
isPlayerEvent: true,
|
||||||
execute: async (message: string) => {
|
execute: async (message: string) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'playerDebug',
|
name: 'playerDebug',
|
||||||
executionId: executionId
|
executionId: executionId
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
|
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
|
||||||
import { randomUUID as uuidv4 } from 'node:crypto';
|
import { randomUUID as uuidv4 } from 'node:crypto';
|
||||||
import { Logger } from 'pino';
|
import { loggerService, Logger } from '../../common/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/utils/localeUtil';
|
import { useLanguageTranslator } from '../../common/utils/localeUtil';
|
||||||
@@ -18,7 +17,7 @@ module.exports = {
|
|||||||
isPlayerEvent: true,
|
isPlayerEvent: true,
|
||||||
execute: async (queue: ExtendedGuildQueuePlayerNode, error: Error) => {
|
execute: async (queue: ExtendedGuildQueuePlayerNode, error: Error) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'playerError',
|
name: 'playerError',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
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 '../../common/services/logger';
|
import { loggerService, Logger } 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';
|
|
||||||
|
|
||||||
// Emitted when the audio player finish playing a track.
|
// Emitted when the audio player finish playing a track.
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -12,7 +11,7 @@ module.exports = {
|
|||||||
isPlayerEvent: true,
|
isPlayerEvent: true,
|
||||||
execute: async (queue: ExtendedGuildQueuePlayerNode, track: Track) => {
|
execute: async (queue: ExtendedGuildQueuePlayerNode, track: Track) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'playerFinish',
|
name: 'playerFinish',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ import config from 'config';
|
|||||||
import { Track, TrackSkipReason } from 'discord-player';
|
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 { loggerService, Logger } from '../../common/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/utils/localeUtil';
|
import { useLanguageTranslator } from '../../common/utils/localeUtil';
|
||||||
@@ -24,7 +23,7 @@ module.exports = {
|
|||||||
description: string
|
description: string
|
||||||
) => {
|
) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'playerSkip',
|
name: 'playerSkip',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ 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 '../../common/services/logger';
|
import { loggerService, Logger } from '../../common/services/logger';
|
||||||
import { Track } from 'discord-player';
|
import { Track } from 'discord-player';
|
||||||
import { Logger } from 'pino';
|
|
||||||
import config from 'config';
|
import config from 'config';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -14,7 +13,7 @@ module.exports = {
|
|||||||
isPlayerEvent: true,
|
isPlayerEvent: true,
|
||||||
execute: async (queue: ExtendedGuildQueuePlayerNode, track: Track) => {
|
execute: async (queue: ExtendedGuildQueuePlayerNode, track: Track) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'playerStart',
|
name: 'playerStart',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
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 { loggerService, Logger } from '../../common/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';
|
||||||
|
|
||||||
@@ -12,7 +11,7 @@ module.exports = {
|
|||||||
isPlayerEvent: true,
|
isPlayerEvent: true,
|
||||||
execute: async (queue: ExtendedGuildQueuePlayerNode, tracks: Track[], done: (track: Track) => void) => {
|
execute: async (queue: ExtendedGuildQueuePlayerNode, tracks: Track[], done: (track: Track) => void) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'willAutoPlay',
|
name: 'willAutoPlay',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import { randomUUID as uuidv4 } from 'node:crypto';
|
import { randomUUID as uuidv4 } from 'node:crypto';
|
||||||
import { Logger } from 'pino';
|
import { loggerService, Logger } from '../../common/services/logger';
|
||||||
import loggerModule from '../../common/services/logger';
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'uncaughtException',
|
name: 'uncaughtException',
|
||||||
isDebug: false,
|
isDebug: false,
|
||||||
execute: async (error: Error) => {
|
execute: async (error: Error) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'uncaughtException',
|
name: 'uncaughtException',
|
||||||
executionId: executionId
|
executionId: executionId
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import { randomUUID as uuidv4 } from 'node:crypto';
|
import { randomUUID as uuidv4 } from 'node:crypto';
|
||||||
import { Logger } from 'pino';
|
import { loggerService, Logger } from '../../common/services/logger';
|
||||||
import loggerModule from '../../common/services/logger';
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'unhandledRejection',
|
name: 'unhandledRejection',
|
||||||
isDebug: false,
|
isDebug: false,
|
||||||
execute: async (error: Error) => {
|
execute: async (error: Error) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'event',
|
module: 'event',
|
||||||
name: 'unhandledRejection',
|
name: 'unhandledRejection',
|
||||||
executionId: executionId
|
executionId: executionId
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { AutocompleteInteraction } from 'discord.js';
|
import { AutocompleteInteraction } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
|
||||||
import { BaseAutocompleteInteraction } from '../common/classes/interactions';
|
import { BaseAutocompleteInteraction } from '../common/classes/interactions';
|
||||||
import loggerModule from '../common/services/logger';
|
import { loggerService, Logger } from '../common/services/logger';
|
||||||
import { ExtendedClient } from '../types/clientTypes';
|
import { ExtendedClient } from '../types/clientTypes';
|
||||||
|
|
||||||
export const handleAutocomplete = async (
|
export const handleAutocomplete = async (
|
||||||
@@ -11,7 +10,7 @@ export const handleAutocomplete = async (
|
|||||||
interactionIdentifier: string
|
interactionIdentifier: string
|
||||||
) => {
|
) => {
|
||||||
// TODO: Define TS Type for handlers, and require logger constant?
|
// TODO: Define TS Type for handlers, and require logger constant?
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'handler',
|
module: 'handler',
|
||||||
name: 'interactionAutocompleteHandler',
|
name: 'interactionAutocompleteHandler',
|
||||||
executionId: executionId
|
executionId: executionId
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { ChatInputCommandInteraction } from 'discord.js';
|
import { ChatInputCommandInteraction } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
|
||||||
import { BaseSlashCommandInteraction } from '../common/classes/interactions';
|
import { BaseSlashCommandInteraction } from '../common/classes/interactions';
|
||||||
import loggerModule from '../common/services/logger';
|
import { loggerService, Logger } from '../common/services/logger';
|
||||||
import { ExtendedClient } from '../types/clientTypes';
|
import { ExtendedClient } from '../types/clientTypes';
|
||||||
import { checkChannelPermissionViewable } from '../common/validation/permissionValidator';
|
import { checkChannelPermissionViewable } from '../common/validation/permissionValidator';
|
||||||
|
|
||||||
@@ -11,7 +10,7 @@ export const handleCommand = async (
|
|||||||
executionId: string,
|
executionId: string,
|
||||||
interactionIdentifier: string
|
interactionIdentifier: string
|
||||||
) => {
|
) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'handler',
|
module: 'handler',
|
||||||
name: 'interactionCommandHandler',
|
name: 'interactionCommandHandler',
|
||||||
executionId: executionId
|
executionId: executionId
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { MessageComponentInteraction } from 'discord.js';
|
import { MessageComponentInteraction } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
|
||||||
import { BaseComponentInteraction } from '../common/classes/interactions';
|
import { BaseComponentInteraction } from '../common/classes/interactions';
|
||||||
import loggerModule from '../common/services/logger';
|
import { loggerService, Logger } from '../common/services/logger';
|
||||||
import { ExtendedClient } from '../types/clientTypes';
|
import { ExtendedClient } from '../types/clientTypes';
|
||||||
import { checkChannelPermissionViewable } from '../common/validation/permissionValidator';
|
import { checkChannelPermissionViewable } from '../common/validation/permissionValidator';
|
||||||
|
|
||||||
@@ -11,7 +10,7 @@ export const handleComponent = async (
|
|||||||
executionId: string,
|
executionId: string,
|
||||||
interactionIdentifier: string
|
interactionIdentifier: string
|
||||||
) => {
|
) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'handler',
|
module: 'handler',
|
||||||
name: 'interactionComponentHandler',
|
name: 'interactionComponentHandler',
|
||||||
executionId: executionId
|
executionId: executionId
|
||||||
|
|||||||
@@ -7,9 +7,8 @@ import {
|
|||||||
InteractionType,
|
InteractionType,
|
||||||
MessageComponentInteraction
|
MessageComponentInteraction
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
|
||||||
import { CustomError, InteractionValidationError } from '../common/classes/interactions';
|
import { CustomError, InteractionValidationError } from '../common/classes/interactions';
|
||||||
import loggerModule from '../common/services/logger';
|
import { loggerService, Logger } from '../common/services/logger';
|
||||||
import { BotOptions, EmbedOptions } from '../types/configTypes';
|
import { BotOptions, EmbedOptions } from '../types/configTypes';
|
||||||
import { useServerTranslator } from '../common/utils/localeUtil';
|
import { useServerTranslator } from '../common/utils/localeUtil';
|
||||||
|
|
||||||
@@ -22,7 +21,7 @@ export const handleError = async (
|
|||||||
executionId: string,
|
executionId: string,
|
||||||
interactionIdentifier: string
|
interactionIdentifier: string
|
||||||
) => {
|
) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'handler',
|
module: 'handler',
|
||||||
name: 'interactionErrorHandler',
|
name: 'interactionErrorHandler',
|
||||||
executionId: executionId
|
executionId: executionId
|
||||||
|
|||||||
+3
-4
@@ -5,8 +5,7 @@ import config from 'config';
|
|||||||
import { Client, Shard, ShardEvents, ShardingManager, ShardingManagerOptions } from 'discord.js';
|
import { Client, Shard, ShardEvents, ShardingManager, ShardingManagerOptions } from 'discord.js';
|
||||||
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 { loggerService, Logger } from './common/services/logger';
|
||||||
import loggerModule from './common/services/logger';
|
|
||||||
import { usePrismaClient } from './common/services/prismaClient';
|
import { usePrismaClient } from './common/services/prismaClient';
|
||||||
const shardingOptions: ShardingManagerOptions = config.get('shardingOptions');
|
const shardingOptions: ShardingManagerOptions = config.get('shardingOptions');
|
||||||
|
|
||||||
@@ -20,7 +19,7 @@ const readyShards: Set<number> = new Set();
|
|||||||
manager.on('shardCreate', (shard: Shard) => {
|
manager.on('shardCreate', (shard: Shard) => {
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
|
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'shardingManager',
|
module: 'shardingManager',
|
||||||
name: 'shardingManager',
|
name: 'shardingManager',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
@@ -64,7 +63,7 @@ manager.on('shardCreate', (shard: Shard) => {
|
|||||||
|
|
||||||
exec('ffmpeg -version', (error) => {
|
exec('ffmpeg -version', (error) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'shardingManager',
|
module: 'shardingManager',
|
||||||
name: 'shardingManager',
|
name: 'shardingManager',
|
||||||
shardId: 'manager'
|
shardId: 'manager'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
|
import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
|
||||||
import { Player, SearchResult, useMainPlayer } from 'discord-player';
|
import { Player, SearchResult, useMainPlayer } from 'discord-player';
|
||||||
import { ApplicationCommandOptionChoiceData } from 'discord.js';
|
import { ApplicationCommandOptionChoiceData } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { BaseAutocompleteInteraction } from '../../common/classes/interactions';
|
import { BaseAutocompleteInteraction } from '../../common/classes/interactions';
|
||||||
import { getTrackName, isQueryTooShort, shouldUseLastQuery } from '../../common/utils/autocompleteUtils';
|
import { getTrackName, isQueryTooShort, shouldUseLastQuery } from '../../common/utils/autocompleteUtils';
|
||||||
import { BaseAutocompleteParams, BaseAutocompleteReturnType, RecentQuery } from '../../types/interactionTypes';
|
import { BaseAutocompleteParams, BaseAutocompleteReturnType, RecentQuery } from '../../types/interactionTypes';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { BaseComponentInteraction } from '../../common/classes/interactions';
|
|||||||
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { useServerTranslator } from '../../common/utils/localeUtil';
|
import { useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
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 '../../common/services/logger';
|
||||||
import { BaseComponentInteraction } from '../../common/classes/interactions';
|
import { BaseComponentInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../common/validation/queueValidator';
|
import { checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
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, InteractionResponse, StringSelectMenuInteraction } from 'discord.js';
|
import { EmbedBuilder, InteractionResponse, StringSelectMenuInteraction } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { BaseComponentInteraction } from '../../common/classes/interactions';
|
import { BaseComponentInteraction } from '../../common/classes/interactions';
|
||||||
import {
|
import {
|
||||||
EqualizerFilterOptions,
|
EqualizerFilterOptions,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
|||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkHistoryExists, checkQueueCurrentTrack } from '../../common/validation/queueValidator';
|
import { checkHistoryExists, checkQueueCurrentTrack } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
StringSelectMenuBuilder,
|
StringSelectMenuBuilder,
|
||||||
StringSelectMenuOptionBuilder
|
StringSelectMenuOptionBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import {
|
import {
|
||||||
BiquadFilterOptions,
|
BiquadFilterOptions,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
EmbedFooterData,
|
EmbedFooterData,
|
||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkHistoryExists } from '../../common/validation/queueValidator';
|
import { checkHistoryExists } from '../../common/validation/queueValidator';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
|||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkInVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
import { checkInVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { checkVoicePermissionJoinAndTalk } from '../../common/validation/permissionValidator';
|
import { checkVoicePermissionJoinAndTalk } from '../../common/validation/permissionValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
SlashCommandBuilder,
|
SlashCommandBuilder,
|
||||||
SlashCommandIntegerOption
|
SlashCommandIntegerOption
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../common/validation/queueValidator';
|
import { checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
|
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 '../../common/services/logger';
|
||||||
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
|||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
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 '../../common/services/logger';
|
||||||
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
Message,
|
Message,
|
||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { BaseSlashCommandInteraction, CustomError } from '../../common/classes/interactions';
|
import { BaseSlashCommandInteraction, CustomError } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkVoicePermissionJoinAndTalk } from '../../common/validation/permissionValidator';
|
import { checkVoicePermissionJoinAndTalk } from '../../common/validation/permissionValidator';
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
EmbedFooterData,
|
EmbedFooterData,
|
||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../common/validation/queueValidator';
|
import { checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { BaseSlashCommandInteraction } from '../../common/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';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
|||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../common/validation/queueValidator';
|
import { checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
|||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
import { formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ 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 '../../common/validation/systemCommandValidator';
|
import { checkValidGuildId } from '../../common/validation/systemCommandValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { localizeCommand } from '../../common/utils/localeUtil';
|
import { localizeCommand } from '../../common/utils/localeUtil';
|
||||||
|
|
||||||
class ShardsCommand extends BaseSlashCommandInteraction {
|
class ShardsCommand extends BaseSlashCommandInteraction {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
|||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/utils/formattingUtils';
|
import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/utils/formattingUtils';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
|||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../common/validation/queueValidator';
|
import { checkQueueExists } from '../../common/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from '../../common/services/logger';
|
||||||
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ import 'dotenv/config';
|
|||||||
import { randomUUID as uuidv4 } from 'node:crypto';
|
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 '../common/services/logger';
|
||||||
import { BaseSlashCommandInteraction } from '../common/classes/interactions';
|
import { BaseSlashCommandInteraction } from '../common/classes/interactions';
|
||||||
import loggerModule from '../common/services/logger';
|
import { loggerService } 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');
|
||||||
|
|
||||||
const executionId: string = uuidv4();
|
const executionId: string = uuidv4();
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'deploy',
|
module: 'deploy',
|
||||||
name: 'deploySlashCommands',
|
name: 'deploySlashCommands',
|
||||||
executionId: executionId
|
executionId: executionId
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import { Client } from 'discord.js';
|
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 { loggerService, Logger } from '../common/services/logger';
|
||||||
import loggerModule from '../common/services/logger';
|
|
||||||
import { PostBotStatsParams, PostBotStatsSite } from '../types/utilTypes';
|
import { PostBotStatsParams, PostBotStatsSite } from '../types/utilTypes';
|
||||||
import { fetchTotalGuildStatistics } from '../common/utils/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 = loggerService.child({
|
||||||
module: 'utilOther',
|
module: 'utilOther',
|
||||||
name: 'postBotStats',
|
name: 'postBotStats',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import { Collection } from 'discord.js';
|
import { Collection } from 'discord.js';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { Logger } from 'pino';
|
import { loggerService, Logger } from '../common/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';
|
||||||
|
|
||||||
export const registerClientInteractions = async ({ client, executionId }: RegisterClientInteractionsParams) => {
|
export const registerClientInteractions = async ({ client, executionId }: RegisterClientInteractionsParams) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'register',
|
module: 'register',
|
||||||
name: 'registerClientInteractions',
|
name: 'registerClientInteractions',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ import { GuildQueueEvents, Player, PlayerEvents } from 'discord-player';
|
|||||||
import { Client } from 'discord.js';
|
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 { loggerService, Logger } from '../common/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';
|
||||||
@@ -42,7 +41,7 @@ const registerPlayerEventListeners = (player: Player, event: CustomEvent, logger
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const registerEventListeners = async ({ client, player, executionId }: RegisterEventListenersParams) => {
|
export const registerEventListeners = async ({ client, player, executionId }: RegisterEventListenersParams) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'register',
|
module: 'register',
|
||||||
name: 'registerEventListeners',
|
name: 'registerEventListeners',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
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 { loggerService, Logger } from '../common/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');
|
||||||
|
|
||||||
export const startLoadTest = async ({ client, executionId }: StartLoadTestParams) => {
|
export const startLoadTest = async ({ client, executionId }: StartLoadTestParams) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerService.child({
|
||||||
module: 'utilOther',
|
module: 'utilOther',
|
||||||
name: 'startLoadTest',
|
name: 'startLoadTest',
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ChatInputCommandInteraction } from 'discord.js';
|
|||||||
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
|
||||||
import { ExtendedClient } from '../../types/clientTypes';
|
import { ExtendedClient } from '../../types/clientTypes';
|
||||||
import { checkChannelPermissionViewable } from '../../common/validation/permissionValidator';
|
import { checkChannelPermissionViewable } from '../../common/validation/permissionValidator';
|
||||||
import loggerModule from '../../common/services/logger';
|
import { loggerService } from '../../common/services/logger';
|
||||||
|
|
||||||
jest.mock('../../common/validation/permissionValidator');
|
jest.mock('../../common/validation/permissionValidator');
|
||||||
jest.mock('../../common/services/logger', () => ({
|
jest.mock('../../common/services/logger', () => ({
|
||||||
@@ -47,7 +47,7 @@ describe('interactionCommandHandler', () => {
|
|||||||
|
|
||||||
it('should handle command correctly when slash command is not found', async () => {
|
it('should handle command correctly when slash command is not found', async () => {
|
||||||
const loggerSpy = jest.spyOn(
|
const loggerSpy = jest.spyOn(
|
||||||
loggerModule.child({ module: 'handler', name: 'interactionCommandHandler', executionId: executionId }),
|
loggerService.child({ module: 'handler', name: 'interactionCommandHandler', executionId: executionId }),
|
||||||
'warn'
|
'warn'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user