merge
This commit is contained in:
		
						commit
						9d88c5d113
					
				
					 5 changed files with 51 additions and 62 deletions
				
			
		
							
								
								
									
										2
									
								
								mod.ts
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								mod.ts
									
										
									
									
									
								
							|  | @ -180,7 +180,7 @@ export * from './src/cache/redis.ts' | |||
| export { ColorUtil } from './src/utils/colorutil.ts' | ||||
| export type { Colors } from './src/utils/colorutil.ts' | ||||
| export { StoreChannel } from './src/structures/guildStoreChannel.ts' | ||||
| export { StageVoiceChannel } from './src/structures/guildStageVoiceChannel.ts' | ||||
| export { StageVoiceChannel } from './src/structures/guildVoiceStageChannel.ts' | ||||
| export { | ||||
|   isCategoryChannel, | ||||
|   isDMChannel, | ||||
|  |  | |||
|  | @ -70,8 +70,6 @@ export class CommandClient extends Client implements CommandClientOptions { | |||
|   commands: CommandsManager = new CommandsManager(this) | ||||
|   categories: CategoriesManager = new CategoriesManager(this) | ||||
| 
 | ||||
|   _decoratedCommands?: { [name: string]: Command } | ||||
| 
 | ||||
|   constructor(options: CommandClientOptions) { | ||||
|     super(options) | ||||
|     this.prefix = options.prefix | ||||
|  | @ -116,11 +114,12 @@ export class CommandClient extends Client implements CommandClientOptions { | |||
|     this.caseSensitive = | ||||
|       options.caseSensitive === undefined ? false : options.caseSensitive | ||||
| 
 | ||||
|     if (this._decoratedCommands !== undefined) { | ||||
|       Object.values(this._decoratedCommands).forEach((entry) => { | ||||
|     const self = this as any | ||||
|     if (self._decoratedCommands !== undefined) { | ||||
|       Object.values(self._decoratedCommands).forEach((entry: any) => { | ||||
|         this.commands.add(entry) | ||||
|       }) | ||||
|       this._decoratedCommands = undefined | ||||
|       self._decoratedCommands = undefined | ||||
|     } | ||||
| 
 | ||||
|     this.on( | ||||
|  | @ -382,11 +381,11 @@ export class CommandClient extends Client implements CommandClientOptions { | |||
|  */ | ||||
| export function command(options?: CommandOptions) { | ||||
|   return function (target: CommandClient | Extension, name: string) { | ||||
|     if (target._decoratedCommands === undefined) target._decoratedCommands = {} | ||||
|     // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
 | ||||
|     const c = target as any | ||||
|     if (c._decoratedCommands === undefined) c._decoratedCommands = {} | ||||
| 
 | ||||
|     const prop = ((target as unknown) as { | ||||
|       [name: string]: (ctx: CommandContext) => any | ||||
|     })[name] | ||||
|     const prop = c[name] | ||||
| 
 | ||||
|     if (typeof prop !== 'function') | ||||
|       throw new Error('@command decorator can only be used on class methods') | ||||
|  | @ -400,6 +399,6 @@ export function command(options?: CommandOptions) { | |||
| 
 | ||||
|     if (target instanceof Extension) command.extension = target | ||||
| 
 | ||||
|     target._decoratedCommands[command.name] = command | ||||
|     c._decoratedCommands[command.name] = command | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -57,14 +57,6 @@ export class SlashClient extends HarmonyEventEmitter<SlashClientEvents> { | |||
|   modules: SlashModule[] = [] | ||||
|   publicKey?: string | ||||
| 
 | ||||
|   _decoratedSlash?: Array<{ | ||||
|     name: string | ||||
|     guild?: string | ||||
|     parent?: string | ||||
|     group?: string | ||||
|     handler: (interaction: Interaction) => any | ||||
|   }> | ||||
| 
 | ||||
|   constructor(options: SlashOptions) { | ||||
|     super() | ||||
|     let id = options.id | ||||
|  | @ -87,10 +79,11 @@ export class SlashClient extends HarmonyEventEmitter<SlashClientEvents> { | |||
|       }) | ||||
|     } | ||||
| 
 | ||||
|     if (this._decoratedSlash !== undefined) { | ||||
|       this._decoratedSlash.forEach((e) => { | ||||
|     const self = this as any | ||||
|     if (self._decoratedSlash !== undefined) { | ||||
|       self._decoratedSlash.forEach((e: any) => { | ||||
|         e.handler = e.handler.bind(this.client) | ||||
|         this.handlers.push(e) | ||||
|         self.handlers.push(e) | ||||
|       }) | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										3
									
								
								src/structures/guildVoiceStageChannel.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								src/structures/guildVoiceStageChannel.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,3 @@ | |||
| import { VoiceChannel } from './guildVoiceChannel.ts' | ||||
| 
 | ||||
| export class StageVoiceChannel extends VoiceChannel { } | ||||
|  | @ -1,48 +1,42 @@ | |||
| import { | ||||
|   Client, | ||||
|   Intents, | ||||
|   event, | ||||
|   slash, | ||||
|   SlashCommandOptionType as Type | ||||
| } from '../../mod.ts' | ||||
| import { Interaction } from '../structures/slash.ts' | ||||
| import { Client, Intents, event, slash } from '../mod.ts' | ||||
| import { Interaction } from '../src/structures/slash.ts' | ||||
| import { TOKEN } from './config.ts' | ||||
| 
 | ||||
| export class MyClient extends Client { | ||||
|   @event() ready(): void { | ||||
|     console.log(`Logged in as ${this.user?.tag}!`) | ||||
|     this.slash.commands.bulkEdit( | ||||
|       [ | ||||
|         { | ||||
|           name: 'test', | ||||
|           description: 'Test command.', | ||||
|           options: [ | ||||
|             { | ||||
|               name: 'user', | ||||
|               type: Type.USER, | ||||
|               description: 'User' | ||||
|             }, | ||||
|             { | ||||
|               name: 'role', | ||||
|               type: Type.ROLE, | ||||
|               description: 'Role' | ||||
|             }, | ||||
|             { | ||||
|               name: 'channel', | ||||
|               type: Type.CHANNEL, | ||||
|               description: 'Channel' | ||||
|             }, | ||||
|             { | ||||
|               name: 'string', | ||||
|               type: Type.STRING, | ||||
|               description: 'String' | ||||
|             } | ||||
|           ] | ||||
|         } | ||||
|       ], | ||||
|       '807935370556866560' | ||||
|     ) | ||||
|     this.slash.commands.bulkEdit([]) | ||||
|     // this.slash.commands.bulkEdit(
 | ||||
|     //   [
 | ||||
|     //     {
 | ||||
|     //       name: 'test',
 | ||||
|     //       description: 'Test command.',
 | ||||
|     //       options: [
 | ||||
|     //         {
 | ||||
|     //           name: 'user',
 | ||||
|     //           type: Type.USER,
 | ||||
|     //           description: 'User'
 | ||||
|     //         },
 | ||||
|     //         {
 | ||||
|     //           name: 'role',
 | ||||
|     //           type: Type.ROLE,
 | ||||
|     //           description: 'Role'
 | ||||
|     //         },
 | ||||
|     //         {
 | ||||
|     //           name: 'channel',
 | ||||
|     //           type: Type.CHANNEL,
 | ||||
|     //           description: 'Channel'
 | ||||
|     //         },
 | ||||
|     //         {
 | ||||
|     //           name: 'string',
 | ||||
|     //           type: Type.STRING,
 | ||||
|     //           description: 'String'
 | ||||
|     //         }
 | ||||
|     //       ]
 | ||||
|     //     }
 | ||||
|     //   ],
 | ||||
|     //   '807935370556866560'
 | ||||
|     // )
 | ||||
|     // this.slash.commands.bulkEdit([])
 | ||||
|   } | ||||
| 
 | ||||
|   @slash() test(d: Interaction): void { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue