joel image handler

This commit is contained in:
2026-02-02 12:18:44 +01:00
parent 09143a0638
commit a4300f8eec
14 changed files with 452 additions and 5 deletions

View File

@@ -245,6 +245,7 @@ export function createApiRoutes(client: BotClient) {
memory_chance: 30,
mention_probability: 0,
gif_search_enabled: 0,
image_gen_enabled: 0,
});
}
@@ -268,6 +269,7 @@ export function createApiRoutes(client: BotClient) {
memory_chance?: number;
mention_probability?: number;
gif_search_enabled?: boolean | string;
image_gen_enabled?: boolean | string;
};
if (contentType?.includes("application/x-www-form-urlencoded")) {
@@ -278,13 +280,15 @@ export function createApiRoutes(client: BotClient) {
memory_chance: form.memory_chance ? parseInt(form.memory_chance as string) : undefined,
mention_probability: form.mention_probability ? parseInt(form.mention_probability as string) : undefined,
gif_search_enabled: form.gif_search_enabled === "on" || form.gif_search_enabled === "true",
image_gen_enabled: form.image_gen_enabled === "on" || form.image_gen_enabled === "true",
};
} else {
body = await c.req.json();
}
// Convert gif_search_enabled to integer for SQLite
// Convert boolean options to integer for SQLite
const gifSearchEnabled = body.gif_search_enabled ? 1 : 0;
const imageGenEnabled = body.image_gen_enabled ? 1 : 0;
// Upsert options
const existing = await db
@@ -301,6 +305,7 @@ export function createApiRoutes(client: BotClient) {
memory_chance: body.memory_chance,
mention_probability: body.mention_probability,
gif_search_enabled: gifSearchEnabled,
image_gen_enabled: imageGenEnabled,
});
} else {
await db
@@ -311,6 +316,7 @@ export function createApiRoutes(client: BotClient) {
memory_chance: body.memory_chance,
mention_probability: body.mention_probability,
gif_search_enabled: gifSearchEnabled,
image_gen_enabled: imageGenEnabled,
updated_at: new Date().toISOString(),
})
.where(eq(botOptions.guild_id, guildId));