From 33f103279dd28aa2827b30fc600c2d4782a89be5 Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Fri, 1 Jan 2021 13:46:22 +0530 Subject: [PATCH] try fix again --- src/models/client.ts | 4 +--- src/models/slashClient.ts | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/models/client.ts b/src/models/client.ts index 4aff966..f1ff54a 100644 --- a/src/models/client.ts +++ b/src/models/client.ts @@ -368,8 +368,6 @@ export function slashModule() { return function (client: Client | SlashClient, prop: string) { if (client._decoratedSlashModules === undefined) client._decoratedSlashModules = [] - - const mod = ((client as unknown) as { [key: string]: any })[prop] - client._decoratedSlashModules.push(mod) + client._decoratedSlashModules.push(prop) } } diff --git a/src/models/slashClient.ts b/src/models/slashClient.ts index 06beaef..f2e550b 100644 --- a/src/models/slashClient.ts +++ b/src/models/slashClient.ts @@ -398,6 +398,10 @@ export class SlashClient { if (this._decoratedSlashModules !== undefined) { this._decoratedSlashModules.forEach((e) => { const mod = ((this as unknown) as { [name: string]: SlashModule })[e] + if (!(mod instanceof SlashModule)) + throw new Error( + '@slashModule can only be used on SlashModule instances' + ) this.modules.push(mod) }) }