mirror of
https://github.com/hempyhemp/hh-auto-reply.git
synced 2026-06-09 02:15:34 +00:00
🔧 refactor(bot-commands): обновлено использование функции safeEdit в нескольких местах
This commit is contained in:
13
src/hh/ui.ts
13
src/hh/ui.ts
@@ -37,8 +37,19 @@ export function escapeHtml(text: string): string {
|
||||
return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
||||
}
|
||||
|
||||
export async function safeEdit(
|
||||
text: string,
|
||||
options: Parameters<typeof bot.editMessageText>[1],
|
||||
): Promise<void> {
|
||||
await bot.editMessageText(text, options).catch((e: unknown) => {
|
||||
if (e instanceof Error && e.message.includes('message is not modified'))
|
||||
return
|
||||
throw e
|
||||
})
|
||||
}
|
||||
|
||||
export async function showResult(chatId: number, messageId: number, text: string): Promise<void> {
|
||||
await bot.editMessageText(text, {
|
||||
await safeEdit(text, {
|
||||
chat_id: chatId,
|
||||
message_id: messageId,
|
||||
reply_markup: BACK_MARKUP,
|
||||
|
||||
Reference in New Issue
Block a user