aboutsummaryrefslogtreecommitdiff
path: root/src/listeners/other
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-04 16:26:56 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-04 16:26:56 -0400
commit153a40fbcd314459f94d9a2b44d3466c930c4e35 (patch)
tree5c853355da693e68c393b38c0c66a1f84ef0ac89 /src/listeners/other
parentcf564dbb6435886f97e2e9870363144386af368d (diff)
downloadtanzanite-153a40fbcd314459f94d9a2b44d3466c930c4e35.tar.gz
tanzanite-153a40fbcd314459f94d9a2b44d3466c930c4e35.tar.bz2
tanzanite-153a40fbcd314459f94d9a2b44d3466c930c4e35.zip
cleaned up
Diffstat (limited to 'src/listeners/other')
-rw-r--r--src/listeners/other/consoleListener.ts40
-rw-r--r--src/listeners/other/promiseRejection.ts4
2 files changed, 28 insertions, 16 deletions
diff --git a/src/listeners/other/consoleListener.ts b/src/listeners/other/consoleListener.ts
index 98f44e2..b3d30ad 100644
--- a/src/listeners/other/consoleListener.ts
+++ b/src/listeners/other/consoleListener.ts
@@ -1,3 +1,4 @@
+/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { BushListener } from '../../lib/extensions/discord-akairo/BushListener';
@@ -10,26 +11,37 @@ export default class ConsoleListener extends BushListener {
}
public async exec(line: string): Promise<void> {
- const bot = this.client;
- if (line.startsWith('eval ')) {
+ if (line.startsWith('eval ') || line.startsWith('ev ')) {
+ const bot = this.client,
+ config = this.client.config,
+ client = this.client,
+ { Ban, Global, Guild, Level, ModLog, StickyRole } = await import('../../lib/models/index.js'),
+ {
+ ButtonInteraction,
+ Collector,
+ CommandInteraction,
+ Interaction,
+ Message,
+ MessageActionRow,
+ MessageAttachment,
+ MessageButton,
+ MessageCollector,
+ MessageComponentInteractionCollector,
+ MessageEmbed,
+ MessageSelectMenu,
+ ReactionCollector,
+ Util
+ } = require('discord.js');
try {
- const input = line.replace('eval ', '');
+ const input = line.replace('eval ', '').replace('ev ', '');
let output = eval(input);
output = await output;
console.log(output);
} catch (e) {
- console.error(e);
- }
- }
- if (line.startsWith('ev ')) {
- try {
- const input = line.replace('ev ', '');
- let output = eval(input);
- output = await output;
- console.log(output);
- } catch (e) {
- console.error(e);
+ console.error(e?.stack || e);
}
+ } else if (line.startsWith('stop')) {
+ process.exit(0);
}
}
}
diff --git a/src/listeners/other/promiseRejection.ts b/src/listeners/other/promiseRejection.ts
index 06a8e1e..228c65d 100644
--- a/src/listeners/other/promiseRejection.ts
+++ b/src/listeners/other/promiseRejection.ts
@@ -9,12 +9,12 @@ export default class PromiseRejectionListener extends BushListener {
}
public async exec(error: Error): Promise<void> {
- this.client.console.error('PromiseRejection', 'An unhanded promise rejection occurred:\n' + error.stack, false);
+ this.client.console.error('PromiseRejection', `An unhanded promise rejection occurred:\n${error?.stack || error}`, false);
this.client.console.channelError({
embeds: [
{
title: 'Unhandled promise rejection',
- fields: [{ name: 'error', value: await this.client.util.codeblock(error.stack, 1024, 'js') }],
+ fields: [{ name: 'error', value: await this.client.util.codeblock(`${error?.stack || error}`, 1024, 'js') }],
color: this.client.util.colors.error
}
]