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