diff --git a/deno.lock b/deno.lock index 2ec0827..a6e8d4e 100644 --- a/deno.lock +++ b/deno.lock @@ -9,6 +9,7 @@ }, "npm": { "specifiers": { + "discord-emoji-converter@1.2.8": "discord-emoji-converter@1.2.8", "megalodon@5.0.6": "megalodon@5.0.6", "megalodon@5.4.1": "megalodon@5.4.1", "openai@3.2.1": "openai@3.2.1" @@ -82,6 +83,10 @@ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dependencies": {} }, + "discord-emoji-converter@1.2.8": { + "integrity": "sha512-95UIHZugZ5nvfZb/hX4+UK9a0run8ZleU1u3xOMFxZjusfigpmrQlxbSHJemzeB5ebCJ7gJVt9Pmmhi8+zKMHw==", + "dependencies": {} + }, "follow-redirects@1.15.2": { "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", "dependencies": {} diff --git a/src/index.ts b/src/index.ts index ae8924b..0f47337 100644 --- a/src/index.ts +++ b/src/index.ts @@ -65,6 +65,7 @@ async function postStatus( }[], visibility: "public" | "unlisted" | "private" | "direct", reply_id?: string, + successCallback?: () => void, ) { const response = await openai.createChatCompletion({ model: "gpt-3.5-turbo", @@ -86,6 +87,7 @@ async function postStatus( }); lastPost = Math.floor(Date.now() / 1000); console.log("Posted post!"); + (successCallback ?? (() => {}))(); } catch { console.log("Failed to post post; will try again next time."); } @@ -180,8 +182,8 @@ while (true) { newMessages, status.visibility, notif.status?.id, + () => respondedNotificationIds.push(notif.id), ); - respondedNotificationIds.push(notif.id); } else { // assume top-level const prompt = @@ -200,8 +202,8 @@ while (true) { newMessages, status.visibility, status.id, + () => respondedNotificationIds.push(notif.id), ); - respondedNotificationIds.push(notif.id); } } else { respondedNotificationIds.push(notif.id);