1818import type BaseCommand from '#src/core/BaseCommand.js' ;
1919import Context from '#src/core/CommandContext/Context.js' ;
2020import Logger from '#src/utils/Logger.js' ;
21- import {
22- extractUserId ,
23- extractChannelId ,
24- extractRoleId ,
25- } from '#src/utils/Utils.js' ;
21+ import { extractUserId , extractChannelId , extractRoleId } from '#src/utils/Utils.js' ;
2622import {
2723 type APIApplicationCommandBasicOption ,
2824 type APIModalInteractionResponseCallbackData ,
@@ -71,10 +67,7 @@ export default class PrefixContext extends Context<{
7167 // Split arguments with quote handling
7268 const commandOptions = new Map (
7369 // eslint-disable-next-line @typescript-eslint/no-unused-vars
74- Object . entries ( command . options ) . map ( ( [ _i , option ] ) => [
75- option . name ,
76- option ,
77- ] ) ,
70+ Object . entries ( command . options ) . map ( ( [ _i , option ] ) => [ option . name , option ] ) ,
7871 ) ;
7972
8073 // Store parsed arguments with resolved values
@@ -88,15 +81,13 @@ export default class PrefixContext extends Context<{
8881 private parseArguments (
8982 rawArgs : string [ ] ,
9083 definedOpts : Map < string , APIApplicationCommandBasicOption > ,
91- ) :
92- | Collection <
93- string ,
94- {
95- value : string | number | boolean | null ;
96- type : ApplicationCommandOptionType ;
97- }
98- >
99- | undefined {
84+ ) : Collection <
85+ string ,
86+ {
87+ value : string | number | boolean | null ;
88+ type : ApplicationCommandOptionType ;
89+ }
90+ > | null {
10091 const args = new Collection <
10192 string ,
10293 {
@@ -114,21 +105,21 @@ export default class PrefixContext extends Context<{
114105 if ( ! option ) {
115106 this . argumentValidationPassed = false ;
116107 Logger . error ( `Unknown option: ${ name } ` ) ;
117- return ;
108+ return null ;
118109 }
119110
120111 if ( ! value && option . required ) {
121112 this . argumentValidationPassed = false ;
122113 Logger . error ( `Missing required option: ${ option . name } ` ) ;
123- return ;
114+ return null ;
124115 }
125116
126117 if ( value ) {
127118 const parsed = this . processArg ( value , option . type ) ;
128119 if ( parsed === null ) {
129120 this . argumentValidationPassed = false ;
130121 Logger . error ( `Invalid value for ${ name } ` ) ;
131- return ;
122+ return null ;
132123 }
133124 args . set ( option . name , { value : parsed , type : option . type } ) ;
134125 definedOpts . delete ( option . name ) ;
@@ -146,21 +137,21 @@ export default class PrefixContext extends Context<{
146137 if ( ! option ) {
147138 this . argumentValidationPassed = false ;
148139 Logger . error ( `Unknown option: ${ value } ` ) ;
149- return ;
140+ return null ;
150141 }
151142
152143 if ( ! value && option . required ) {
153144 this . argumentValidationPassed = false ;
154145 Logger . error ( `Missing required option: ${ option . name } ` ) ;
155- return ;
146+ return null ;
156147 }
157148
158149 if ( value ) {
159150 const parsed = this . processArg ( value , option . type ) ;
160151 if ( parsed === null ) {
161152 this . argumentValidationPassed = false ;
162153 Logger . error ( `Invalid value for ${ value } ` ) ;
163- return ;
154+ return null ;
164155 }
165156 args . set ( option . name , { value : parsed , type : option . type } ) ;
166157 }
@@ -205,9 +196,7 @@ export default class PrefixContext extends Context<{
205196
206197 public async reply ( data : string | MessageReplyOptions ) {
207198 this . lastReply = await this . interaction . reply (
208- typeof data === 'string'
209- ? { content : data }
210- : { ...data , content : data . content ?? '' } ,
199+ typeof data === 'string' ? { content : data } : { ...data , content : data . content ?? '' } ,
211200 ) ;
212201 return this . lastReply ;
213202 }
@@ -227,18 +216,16 @@ export default class PrefixContext extends Context<{
227216 public async editReply ( data : string | MessageEditOptions ) {
228217 return (
229218 ( await this . lastReply ?. edit (
230- typeof data === 'string'
231- ? { content : data }
232- : { ...data , content : data . content ?? '' } ,
219+ typeof data === 'string' ? { content : data } : { ...data , content : data . content ?? '' } ,
233220 ) ) ?? null
234221 ) ;
235222 }
236223
237224 public async showModal (
238225 modal :
239- | JSONEncodable < APIModalInteractionResponseCallbackData >
240- | ModalComponentData
241- | APIModalInteractionResponseCallbackData ,
226+ | JSONEncodable < APIModalInteractionResponseCallbackData >
227+ | ModalComponentData
228+ | APIModalInteractionResponseCallbackData ,
242229 ) {
243230 const reply = await this . reply ( {
244231 content : 'Click button to enter data.' ,
@@ -254,8 +241,7 @@ export default class PrefixContext extends Context<{
254241
255242 const collector = reply ?. createMessageComponentCollector ( {
256243 componentType : ComponentType . Button ,
257- filter : ( i ) =>
258- i . customId === 'openForm' && i . user . id === this . interaction . author . id ,
244+ filter : ( i ) => i . customId === 'openForm' && i . user . id === this . interaction . author . id ,
259245 idle : 60000 ,
260246 } ) ;
261247
0 commit comments