mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-02 06:28:54 +00:00
feat: removed source property from logger
This commit is contained in:
1 parent
72ae790cf8
commit
9aaba5ea40
37 files changed
+17
-55
No files matched your search
@@ -14,7 +14,6 @@ import { Logger } from 'pino';
|
||||
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'bot.js',
|
||||
module: 'shardingClient',
|
||||
name: 'shardingClient',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -11,7 +11,6 @@ module.exports = {
|
||||
execute: async (message: string) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'debug.js',
|
||||
module: 'event',
|
||||
name: 'clientDebug',
|
||||
executionId: executionId
|
||||
|
||||
@@ -16,7 +16,6 @@ module.exports = {
|
||||
execute: async (client: ExtendedClient) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'disconnect.js',
|
||||
module: 'event',
|
||||
name: 'clientDisconnect',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -11,7 +11,6 @@ module.exports = {
|
||||
execute: async (error: Error) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'error.js',
|
||||
module: 'event',
|
||||
name: 'clientError',
|
||||
executionId: executionId
|
||||
|
||||
@@ -11,7 +11,6 @@ module.exports = {
|
||||
execute: async (guild: Guild) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'guildCreate.js',
|
||||
module: 'event',
|
||||
name: 'guildCreate',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -11,7 +11,6 @@ module.exports = {
|
||||
execute: async (guild: Guild) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'guildDelete.js',
|
||||
module: 'event',
|
||||
name: 'guildDelete',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -20,7 +20,6 @@ module.exports = {
|
||||
execute: async (client: ExtendedClient) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'ready.js',
|
||||
module: 'event',
|
||||
name: 'clientReady',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -16,7 +16,6 @@ module.exports = {
|
||||
execute: async (client: ExtendedClient) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'reconnecting.js',
|
||||
module: 'event',
|
||||
name: 'clientReconnecting',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -10,7 +10,6 @@ module.exports = {
|
||||
execute: async (warning: string) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'warn.js',
|
||||
module: 'event',
|
||||
name: 'clientWarn',
|
||||
executionId: executionId
|
||||
|
||||
@@ -23,7 +23,6 @@ module.exports = {
|
||||
const inputTime: number = new Date().getTime();
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'interactionCreate.js',
|
||||
module: 'event',
|
||||
name: 'interactionCreate',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -9,7 +9,6 @@ module.exports = {
|
||||
execute: async (message: string) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'generalDebug.js',
|
||||
module: 'event',
|
||||
name: 'playerGeneralDebug',
|
||||
executionId: executionId
|
||||
|
||||
@@ -17,7 +17,6 @@ module.exports = {
|
||||
execute: async (queue: ExtendedGuildQueuePlayerNode, error: Error) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'generalError.js',
|
||||
module: 'event',
|
||||
name: 'playerGeneralError',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -9,7 +9,6 @@ module.exports = {
|
||||
execute: async (message: string) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'playerDebug.js',
|
||||
module: 'event',
|
||||
name: 'playerDebug',
|
||||
executionId: executionId
|
||||
|
||||
@@ -17,7 +17,6 @@ module.exports = {
|
||||
execute: async (queue: ExtendedGuildQueuePlayerNode, error: Error) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'playerError.js',
|
||||
module: 'event',
|
||||
name: 'playerError',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -18,7 +18,6 @@ module.exports = {
|
||||
execute: async (queue: ExtendedGuildQueuePlayerNode, track: Track) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'playerSkip.js',
|
||||
module: 'event',
|
||||
name: 'playerSkip',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -11,7 +11,6 @@ module.exports = {
|
||||
execute: async (queue: ExtendedGuildQueuePlayerNode, track: Track) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'playerStart.js',
|
||||
module: 'event',
|
||||
name: 'playerStart',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -8,7 +8,6 @@ module.exports = {
|
||||
execute: async (error: Error) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'uncaughtException.js',
|
||||
module: 'event',
|
||||
name: 'uncaughtException',
|
||||
executionId: executionId
|
||||
|
||||
@@ -8,7 +8,6 @@ module.exports = {
|
||||
execute: async (error: Error) => {
|
||||
const executionId: string = uuidv4();
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'unhandledRejection.js',
|
||||
module: 'event',
|
||||
name: 'unhandledRejection',
|
||||
executionId: executionId
|
||||
|
||||
@@ -12,7 +12,6 @@ export const handleAutocomplete = async (
|
||||
) => {
|
||||
// TODO: Define TS Type for handlers, and require logger constant?
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'interactionAutocompleteHandler.ts',
|
||||
module: 'handler',
|
||||
name: 'interactionAutocompleteHandler',
|
||||
executionId: executionId
|
||||
|
||||
@@ -12,7 +12,6 @@ export const handleCommand = async (
|
||||
interactionIdentifier: string
|
||||
) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'interactionCommandHandler.ts',
|
||||
module: 'handler',
|
||||
name: 'interactionCommandHandler',
|
||||
executionId: executionId
|
||||
|
||||
@@ -12,7 +12,6 @@ export const handleComponent = async (
|
||||
interactionIdentifier: string
|
||||
) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'interactionComponentHandler.js',
|
||||
module: 'handler',
|
||||
name: 'interactionComponentHandler',
|
||||
executionId: executionId
|
||||
|
||||
@@ -22,7 +22,6 @@ export const handleError = async (
|
||||
interactionIdentifier: string
|
||||
) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'interactionErrorHandler.ts',
|
||||
module: 'handler',
|
||||
name: 'interactionErrorHandler',
|
||||
executionId: executionId
|
||||
|
||||
@@ -21,7 +21,6 @@ manager.on('shardCreate', (shard: Shard) => {
|
||||
const executionId: string = uuidv4();
|
||||
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'index.js',
|
||||
module: 'shardingManager',
|
||||
name: 'shardingManager',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -11,7 +11,7 @@ class ReloadCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('reload')
|
||||
.setDescription('Reload all slash commands across shards.');
|
||||
.setDescription('Reload slash command, autocomplete and component interactions across shards.');
|
||||
const isSystemCommand: boolean = true;
|
||||
super(data, isSystemCommand);
|
||||
}
|
||||
@@ -25,7 +25,7 @@ class ReloadCommand extends BaseSlashCommandInteraction {
|
||||
}
|
||||
|
||||
try {
|
||||
logger.debug('Reloading commands across all shards.');
|
||||
logger.debug('Reloading interaction module across all shards.');
|
||||
await client!
|
||||
.shard!.broadcastEval(
|
||||
async (shardClient: ExtendedClient, { executionId }) => {
|
||||
@@ -34,10 +34,10 @@ class ReloadCommand extends BaseSlashCommandInteraction {
|
||||
{ context: { executionId: executionId } }
|
||||
)
|
||||
.then(() => {
|
||||
logger.debug('Successfully reloaded commands across all shards.');
|
||||
logger.debug('Successfully reloaded interaction module across all shards.');
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error(error, 'Failed to reload commands across shards.');
|
||||
logger.error(error, 'Failed to reload interaction module across shards.');
|
||||
|
||||
logger.debug('Responding with error embed.');
|
||||
return await interaction.editReply({
|
||||
@@ -45,7 +45,7 @@ class ReloadCommand extends BaseSlashCommandInteraction {
|
||||
new EmbedBuilder()
|
||||
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.error} Oops!**\n_Hmm.._ It seems I am unable to reload commands across shards.`
|
||||
`**${this.embedOptions.icons.error} Oops!**\n_Hmm.._ It seems I am unable to reload interaction module across shards.`
|
||||
)
|
||||
.setColor(this.embedOptions.colors.error)
|
||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||
@@ -53,19 +53,21 @@ class ReloadCommand extends BaseSlashCommandInteraction {
|
||||
});
|
||||
}
|
||||
|
||||
const commands: string[] | undefined = client!.slashCommandInteractions?.map((command: BaseSlashCommandInteraction) => {
|
||||
let params: string = '';
|
||||
const commands: string[] | undefined = client!.slashCommandInteractions?.map(
|
||||
(command: BaseSlashCommandInteraction) => {
|
||||
let params: string = '';
|
||||
|
||||
if (command.data.options && command.data.options.length > 1) {
|
||||
const options = command.data.options as unknown as ApplicationCommandOptionData[];
|
||||
if (command.data.options && command.data.options.length > 1) {
|
||||
const options = command.data.options as unknown as ApplicationCommandOptionData[];
|
||||
|
||||
options.map((option: ApplicationCommandOption) => {
|
||||
params += `**\`${option.name}\`**` + ' ';
|
||||
});
|
||||
options.map((option: ApplicationCommandOption) => {
|
||||
params += `**\`${option.name}\`**` + ' ';
|
||||
});
|
||||
}
|
||||
|
||||
return `- **\`/${command.data.name}\`** ${params}- ${command.data.description}`;
|
||||
}
|
||||
|
||||
return `- **\`/${command.data.name}\`** ${params}- ${command.data.description}`;
|
||||
});
|
||||
);
|
||||
|
||||
const embedDescription: string =
|
||||
`**${this.embedOptions.icons.bot} Reloaded commands**\n` + commands?.join('\n');
|
||||
|
||||
@@ -15,7 +15,6 @@ const systemOptions: SystemOptions = config.get('systemOptions');
|
||||
const executionId: string = uuidv4();
|
||||
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'deploySlashCommands.js',
|
||||
module: 'deploy',
|
||||
name: 'deploySlashCommands',
|
||||
executionId: executionId
|
||||
|
||||
@@ -5,7 +5,6 @@ import { Logger } from 'pino';
|
||||
|
||||
export const createClient = async ({ executionId }: { executionId: string }) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'createClient.js',
|
||||
module: 'utilFactory',
|
||||
name: 'createClient',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -6,7 +6,6 @@ import { Logger } from 'pino';
|
||||
|
||||
export const createPlayer = async ({ client, executionId }: CreatePlayerParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'createPlayer.js',
|
||||
module: 'utilFactory',
|
||||
name: 'createPlayer',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -8,7 +8,6 @@ import { ClientRequest, ClientRequestArgs } from 'node:http';
|
||||
|
||||
export const postBotStats = async ({ client, executionId }: PostBotStatsParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'postBotStats.js',
|
||||
module: 'utilOther',
|
||||
name: 'postBotStats',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -10,7 +10,6 @@ const loadTestOptions: LoadTestOptions = config.get('loadTestOptions');
|
||||
|
||||
export const startLoadTest = async ({ client, executionId }: StartLoadTestParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'startLoadTest.js',
|
||||
module: 'utilOther',
|
||||
name: 'startLoadTest',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -9,7 +9,6 @@ import { ExtendedClient } from '../types/clientTypes';
|
||||
|
||||
export const registerClientInteractions = async ({ client, executionId }: RegisterClientInteractionsParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'registerClientInteractions.js',
|
||||
module: 'register',
|
||||
name: 'registerClientInteractions',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -44,7 +44,6 @@ const registerPlayerEventListeners = (player: Player, event: CustomEvent, logger
|
||||
|
||||
export const registerEventListeners = async ({ client, player, executionId }: RegisterEventListenersParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'registerEventListeners.js',
|
||||
module: 'register',
|
||||
name: 'registerEventListeners',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -4,7 +4,6 @@ import { GetUptimeFormattedParams } from '../../types/utilTypes';
|
||||
|
||||
export const getUptimeFormatted = async ({ executionId }: GetUptimeFormattedParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'getUptimeFormatted.js',
|
||||
module: 'utilSystem',
|
||||
name: 'getUptimeFormatted',
|
||||
executionId: executionId
|
||||
|
||||
@@ -17,7 +17,6 @@ import { CannotJoinVoiceOrTalkParams, CannotSendMessageInChannelParams } from '.
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
export const cannotJoinVoiceOrTalk = async ({ interaction, executionId }: CannotJoinVoiceOrTalkParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'permissionValidator.js',
|
||||
module: 'utilValidation',
|
||||
name: 'cannotJoinVoiceOrTalk',
|
||||
executionId: executionId,
|
||||
@@ -52,7 +51,6 @@ export const cannotJoinVoiceOrTalk = async ({ interaction, executionId }: Cannot
|
||||
|
||||
export const cannotSendMessageInChannel = async ({ interaction, executionId }: CannotSendMessageInChannelParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'permissionValidator.js',
|
||||
module: 'utilValidation',
|
||||
name: 'cannotSendMessageInChannel',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -9,7 +9,6 @@ import { Logger } from 'pino';
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
export const queueDoesNotExist = async ({ interaction, queue, executionId }: QueueDoesNotExistParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'queueValidator.js',
|
||||
module: 'utilValidation',
|
||||
name: 'queueDoesNotExist',
|
||||
executionId: executionId,
|
||||
@@ -40,7 +39,6 @@ export const queueDoesNotExist = async ({ interaction, queue, executionId }: Que
|
||||
|
||||
export const queueNoCurrentTrack = async ({ interaction, queue, executionId }: QueueNoCurrentTrackParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'queueValidator.js',
|
||||
module: 'utilValidation',
|
||||
name: 'queueNoCurrentTrack',
|
||||
executionId: executionId,
|
||||
@@ -71,7 +69,6 @@ export const queueNoCurrentTrack = async ({ interaction, queue, executionId }: Q
|
||||
|
||||
export const queueIsEmpty = async ({ interaction, queue, executionId }: QueueIsEmptyParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'queueValidator.js',
|
||||
module: 'utilValidation',
|
||||
name: 'queueIsEmpty',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -4,7 +4,6 @@ import { TransformQueryParams } from '../../types/utilTypes';
|
||||
|
||||
export const transformQuery = async ({ query, executionId }: TransformQueryParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'searchQueryValidator.js',
|
||||
module: 'utilValidation',
|
||||
name: 'transformQuery',
|
||||
executionId: executionId
|
||||
|
||||
@@ -10,7 +10,6 @@ const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
const systemOptions: SystemOptions = config.get('systemOptions');
|
||||
export const notValidGuildId = async ({ interaction, executionId }: NotValidGuildIdParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'systemCommandValidator.js',
|
||||
module: 'utilValidation',
|
||||
name: 'notValidGuildId',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -9,7 +9,6 @@ import { NotInSameVoiceChannelParams, NotInVoiceChannelParams } from '../../type
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
export const notInVoiceChannel = async ({ interaction, executionId }: NotInVoiceChannelParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'voiceChannelValidator.js',
|
||||
module: 'validator',
|
||||
name: 'notInVoiceChannel',
|
||||
executionId: executionId,
|
||||
@@ -40,7 +39,6 @@ export const notInVoiceChannel = async ({ interaction, executionId }: NotInVoice
|
||||
|
||||
export const notInSameVoiceChannel = async ({ interaction, queue, executionId }: NotInSameVoiceChannelParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'voiceChannelValidator.js',
|
||||
module: 'utilValidation',
|
||||
name: 'notInSameVoiceChannel',
|
||||
executionId: executionId,
|
||||
|
||||
Reference in new issue
Block a user