Skip to content

Commit 7ca3932

Browse files
committed
Defer submission modal reply in case it takes longer than 3 seconds
1 parent c0fa94a commit 7ca3932

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/events/interactionCreate/modal/createSubmission.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,20 @@ export class CreateSubmissionModal implements ModalInteraction {
2424
public async execute(interaction: ModalSubmitInteraction) {
2525
if (!(interaction.channel instanceof TextChannel)) return;
2626

27+
await interaction.deferReply({
28+
flags: MessageFlags.Ephemeral,
29+
});
30+
2731
const answers = submission.questions.map((_, i) =>
2832
interaction.fields.getTextInputValue(`${customId}F${i}`)
2933
);
3034

3135
const ckey = await findCkey(answers[0]);
3236

3337
if (!ckey) {
34-
await interaction.reply({
35-
content: 'BYOND hesabın bulunamadı. Lütfen doğru girdiğinden emin ol.',
36-
flags: MessageFlags.Ephemeral,
37-
});
38+
await interaction.editReply(
39+
'BYOND hesabın bulunamadı. Lütfen yalnızca senden istenileni doğru girdiğinden emin ol.'
40+
);
3841
return;
3942
}
4043

@@ -65,10 +68,9 @@ export class CreateSubmissionModal implements ModalInteraction {
6568
await thread.members.add(interaction.user);
6669
await thread.leave();
6770

68-
await interaction.reply({
69-
content: `Başvurun için alt başlık oluşturuldu: ${thread}`,
70-
flags: MessageFlags.Ephemeral,
71-
});
71+
await interaction.editReply(
72+
`Başvurun için alt başlık oluşturuldu: ${thread}`
73+
);
7274

7375
logger.info(
7476
`Created submission for [${interaction.user.tag}](${interaction.user.id})`

0 commit comments

Comments
 (0)