Skip to content

Commit 8477951

Browse files
committed
fix: telegram edit message
1 parent 41095c3 commit 8477951

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

apps/tgbot/src/adapter/MessageAction.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,23 @@ export class EditMessageActionWithCtx extends EditMessageActionBase<BotTypes> {
128128

129129
let message: Message;
130130
if (typeof this._text === 'string') {
131-
message = await this.ctx.editMessageText(this._text, {
132-
parse_mode: this._parseAsHtml ? 'HTML' as const : undefined,
133-
reply_markup: {
134-
inline_keyboard: inlineKeyboard
135-
},
136-
link_preview_options: { is_disabled: this._disableLinkPreview }
137-
}) as any;
131+
try {
132+
message = await this.ctx.editMessageText(this._text, {
133+
parse_mode: this._parseAsHtml ? 'HTML' as const : undefined,
134+
reply_markup: {
135+
inline_keyboard: inlineKeyboard
136+
},
137+
link_preview_options: { is_disabled: this._disableLinkPreview }
138+
}) as any;
139+
} catch {
140+
message = await this.ctx.editMessageCaption({
141+
caption: this._text,
142+
parse_mode: this._parseAsHtml ? 'HTML' as const : undefined,
143+
reply_markup: {
144+
inline_keyboard: inlineKeyboard
145+
}
146+
}) as any;
147+
}
138148
} else {
139149
message = await this.ctx.editMessageReplyMarkup({
140150
reply_markup: {

0 commit comments

Comments
 (0)