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) |     this.gateway = new Gateway(this, token, intents) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   /** Wait for an Event (optionally satisfying an event) to occur */ | ||||||
|   async waitFor<K extends keyof ClientEvents>( |   async waitFor<K extends keyof ClientEvents>( | ||||||
|     event: K, |     event: K, | ||||||
|     checkFunction: (...args: ClientEvents[K]) => boolean, |     checkFunction: (...args: ClientEvents[K]) => boolean, | ||||||
|  | @ -308,7 +309,7 @@ export function event(name?: keyof ClientEvents) { | ||||||
| 
 | 
 | ||||||
| /** Decorator to create a Slash Command handler */ | /** Decorator to create a Slash Command handler */ | ||||||
| export function slash(name?: string, guild?: string) { | 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 = [] |     if (client._decoratedSlash === undefined) client._decoratedSlash = [] | ||||||
|     const item = (client as { [name: string]: any })[prop] |     const item = (client as { [name: string]: any })[prop] | ||||||
|     if (typeof item !== 'function') { |     if (typeof item !== 'function') { | ||||||
|  | @ -324,7 +325,7 @@ export function slash(name?: string, guild?: string) { | ||||||
| 
 | 
 | ||||||
| /** Decorator to create a Sub-Slash Command handler */ | /** Decorator to create a Sub-Slash Command handler */ | ||||||
| export function subslash(parent: string, name?: string, guild?: string) { | 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 = [] |     if (client._decoratedSlash === undefined) client._decoratedSlash = [] | ||||||
|     const item = (client as { [name: string]: any })[prop] |     const item = (client as { [name: string]: any })[prop] | ||||||
|     if (typeof item !== 'function') { |     if (typeof item !== 'function') { | ||||||
|  | @ -364,7 +365,7 @@ export function groupslash( | ||||||
| 
 | 
 | ||||||
| /** Decorator to add a Slash Module to Client */ | /** Decorator to add a Slash Module to Client */ | ||||||
| export function slashModule() { | export function slashModule() { | ||||||
|   return function (client: Client, prop: string) { |   return function (client: Client | SlashClient, prop: string) { | ||||||
|     if (client._decoratedSlashModules === undefined) |     if (client._decoratedSlashModules === undefined) | ||||||
|       client._decoratedSlashModules = [] |       client._decoratedSlashModules = [] | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue