From f3199c59d5870482617ef3b7230cba18bfef0e0e Mon Sep 17 00:00:00 2001 From: Matthew R Date: Tue, 14 Apr 2020 21:34:09 -0400 Subject: [PATCH] add ready event w/ listeners for error events --- src/events/ready.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/events/ready.ts diff --git a/src/events/ready.ts b/src/events/ready.ts new file mode 100644 index 0000000..142f42b --- /dev/null +++ b/src/events/ready.ts @@ -0,0 +1,23 @@ +import { Client } from '../class'; + +export default class { + public client: Client; + + constructor(client: Client) { + this.client = client; + } + + public async run() { + this.client.util.signale.start(`${this.client.user.username} is now ready!\nServers: ${this.client.guilds.size}\nUsers: ${this.client.users.size}\n\nhttps://gitlab.libraryofcode.org/engineering/communityrelations`); + this.client.on('error', (err) => { + this.client.util.handleError(err); + }); + process.on('uncaughtException', (err) => { + this.client.util.handleError(err); + process.exit(1); + }); + process.on('unhandledRejection', (err) => { + this.client.util.handleError(new Error(err.toString())); + }); + } +}