Asi zbytečný, kdovi

This commit is contained in:
Histmy 2025-07-01 15:26:54 +02:00
parent 2b3dd99811
commit ebe41ead9a
Signed by: Histmy
GPG Key ID: AC2E43C463D8F329

View File

@ -221,9 +221,19 @@ export const messageLinks = new Map<string, string>();
* @param mes Zpráva na kterou se 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));
}
}