File tree Expand file tree Collapse file tree 3 files changed +13
-16
lines changed
Expand file tree Collapse file tree 3 files changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -59,12 +59,12 @@ export const defineEvent: DefineEvent & DefineEventWithOptions = <
5959}
6060
6161export const defineCommand = <
62- Slash extends boolean ,
62+ K extends boolean = boolean ,
6363 T extends ArgsDef = ArgsDef
6464> (
65- options : CommandOptions < Slash > & { slash ?: Slash ; args ?: T } ,
66- execute : CommandExecute < Slash , T >
67- ) : HarmonixCommand < Slash , T > => {
65+ options : CommandOptions < K > & { slash ?: K ; args ?: T } ,
66+ execute : CommandExecute < K , T >
67+ ) : HarmonixCommand < K , T > => {
6868 return { options, execute }
6969}
7070
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import jiti from 'jiti'
22import { dirname } from 'pathe'
33import { filename } from 'pathe/utils'
44import type {
5- ArgsDef ,
65 CommandOptions ,
76 ContextMenuOptions ,
87 EventOptions ,
@@ -46,14 +45,14 @@ export const resolveEvent = (
4645export const resolveMessageCommand = (
4746 cmd : HarmonixCommandInput ,
4847 harmonixOptions : Harmonix [ 'options' ]
49- ) : HarmonixCommand < boolean , ArgsDef > => {
48+ ) : HarmonixCommand => {
5049 if ( typeof cmd === 'string' ) {
5150 const _jiti = jiti ( harmonixOptions . rootDir , {
5251 interopDefault : true
5352 } )
5453 const _cmdPath = _jiti . resolve ( cmd )
55- const command = _jiti ( _cmdPath ) as HarmonixCommand < boolean , ArgsDef >
56- const options : CommandOptions < boolean > = {
54+ const command = _jiti ( _cmdPath ) as HarmonixCommand
55+ const options : CommandOptions = {
5756 name : command . options . name || filename ( _cmdPath ) . split ( '.' ) [ 0 ] ,
5857 category : command . options . category || filename ( dirname ( _cmdPath ) ) ,
5958 slash : command . options . slash || filename ( _cmdPath ) . endsWith ( '.slash' ) ,
Original file line number Diff line number Diff line change @@ -138,13 +138,11 @@ interface CommandContext<T extends ArgsDef = ArgsDef> {
138138 args : ParsedArgs < T >
139139}
140140
141- export type CommandOptions < Slash extends boolean > = Slash extends true
141+ export type CommandOptions < K extends boolean = boolean > = K extends true
142142 ? SlashCommandOptions
143143 : MessageCommandOptions
144144
145- export type MessageOrInteraction =
146- | Message
147- | ChatInputCommandInteraction
145+ export type MessageOrInteraction = Message | ChatInputCommandInteraction
148146
149147type ExecuteArgument < Slash extends boolean > = Slash extends true
150148 ? ChatInputCommandInteraction
@@ -161,12 +159,12 @@ export type CommandExecute<
161159 context : CommandContext < T >
162160) => void
163161
164- export type HarmonixCommandInput = string | HarmonixCommand < boolean , ArgsDef >
162+ export type HarmonixCommandInput = string | HarmonixCommand
165163
166164export interface HarmonixCommand <
167- Slash extends boolean ,
165+ K extends boolean = boolean ,
168166 T extends ArgsDef = ArgsDef
169167> {
170- options : CommandOptions < Slash >
171- execute : CommandExecute < Slash , T >
168+ options : CommandOptions < K >
169+ execute : CommandExecute < K , T >
172170}
You can’t perform that action at this time.
0 commit comments