try fix again
This commit is contained in:
parent
432555e2fb
commit
33f103279d
|
@ -368,8 +368,6 @@ export function slashModule() {
|
||||||
return function (client: Client | SlashClient, prop: string) {
|
return function (client: Client | SlashClient, prop: string) {
|
||||||
if (client._decoratedSlashModules === undefined)
|
if (client._decoratedSlashModules === undefined)
|
||||||
client._decoratedSlashModules = []
|
client._decoratedSlashModules = []
|
||||||
|
client._decoratedSlashModules.push(prop)
|
||||||
const mod = ((client as unknown) as { [key: string]: any })[prop]
|
|
||||||
client._decoratedSlashModules.push(mod)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -398,6 +398,10 @@ export class SlashClient {
|
||||||
if (this._decoratedSlashModules !== undefined) {
|
if (this._decoratedSlashModules !== undefined) {
|
||||||
this._decoratedSlashModules.forEach((e) => {
|
this._decoratedSlashModules.forEach((e) => {
|
||||||
const mod = ((this as unknown) as { [name: string]: SlashModule })[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)
|
this.modules.push(mod)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue