aboutsummaryrefslogtreecommitdiff
path: root/src/listeners/other
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-17 20:03:05 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-17 20:03:05 -0400
commite1c613829950a534d9f45c00a033b83575be3b3c (patch)
tree2de1e5231217211ae4087c46cc74dc46c584507a /src/listeners/other
parent0e87bbd3940d89defcb04926587b35c8f4d1947f (diff)
downloadtanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.tar.gz
tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.tar.bz2
tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.zip
remove global client variable
Diffstat (limited to 'src/listeners/other')
-rw-r--r--src/listeners/other/consoleListener.ts5
-rw-r--r--src/listeners/other/exit.ts2
-rw-r--r--src/listeners/other/promiseRejection.ts12
-rw-r--r--src/listeners/other/uncaughtException.ts8
-rw-r--r--src/listeners/other/warning.ts8
5 files changed, 20 insertions, 15 deletions
diff --git a/src/listeners/other/consoleListener.ts b/src/listeners/other/consoleListener.ts
index 543f459..3e72e9e 100644
--- a/src/listeners/other/consoleListener.ts
+++ b/src/listeners/other/consoleListener.ts
@@ -15,8 +15,9 @@ import { promisify } from 'util';
if (line.startsWith('eval ') || line.startsWith('ev ')) {
/* eslint-disable @typescript-eslint/no-unused-vars */
const sh = promisify(exec),
- bot = client,
- config = client.config,
+ bot = this.client,
+ client = this.client,
+ config = this.client.config,
{ ActivePunishment, Global, Guild, Level, ModLog, StickyRole } = await import('#lib'),
{
ButtonInteraction,
diff --git a/src/listeners/other/exit.ts b/src/listeners/other/exit.ts
index e16aeb7..ac074df 100644
--- a/src/listeners/other/exit.ts
+++ b/src/listeners/other/exit.ts
@@ -9,6 +9,6 @@ export default class ExitListener extends BushListener {
}
public async exec(code: number) {
- await client.console.error('processExit', `Process ended with code <<${code}>>.`);
+ await this.client.console.error('processExit', `Process ended with code <<${code}>>.`);
}
}
diff --git a/src/listeners/other/promiseRejection.ts b/src/listeners/other/promiseRejection.ts
index 79bf5de..ab67ad4 100644
--- a/src/listeners/other/promiseRejection.ts
+++ b/src/listeners/other/promiseRejection.ts
@@ -16,14 +16,18 @@ export default class PromiseRejectionListener extends BushListener {
process.removeListener('unhandledRejection', listener);
});
- client.sentry.captureException(error, {
+ this.client.sentry.captureException(error, {
level: 'error'
});
- void client.console.error('promiseRejection', `An unhanded promise rejection occurred:\n${formatError(error, true)}`, false);
+ void this.client.console.error(
+ 'promiseRejection',
+ `An unhanded promise rejection occurred:\n${formatError(error, true)}`,
+ false
+ );
if (!error.message.includes('reason: getaddrinfo ENOTFOUND canary.discord.com'))
- void client.console.channelError({
- embeds: await CommandErrorListener.generateErrorEmbed({ type: 'unhandledRejection', error: error })
+ void this.client.console.channelError({
+ embeds: await CommandErrorListener.generateErrorEmbed(this.client, { type: 'unhandledRejection', error: error })
});
}
}
diff --git a/src/listeners/other/uncaughtException.ts b/src/listeners/other/uncaughtException.ts
index 3e80feb..e06a3b8 100644
--- a/src/listeners/other/uncaughtException.ts
+++ b/src/listeners/other/uncaughtException.ts
@@ -15,13 +15,13 @@ export default class UncaughtExceptionListener extends BushListener {
if (listener.toString() === this.exec.toString()) return;
process.removeListener('uncaughtException', listener);
});
- client.sentry.captureException(error, {
+ this.client.sentry.captureException(error, {
level: 'error'
});
- void client.console.error('uncaughtException', `An uncaught exception occurred:\n${formatError(error, true)}`, false);
- void client.console.channelError({
- embeds: await CommandErrorListener.generateErrorEmbed({ type: 'uncaughtException', error: error })
+ void this.client.console.error('uncaughtException', `An uncaught exception occurred:\n${formatError(error, true)}`, false);
+ void this.client.console.channelError({
+ embeds: await CommandErrorListener.generateErrorEmbed(this.client, { type: 'uncaughtException', error: error })
});
}
}
diff --git a/src/listeners/other/warning.ts b/src/listeners/other/warning.ts
index ba38f5f..b427e4c 100644
--- a/src/listeners/other/warning.ts
+++ b/src/listeners/other/warning.ts
@@ -12,15 +12,15 @@ export default class WarningListener extends BushListener {
public async exec(error: Error) {
if (error.name === 'ExperimentalWarning') return;
- client.sentry.captureException(error, {
+ this.client.sentry.captureException(error, {
level: 'warning'
});
- void client.console.warn('warning', `A warning occurred:\n${formatError(error, true)}`, false);
+ void this.client.console.warn('warning', `A warning occurred:\n${formatError(error, true)}`, false);
- const embeds = await CommandErrorListener.generateErrorEmbed({ type: 'unhandledRejection', error: error });
+ const embeds = await CommandErrorListener.generateErrorEmbed(this.client, { type: 'unhandledRejection', error: error });
embeds[0].setColor(colors.warn).setTitle('A Warning Occurred');
- void client.console.channelError({ embeds });
+ void this.client.console.channelError({ embeds });
}
}