mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-06 15:35:35 +01:00
Fix reply message not found
This commit is contained in:
@@ -6,3 +6,9 @@ export function isNotModifiedMessage(e: any): boolean {
|
|||||||
|
|
||||||
return e.description === 'Bad Request: message is not modified: specified new message content and reply markup are exactly the same as a current content and reply markup of the message';
|
return e.description === 'Bad Request: message is not modified: specified new message content and reply markup are exactly the same as a current content and reply markup of the message';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isReplyMessageNotFound(e: any): boolean {
|
||||||
|
if (!(e instanceof TelegramError)) return false;
|
||||||
|
|
||||||
|
return e.description === 'Bad Request: replied message not found';
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import { getRandomKeyboard, getTextPaginationData, getUpdateLogKeyboard, getUser
|
|||||||
import { sendFile } from './hooks/downloading';
|
import { sendFile } from './hooks/downloading';
|
||||||
import { setCommands } from './hooks/setCommands';
|
import { setCommands } from './hooks/setCommands';
|
||||||
import { downloadImage } from './services/downloader';
|
import { downloadImage } from './services/downloader';
|
||||||
import { isNotModifiedMessage } from './errors_utils';
|
import { isNotModifiedMessage, isReplyMessageNotFound } from './errors_utils';
|
||||||
|
|
||||||
|
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
@@ -378,10 +378,16 @@ export async function createApprovedBot(token: string, state: BotState): Promise
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
await ctx.telegram.sendMessage(ctx.message.chat.id, Messages.SEARCH_MESSAGE, {
|
await ctx.telegram.sendMessage(ctx.message.chat.id, Messages.SEARCH_MESSAGE, {
|
||||||
reply_to_message_id: ctx.message.message_id,
|
reply_to_message_id: ctx.message.message_id,
|
||||||
reply_markup: keyboard.reply_markup,
|
reply_markup: keyboard.reply_markup,
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
if (!isReplyMessageNotFound(e)) {
|
||||||
|
Sentry.captureException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bot.catch((err) => {
|
bot.catch((err) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user