diff --git a/.env.example b/.env.example index c549f70..4080d2d 100644 --- a/.env.example +++ b/.env.example @@ -14,4 +14,7 @@ HANDLE="" BSKY_PASSWORD="" # https://aistudio.google.com/apikey -GEMINI_API_KEY="" \ No newline at end of file +GEMINI_API_KEY="" + +DAILY_QUERY_LIMIT=15 +USE_FIREHOSE=false \ No newline at end of file diff --git a/src/core.ts b/src/core.ts index 395e4a7..9faaa8b 100644 --- a/src/core.ts +++ b/src/core.ts @@ -1,10 +1,15 @@ import { GoogleGenAI } from "@google/genai"; -import { Bot } from "@skyware/bot"; +import { Bot, EventStrategy } from "@skyware/bot"; import { env } from "./env"; export const bot = new Bot({ service: env.SERVICE, emitChatEvents: true, + eventEmitterOptions: { + strategy: env.USE_FIREHOSE + ? EventStrategy.Firehose + : EventStrategy.Polling, + }, }); export const ai = new GoogleGenAI({ diff --git a/src/env.ts b/src/env.ts index 38cd55d..2d622a5 100644 --- a/src/env.ts +++ b/src/env.ts @@ -17,9 +17,14 @@ const envSchema = z.object({ GEMINI_API_KEY: z.string(), DAILY_QUERY_LIMIT: z.preprocess( - (val) => (typeof val === "string" && val.trim() !== "") ? Number(val) : undefined, + (val) => + (typeof val === "string" && val.trim() !== "") ? Number(val) : undefined, z.number().int().positive().default(15), ), + USE_FIREHOSE: z.preprocess( + (val) => val === "true", + z.boolean().default(false), + ), }); export type Env = z.infer;