grammyjs / grammY

The Telegram Bot Framework.
https://grammy.dev
MIT License
2.17k stars 110 forks source link

parse_mode doesn't work with editMessageText #557

Closed y0unghe closed 4 months ago

y0unghe commented 5 months ago

I'm trying to edit the message with HTML text, but the API doesn't support the parse_mode.

await ctx.editMessageText(editedText, ctx.msgId)

The editMessageText from Context

editMessageText(text: string, other?: Other<"editMessageText", "chat_id" | "message_id" | "inline_message_id" | "text">, signal?: AbortSignal): Promise<true | (Update.Edited & Message.CommonMessage & {
        text: string;
    })>;

Please add parse_mode to editMessageText function.

KnorpelSenf commented 5 months ago

This is incorrect. The API does support it, and the types are correct, too: https://github.com/grammyjs/types/blob/1211b7917873ba3c0f52167227d21094fe0887df/methods.ts#L1331

KnorpelSenf commented 5 months ago

The editMessageText from Context

editMessageText(text: string, other?: Other<"editMessageText", "chat_id" | "message_id" | "inline_message_id" | "text">, signal?: AbortSignal): Promise<true | (Update.Edited & Message.CommonMessage & {
        text: string;
    })>;

You even found the correct type signature, just call await ctx.editMessageText("hi", { parse_mode: "HTML" }). Have you tried that?

y0unghe commented 5 months ago

The editMessageText from Context


editMessageText(text: string, other?: Other<"editMessageText", "chat_id" | "message_id" | "inline_message_id" | "text">, signal?: AbortSignal): Promise<true | (Update.Edited & Message.CommonMessage & {

        text: string;

    })>;

You even found the correct type signature, just call await ctx.editMessageText("hi", { parse_mode: "HTML" }). Have you tried that?

Yeah, I tried to add parse_mode but there are compile errors. It seems there is no such key.

KnorpelSenf commented 5 months ago

If you expect help, you need to share both your code and the full error message ... not sure what this whole issue is about

KnorpelSenf commented 4 months ago

Closing due to inactivity