try fix again

This commit is contained in:
DjDeveloperr 2021-01-01 13:46:22 +05:30
parent 432555e2fb
commit 33f103279d
2 changed files with 5 additions and 3 deletions

View File

@ -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)
}
}

View File

@ -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)
})
}