@@ -12,6 +12,7 @@ import {
12
12
type TextBasedChannel ,
13
13
SlashCommandStringOption ,
14
14
} from "discord.js" ;
15
+ import { MessageFlags } from "discord-api-types/v10" ;
15
16
import githubAPI , { type Repository , LADYBIRD_REPO } from "@/apis/githubAPI" ;
16
17
import { embedFromIssueOrPull } from "@/util/embedFromIssueOrPull" ;
17
18
import { getSadCaret } from "@/util/emoji" ;
@@ -131,7 +132,7 @@ export class GithubCommand extends Command {
131
132
}
132
133
133
134
override async handleCommand ( interaction : ChatInputCommandInteraction ) : Promise < void > {
134
- await interaction . deferReply ( { ephemeral : true } ) ;
135
+ await interaction . deferReply ( ) ;
135
136
136
137
const url = interaction . options . getString ( "url" ) ;
137
138
const repositoryName = interaction . options . getString ( "repository" ) ;
@@ -150,8 +151,7 @@ export class GithubCommand extends Command {
150
151
) ;
151
152
152
153
if ( result ) {
153
- await interaction . deleteReply ( ) ;
154
- await interaction . followUp ( { embeds : [ result ] } ) ;
154
+ await interaction . editReply ( { embeds : [ result ] } ) ;
155
155
return ;
156
156
}
157
157
}
@@ -164,8 +164,7 @@ export class GithubCommand extends Command {
164
164
const result = await embedFromIssueOrPull ( await githubAPI . getIssueOrPull ( number , repository ) ) ;
165
165
166
166
if ( result ) {
167
- await interaction . deleteReply ( ) ;
168
- await interaction . followUp ( { embeds : [ result ] } ) ;
167
+ await interaction . editReply ( { embeds : [ result ] } ) ;
169
168
return ;
170
169
}
171
170
}
@@ -176,15 +175,16 @@ export class GithubCommand extends Command {
176
175
) ;
177
176
178
177
if ( result ) {
179
- await interaction . deleteReply ( ) ;
180
- await interaction . followUp ( { embeds : [ result ] } ) ;
178
+ await interaction . editReply ( { embeds : [ result ] } ) ;
181
179
return ;
182
180
}
183
181
}
184
182
183
+ await interaction . deleteReply ( ) ;
185
184
const sadcaret = await getSadCaret ( interaction ) ;
186
- await interaction . editReply ( {
185
+ await interaction . followUp ( {
187
186
content : `No matching issues or pull requests found ${ sadcaret ?? ":^(" } ` ,
187
+ flags : MessageFlags . Ephemeral ,
188
188
} ) ;
189
189
}
190
190
}
@@ -206,7 +206,7 @@ export class ReviewListCommand extends Command {
206
206
}
207
207
208
208
override async handleCommand ( interaction : ChatInputCommandInteraction ) : Promise < void > {
209
- await interaction . deferReply ( { ephemeral : true } ) ;
209
+ await interaction . deferReply ( ) ;
210
210
211
211
const repositoryName = interaction . options . getString ( "repository" ) ;
212
212
const unparsedNumbers = interaction . options . getString ( "numbers" ) ;
@@ -223,10 +223,12 @@ export class ReviewListCommand extends Command {
223
223
}
224
224
225
225
if ( unparsedNumbers === null ) {
226
- await interaction . editReply ( {
226
+ await interaction . deleteReply ( ) ;
227
+ await interaction . followUp ( {
227
228
content : `No matching issues or pull requests found ${
228
229
( await getSadCaret ( interaction ) ) ?? ":^("
229
230
} `,
231
+ flags : MessageFlags . Ephemeral ,
230
232
} ) ;
231
233
return undefined ;
232
234
}
@@ -236,10 +238,12 @@ export class ReviewListCommand extends Command {
236
238
) ;
237
239
238
240
if ( numbers . length === 0 ) {
239
- await interaction . editReply ( {
241
+ await interaction . deleteReply ( ) ;
242
+ await interaction . followUp ( {
240
243
content : `No numbers found in the PR list text '${ unparsedNumbers } ' ${
241
244
( await getSadCaret ( interaction ) ) ?? ":^("
242
245
} `,
246
+ flags : MessageFlags . Ephemeral ,
243
247
} ) ;
244
248
return undefined ;
245
249
}
@@ -252,17 +256,18 @@ export class ReviewListCommand extends Command {
252
256
) ;
253
257
const failedDescriptions = descriptions . filter ( ( { description } ) => description === undefined ) ;
254
258
if ( failedDescriptions . length !== 0 ) {
255
- await interaction . editReply ( {
259
+ await interaction . deleteReply ( ) ;
260
+ await interaction . followUp ( {
256
261
content : `No matching issues or pull requests found for the numbers ${ failedDescriptions
257
262
. map ( ( { number } ) => number )
258
263
. join ( ", " ) } ${ ( await getSadCaret ( interaction ) ) ?? ":^(" } `,
264
+ flags : MessageFlags . Ephemeral ,
259
265
} ) ;
260
266
return undefined ;
261
267
}
262
268
263
269
const descriptionList = descriptions . map ( ( { description } ) => description ) . join ( "\n" ) ;
264
270
265
- await interaction . deleteReply ( ) ;
266
- await interaction . followUp ( { content : descriptionList } ) ;
271
+ await interaction . editReply ( { content : descriptionList } ) ;
267
272
}
268
273
}
0 commit comments