@@ -131,6 +131,8 @@ export class GithubCommand extends Command {
131
131
}
132
132
133
133
override async handleCommand ( interaction : ChatInputCommandInteraction ) : Promise < void > {
134
+ await interaction . deferReply ( { ephemeral : true } ) ;
135
+
134
136
const url = interaction . options . getString ( "url" ) ;
135
137
const repositoryName = interaction . options . getString ( "repository" ) ;
136
138
const number = interaction . options . getNumber ( "number" ) ;
@@ -148,6 +150,7 @@ export class GithubCommand extends Command {
148
150
) ;
149
151
150
152
if ( result ) {
153
+ await interaction . deleteReply ( ) ;
151
154
await interaction . reply ( { embeds : [ result ] } ) ;
152
155
return ;
153
156
}
@@ -161,6 +164,7 @@ export class GithubCommand extends Command {
161
164
const result = await embedFromIssueOrPull ( await githubAPI . getIssueOrPull ( number , repository ) ) ;
162
165
163
166
if ( result ) {
167
+ await interaction . deleteReply ( ) ;
164
168
await interaction . reply ( { embeds : [ result ] } ) ;
165
169
return ;
166
170
}
@@ -172,15 +176,15 @@ export class GithubCommand extends Command {
172
176
) ;
173
177
174
178
if ( result ) {
179
+ await interaction . deleteReply ( ) ;
175
180
await interaction . reply ( { embeds : [ result ] } ) ;
176
181
return ;
177
182
}
178
183
}
179
184
180
185
const sadcaret = await getSadCaret ( interaction ) ;
181
- await interaction . reply ( {
186
+ await interaction . editReply ( {
182
187
content : `No matching issues or pull requests found ${ sadcaret ?? ":^(" } ` ,
183
- ephemeral : true ,
184
188
} ) ;
185
189
}
186
190
}
@@ -202,6 +206,8 @@ export class ReviewListCommand extends Command {
202
206
}
203
207
204
208
override async handleCommand ( interaction : ChatInputCommandInteraction ) : Promise < void > {
209
+ await interaction . deferReply ( { ephemeral : true } ) ;
210
+
205
211
const repositoryName = interaction . options . getString ( "repository" ) ;
206
212
const unparsedNumbers = interaction . options . getString ( "numbers" ) ;
207
213
@@ -217,11 +223,10 @@ export class ReviewListCommand extends Command {
217
223
}
218
224
219
225
if ( unparsedNumbers === null ) {
220
- await interaction . reply ( {
226
+ await interaction . editReply ( {
221
227
content : `No matching issues or pull requests found ${
222
228
( await getSadCaret ( interaction ) ) ?? ":^("
223
229
} `,
224
- ephemeral : true ,
225
230
} ) ;
226
231
return undefined ;
227
232
}
@@ -231,11 +236,10 @@ export class ReviewListCommand extends Command {
231
236
) ;
232
237
233
238
if ( numbers . length === 0 ) {
234
- await interaction . reply ( {
239
+ await interaction . editReply ( {
235
240
content : `No numbers found in the PR list text '${ unparsedNumbers } ' ${
236
241
( await getSadCaret ( interaction ) ) ?? ":^("
237
242
} `,
238
- ephemeral : true ,
239
243
} ) ;
240
244
return undefined ;
241
245
}
@@ -248,19 +252,17 @@ export class ReviewListCommand extends Command {
248
252
) ;
249
253
const failedDescriptions = descriptions . filter ( ( { description } ) => description === undefined ) ;
250
254
if ( failedDescriptions . length !== 0 ) {
251
- await interaction . reply ( {
255
+ await interaction . editReply ( {
252
256
content : `No matching issues or pull requests found for the numbers ${ failedDescriptions
253
257
. map ( ( { number } ) => number )
254
258
. join ( ", " ) } ${ ( await getSadCaret ( interaction ) ) ?? ":^(" } `,
255
- ephemeral : true ,
256
259
} ) ;
257
260
return undefined ;
258
261
}
259
262
260
263
const descriptionList = descriptions . map ( ( { description } ) => description ) . join ( "\n" ) ;
261
264
262
- await interaction . reply ( {
263
- content : descriptionList ,
264
- } ) ;
265
+ await interaction . deleteReply ( ) ;
266
+ await interaction . reply ( { content : descriptionList } ) ;
265
267
}
266
268
}
0 commit comments