Asi zbytečný, kdovi
This commit is contained in:
parent
2b3dd99811
commit
ebe41ead9a
@ -221,9 +221,19 @@ export const messageLinks = new Map<string, string>();
|
|||||||
* @param mes Zpráva na kterou se má počkat
|
* @param mes Zpráva na kterou se má počkat
|
||||||
*/
|
*/
|
||||||
export async function wait(mes: Message) {
|
export async function wait(mes: Message) {
|
||||||
|
const waitingFrom = Date.now();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (messageLinks.has(mes.id))
|
if (messageLinks.has(mes.id))
|
||||||
return;
|
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));
|
await new Promise(r => setTimeout(r, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user