allow SlashClient in slash decorators
This commit is contained in:
parent
c3fafdfcf0
commit
8f4433dc9f
1 changed files with 4 additions and 3 deletions
|
@ -266,6 +266,7 @@ export class Client extends EventEmitter {
|
|||
this.gateway = new Gateway(this, token, intents)
|
||||
}
|
||||
|
||||
/** Wait for an Event (optionally satisfying an event) to occur */
|
||||
async waitFor<K extends keyof ClientEvents>(
|
||||
event: K,
|
||||
checkFunction: (...args: ClientEvents[K]) => boolean,
|
||||
|
@ -308,7 +309,7 @@ export function event(name?: keyof ClientEvents) {
|
|||
|
||||
/** Decorator to create a Slash Command handler */
|
||||
export function slash(name?: string, guild?: string) {
|
||||
return function (client: Client | SlashModule, prop: string) {
|
||||
return function (client: Client | SlashClient | SlashModule, prop: string) {
|
||||
if (client._decoratedSlash === undefined) client._decoratedSlash = []
|
||||
const item = (client as { [name: string]: any })[prop]
|
||||
if (typeof item !== 'function') {
|
||||
|
@ -324,7 +325,7 @@ export function slash(name?: string, guild?: string) {
|
|||
|
||||
/** Decorator to create a Sub-Slash Command handler */
|
||||
export function subslash(parent: string, name?: string, guild?: string) {
|
||||
return function (client: Client | SlashModule, prop: string) {
|
||||
return function (client: Client | SlashModule | SlashClient, prop: string) {
|
||||
if (client._decoratedSlash === undefined) client._decoratedSlash = []
|
||||
const item = (client as { [name: string]: any })[prop]
|
||||
if (typeof item !== 'function') {
|
||||
|
@ -364,7 +365,7 @@ export function groupslash(
|
|||
|
||||
/** Decorator to add a Slash Module to Client */
|
||||
export function slashModule() {
|
||||
return function (client: Client, prop: string) {
|
||||
return function (client: Client | SlashClient, prop: string) {
|
||||
if (client._decoratedSlashModules === undefined)
|
||||
client._decoratedSlashModules = []
|
||||
|
||||
|
|
Loading…
Reference in a new issue