This commit is contained in:
pinks 2023-09-11 18:03:07 +02:00
parent eb3950b79c
commit 58e8e5c6ea
3 changed files with 5 additions and 4 deletions

View File

@ -62,7 +62,7 @@ bot.api.setMyCommands([
bot.command("start", (ctx) => ctx.reply("Hello! Use the /txt2img command to generate an image"));
bot.command("txt2img", txt2imgCommand);
bot.use(txt2imgQuestion.middleware() as any);
bot.use(txt2imgQuestion.middleware());
bot.command("queue", queueCommand);

View File

@ -4,11 +4,11 @@ import { jobStore } from "../db/jobStore.ts";
import { parsePngInfo } from "../sd.ts";
import { Context, logger } from "./mod.ts";
export const txt2imgQuestion = new GrammyStatelessQ.StatelessQuestion(
export const txt2imgQuestion = new GrammyStatelessQ.StatelessQuestion<Context>(
"txt2img",
async (ctx) => {
if (!ctx.message.text) return;
await txt2img(ctx as any, ctx.message.text, false);
await txt2img(ctx, ctx.message.text, false);
},
);
@ -48,6 +48,7 @@ async function txt2img(ctx: Context, match: string, includeRepliedTo: boolean):
const repliedToMsg = ctx.message.reply_to_message;
const repliedToText = repliedToMsg?.text || repliedToMsg?.caption;
if (includeRepliedTo && repliedToText) {
// TODO: remove bot command from replied to text
const originalParams = parsePngInfo(repliedToText);
params = {
...originalParams,

View File

@ -11,7 +11,7 @@ export * as GrammyTypes from "https://deno.land/x/grammy_types@v3.2.0/mod.ts";
export * as GrammyAutoQuote from "https://deno.land/x/grammy_autoquote@v1.1.2/mod.ts";
export * as GrammyParseMode from "https://deno.land/x/grammy_parse_mode@1.7.1/mod.ts";
export * as GrammyKvStorage from "https://deno.land/x/grammy_storages@v2.3.1/denokv/src/mod.ts";
export * as GrammyStatelessQ from "npm:@grammyjs/stateless-question";
export * as GrammyStatelessQ from "https://deno.land/x/grammy_stateless_question_alpha@v3.0.3/mod.ts";
export * as FileType from "npm:file-type@18.5.0";
// @deno-types="./types/png-chunks-extract.d.ts"
export * as PngChunksExtract from "npm:png-chunks-extract@1.0.0";