feat: joel may sometimes answer even when he's not called for.

This commit is contained in:
eric
2026-02-23 13:47:25 +01:00
parent 66b1ef15af
commit 283802ae55
10 changed files with 375 additions and 41 deletions

View File

@@ -39,6 +39,12 @@ interface BotConfig {
mentionCooldown: number;
/** Chance of mentioning a random user (0-1) */
mentionProbability: number;
/** Enable random-time spontaneous mention scheduler */
spontaneousSchedulerEnabled: boolean;
/** Minimum delay between spontaneous posts (ms) */
spontaneousSchedulerMinIntervalMs: number;
/** Maximum delay between spontaneous posts (ms) */
spontaneousSchedulerMaxIntervalMs: number;
};
web: {
port: number;
@@ -59,6 +65,16 @@ function getEnvOrDefault(key: string, defaultValue: string): string {
return Bun.env[key] ?? defaultValue;
}
function getBooleanEnvOrDefault(key: string, defaultValue: boolean): boolean {
const raw = Bun.env[key];
if (raw === undefined) {
return defaultValue;
}
const normalized = raw.toLowerCase();
return normalized === "1" || normalized === "true" || normalized === "yes";
}
export const config: BotConfig = {
discord: {
token: getEnvOrThrow("DISCORD_TOKEN"),
@@ -97,6 +113,9 @@ export const config: BotConfig = {
memoryChance: 0.3,
mentionCooldown: 24 * 60 * 60 * 1000, // 24 hours
mentionProbability: 0.001,
spontaneousSchedulerEnabled: getBooleanEnvOrDefault("BOT_SPONTANEOUS_SCHEDULER_ENABLED", true),
spontaneousSchedulerMinIntervalMs: parseInt(getEnvOrDefault("BOT_SPONTANEOUS_MIN_INTERVAL_MS", String(45 * 60 * 1000))),
spontaneousSchedulerMaxIntervalMs: parseInt(getEnvOrDefault("BOT_SPONTANEOUS_MAX_INTERVAL_MS", String(180 * 60 * 1000))),
},
web: {
port: parseInt(getEnvOrDefault("WEB_PORT", "3000")),