Skip to content

Commit 8756d4f

Browse files
SyjaloGodderE2D
andauthored
feat: await for the initial message (#25)
* feat: await for the initial message * feat: remove wait import * feat: fix typo Co-authored-by: GodderE2D <55918888+GodderE2D@users.noreply.github.com> * feat: wait longer --------- Co-authored-by: GodderE2D <55918888+GodderE2D@users.noreply.github.com>
1 parent 4a3bced commit 8756d4f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/events/threadCreate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { on } from "node:events";
2-
import { setTimeout as wait } from "node:timers/promises";
32
import { logger } from "@yuudachi/framework";
43
import type { Event } from "@yuudachi/framework/types";
54
import type { ThreadChannel } from "discord.js";
@@ -21,7 +20,8 @@ export default class implements Event {
2120
>) {
2221
try {
2322
if (!newlyCreated || !ASSISTCHANNELS.includes(thread.parentId ?? "")) continue;
24-
await wait(2_000);
23+
const received = await thread.awaitMessages({ max: 1, time: 60_000, errors: ["time"] }).catch(() => null);
24+
if (!received) continue;
2525
const parts: string[] = [];
2626

2727
if (thread.parent?.name.includes("voice")) {

0 commit comments

Comments
 (0)