From ebe41ead9a20176de2f72298f80798d527a3084d Mon Sep 17 00:00:00 2001 From: Histmy Date: Tue, 1 Jul 2025 15:26:54 +0200 Subject: [PATCH] =?UTF-8?q?Asi=20zbyte=C4=8Dn=C3=BD,=20kdovi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/utils.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 3158cdd..66b421b 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -221,9 +221,19 @@ export const messageLinks = new Map(); * @param mes Zpráva na kterou se má počkat */ export async function wait(mes: Message) { + const waitingFrom = Date.now(); + while (true) { if (messageLinks.has(mes.id)) return; + + if (Date.now() - waitingFrom > 30_000) { + const err = new Error(`Zpráva s ID ${mes.id} nebyla zařazena do messageLinks do 30 sekund.`); + adminLog(mes.client, "Při čekání na zprávu jsem se nedočkal", err); + log(err); + return; + } + await new Promise(r => setTimeout(r, 0)); } }