diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-08-24 15:58:13 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-08-24 15:58:13 -0400 |
commit | 423fb144a0209c7acb74dc756faa37e19b7aa905 (patch) | |
tree | 0b1af0e794efabf51ee0f86c3b56cd66627f619a /src/lib/extensions/discord-akairo/BushClient.ts | |
parent | 9390b3f59b18dc3576f9c169c8fc586be14bcdc5 (diff) | |
download | tanzanite-423fb144a0209c7acb74dc756faa37e19b7aa905.tar.gz tanzanite-423fb144a0209c7acb74dc756faa37e19b7aa905.tar.bz2 tanzanite-423fb144a0209c7acb74dc756faa37e19b7aa905.zip |
some fixes and hacky fetch member work arround
Diffstat (limited to 'src/lib/extensions/discord-akairo/BushClient.ts')
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClient.ts | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index ee92ded..54392fd 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -1,5 +1,5 @@ import chalk from 'chalk'; -import { AkairoClient } from 'discord-akairo'; +import { AkairoClient, ContextMenuCommandHandler } from 'discord-akairo'; import { Collection, Intents, @@ -14,6 +14,8 @@ import { Structures, WebhookEditMessageOptions } from 'discord.js'; +//@ts-ignore: no typings +import eventsIntercept from 'events-intercept'; import JSON5 from 'json5'; import 'json5/lib/register'; import path from 'path'; @@ -138,6 +140,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re public inhibitorHandler: BushInhibitorHandler; public commandHandler: BushCommandHandler; public taskHandler: BushTaskHandler; + public contextMenuCommandHandler: ContextMenuCommandHandler; public declare util: BushClientUtil; public declare ownerID: Snowflake[]; public db: Sequelize; @@ -177,7 +180,8 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re // Create task handler this.taskHandler = new BushTaskHandler(this, { - directory: path.join(__dirname, '..', '..', '..', 'tasks') + directory: path.join(__dirname, '..', '..', '..', 'tasks'), + automateCategories: true }); // Create command handler @@ -210,7 +214,13 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re }, automateCategories: false, - autoRegisterSlashCommands: true + autoRegisterSlashCommands: true, + skipBuiltInPostInhibitors: false + }); + + this.contextMenuCommandHandler = new ContextMenuCommandHandler(this, { + directory: path.join(__dirname, '..', '..', '..', 'context-menu-commands'), + automateCategories: true }); this.util = new BushClientUtil(this); @@ -259,6 +269,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re // loads all the handlers const loaders = { commands: this.commandHandler, + contextMenuCommand: this.contextMenuCommandHandler, listeners: this.listenerHandler, inhibitors: this.inhibitorHandler, tasks: this.taskHandler @@ -299,6 +310,18 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re /** Starts the bot */ public async start(): Promise<void> { + // eslint-disable-next-line @typescript-eslint/no-this-alias + const that = this; + eventsIntercept.patch(this); + //@ts-ignore: no typings + this.intercept('ready', async (arg, done) => { + const promises = that.guilds.cache.map((guild) => { + return guild.members.fetch(); + }); + await Promise.all(promises); + return done(null, 'intercepted ' + arg); + }); + // global objects global.client = this; global.util = this.util; |