diff --git a/bot/parsePngInfo.ts b/bot/parsePngInfo.ts index dfd693b..45ada41 100644 --- a/bot/parsePngInfo.ts +++ b/bot/parsePngInfo.ts @@ -25,7 +25,7 @@ interface PngInfoExtra extends PngInfo { upscale?: number; } -export function parsePngInfo(pngInfo: string, baseParams?: Partial): Partial { +export function parsePngInfo(pngInfo: string, baseParams?: Partial, shouldParseSeed?: boolean): Partial { const tags = pngInfo.split(/[,;]+|\.+\s|\n/u); let part: "prompt" | "negative_prompt" | "params" = "prompt"; const params: Partial = {}; @@ -99,7 +99,14 @@ export function parsePngInfo(pngInfo: string, baseParams?: Partial): Pa params.denoising_strength = denoisingStrength; break; } - case "seed": + case "seed": { + part = "params"; + if (shouldParseSeed) { + const seed = Number(value.trim()); + params.seed = seed; + break; + } + } case "model": case "modelhash": case "modelname": diff --git a/bot/txt2imgCommand.ts b/bot/txt2imgCommand.ts index e63fb0a..0e087cb 100644 --- a/bot/txt2imgCommand.ts +++ b/bot/txt2imgCommand.ts @@ -64,7 +64,7 @@ async function txt2img(ctx: ErisContext, match: string, includeRepliedTo: boolea params = parsePngInfo(repliedToText, params); } - params = parsePngInfo(match, params); + params = parsePngInfo(match, params, true); if (!params.prompt) { await ctx.reply(