From f0aeae4e4d27bfce852774be66960e0495ac18c9 Mon Sep 17 00:00:00 2001 From: Synbulat Biishev Date: Sun, 26 Nov 2023 16:48:34 +0300 Subject: [PATCH 1/4] feat: await for the initial message --- src/events/threadCreate.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/events/threadCreate.ts b/src/events/threadCreate.ts index ac47d8e..0348c19 100644 --- a/src/events/threadCreate.ts +++ b/src/events/threadCreate.ts @@ -21,7 +21,8 @@ export default class implements Event { >) { try { if (!newlyCreated || !ASSISTCHANNELS.includes(thread.parentId ?? "")) continue; - await wait(2_000); + const recived = await thread.awaitMessages({ max: 1, time: 2_000, errors: ["time"] }).catch(() => null); + if (!recived) continue; const parts: string[] = []; if (thread.parent?.name.includes("djs")) { From cfef5cd74c6392c244fe657dd7daa44bcd46526e Mon Sep 17 00:00:00 2001 From: Synbulat Biishev Date: Sun, 26 Nov 2023 16:52:09 +0300 Subject: [PATCH 2/4] feat: remove wait import --- src/events/threadCreate.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/events/threadCreate.ts b/src/events/threadCreate.ts index 0348c19..7acbac7 100644 --- a/src/events/threadCreate.ts +++ b/src/events/threadCreate.ts @@ -1,5 +1,4 @@ import { on } from "node:events"; -import { setTimeout as wait } from "node:timers/promises"; import { logger } from "@yuudachi/framework"; import type { Event } from "@yuudachi/framework/types"; import type { ThreadChannel } from "discord.js"; From e5b509d0a7ba1cc11018fe02f7501b86fd8c2948 Mon Sep 17 00:00:00 2001 From: Synbulat Biishev Date: Mon, 27 Nov 2023 09:34:43 +0300 Subject: [PATCH 3/4] feat: fix typo Co-authored-by: GodderE2D <55918888+GodderE2D@users.noreply.github.com> --- src/events/threadCreate.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/events/threadCreate.ts b/src/events/threadCreate.ts index 7acbac7..46a3364 100644 --- a/src/events/threadCreate.ts +++ b/src/events/threadCreate.ts @@ -20,8 +20,8 @@ export default class implements Event { >) { try { if (!newlyCreated || !ASSISTCHANNELS.includes(thread.parentId ?? "")) continue; - const recived = await thread.awaitMessages({ max: 1, time: 2_000, errors: ["time"] }).catch(() => null); - if (!recived) continue; + const received = await thread.awaitMessages({ max: 1, time: 2_000, errors: ["time"] }).catch(() => null); + if (!received) continue; const parts: string[] = []; if (thread.parent?.name.includes("djs")) { From c5ccafa2862db339656cdbd0efa9ba97cf05ec08 Mon Sep 17 00:00:00 2001 From: Synbulat Biishev Date: Tue, 13 Aug 2024 00:11:27 +0500 Subject: [PATCH 4/4] feat: wait longer --- src/events/threadCreate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/events/threadCreate.ts b/src/events/threadCreate.ts index 46a3364..c2e67ab 100644 --- a/src/events/threadCreate.ts +++ b/src/events/threadCreate.ts @@ -20,7 +20,7 @@ export default class implements Event { >) { try { if (!newlyCreated || !ASSISTCHANNELS.includes(thread.parentId ?? "")) continue; - const received = await thread.awaitMessages({ max: 1, time: 2_000, errors: ["time"] }).catch(() => null); + const received = await thread.awaitMessages({ max: 1, time: 60_000, errors: ["time"] }).catch(() => null); if (!received) continue; const parts: string[] = [];