diff --git a/src/client/components/modals/NotificationInfo/strategies/telegram.tsx b/src/client/components/modals/NotificationInfo/strategies/telegram.tsx index b3ee1b81..0f086708 100644 --- a/src/client/components/modals/NotificationInfo/strategies/telegram.tsx +++ b/src/client/components/modals/NotificationInfo/strategies/telegram.tsx @@ -54,6 +54,15 @@ export const NotificationTelegram: React.FC = React.memo(() => { + + + + {token && ( {t('Auto Fetch')} diff --git a/src/server/model/notification/provider/telegram.ts b/src/server/model/notification/provider/telegram.ts index 899c86a9..446aa267 100644 --- a/src/server/model/notification/provider/telegram.ts +++ b/src/server/model/notification/provider/telegram.ts @@ -6,12 +6,13 @@ import { ImageContentToken } from '../token/type.js'; interface TelegramPayload { botToken: string; chatId: string; + messageId?: string; } export const telegram: NotificationProvider = { send: async (notification, title, message) => { const payload = notification.payload as unknown as TelegramPayload; - const { botToken, chatId } = payload; + const { botToken, chatId, messageId } = payload; const text = telegramContentTokenizer.parse([ token.title(title, 1), @@ -21,6 +22,7 @@ export const telegram: NotificationProvider = { // send text part await axios.post(`https://api.telegram.org/bot${botToken}/sendMessage`, { chat_id: chatId, + reply_to_message_id: messageId, text, parse_mode: 'HTML', }); @@ -33,11 +35,13 @@ export const telegram: NotificationProvider = { if (imageTokens.length === 1) { await axios.post(`https://api.telegram.org/bot${botToken}/sendPhoto`, { chat_id: chatId, + reply_to_message_id: messageId, photo: imageTokens[0].url, }); } else { await axios.post(`https://api.telegram.org/bot${botToken}/sendPhoto`, { chat_id: chatId, + reply_to_message_id: messageId, media: imageTokens.map((t) => ({ type: 'photo', media: t.url,