From f4e7b5e1a7d210990ef7f6795de1dfa02ce9fb07 Mon Sep 17 00:00:00 2001 From: nameless Date: Thu, 9 Nov 2023 23:25:14 +0000 Subject: [PATCH] change txt2img seed behaviour will ignore seed only on /txt2img or new requests --- bot/txt2imgCommand.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bot/txt2imgCommand.ts b/bot/txt2imgCommand.ts index 5a2be61..39f7277 100644 --- a/bot/txt2imgCommand.ts +++ b/bot/txt2imgCommand.ts @@ -64,13 +64,22 @@ async function txt2img(ctx: ErisContext, match: string, includeRepliedTo: boolea } const repliedToText = repliedToMsg?.text || repliedToMsg?.caption; - if (includeRepliedTo && repliedToText) { + const isReply = includeRepliedTo && repliedToText; + + if (isReply) { // TODO: remove bot command from replied to text params = parsePngInfo(repliedToText, params); } params = parsePngInfo(match, params, true); + if (isReply) { + const parsedInfo = parsePngInfo(repliedToText, undefined, true); + if (parsedInfo.prompt !== params.prompt) { + params.seed = parsedInfo.seed ?? -1; + } + } + if (!params.prompt) { await ctx.reply( "Please tell me what you want to see." +