Files
discordeno/testss/utils.ts
Skillz4Killz 5a4fef855e Proxy delete channel tests (#2174)
* feat: delete channel tests

* fix: use new tests in ci

* Update testss/deps.ts

Co-authored-by: LTS20050703 <87189679+lts20050703@users.noreply.github.com>

Co-authored-by: LTS20050703 <87189679+lts20050703@users.noreply.github.com>
2022-05-08 09:57:06 -04:00

22 lines
531 B
TypeScript

export const CACHED_COMMUNITY_GUILD_ID = 907350958810480671n;
export function delayUntil(
maxMs: number,
isReady: () => boolean | undefined | Promise<boolean | undefined>,
timeoutTime = 100,
): Promise<void> {
const maxTime = Date.now() + maxMs;
async function hackyFix(resolve: () => void) {
if ((await isReady()) || Date.now() >= maxTime) {
resolve();
} else {
setTimeout(() => {
hackyFix(resolve);
}, timeoutTime);
}
}
return new Promise((resolve) => hackyFix(resolve));
}