From dfe27c32c9b6805ea276631f1aacf0a13e4bbb80 Mon Sep 17 00:00:00 2001 From: femshima <49227365+femshima@users.noreply.github.com> Date: Mon, 20 Nov 2023 18:17:29 +0900 Subject: [PATCH] fix leave message is never edited --- src/commands/leave.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/leave.ts b/src/commands/leave.ts index dd19b000..95bae56c 100644 --- a/src/commands/leave.ts +++ b/src/commands/leave.ts @@ -18,7 +18,8 @@ export async function handler( if (!pipeline) { throw new ReplyableError("ボイスチャンネルに参加していません。"); } - pipeline.connection.destroy(); + // State change to `destoryed` is done synchronously. + setImmediate(() => pipeline.connection.destroy()); await Promise.all([interaction.deferReply(), once(pipeline, "destroy")]); await interaction.editReply("退出しました。"); }