feat: Add support for Telegram message threads#501
feat: Add support for Telegram message threads#501shellshock321 wants to merge 3 commits intoprojectdiscovery:devfrom
Conversation
This commit introduces the ability to send notifications to specific message threads (topics) within Telegram groups. The following changes were made: - Added a new optional `telegram_thread_id` field to the Telegram provider configuration in `pkg/providers/telegram/telegram.go`. - Modified the `Send` function in the Telegram provider to append the `telegram_thread_id` to the `telegram_chat_id` in the Shoutrrr URL if provided. The format used is `chat_id:thread_id`. - Updated `README.md` to include documentation for the new `telegram_thread_id` field and provided a link to the Shoutrrr documentation for instructions on obtaining the `message_thread_id`. - Added unit tests in `pkg/providers/telegram/telegram_test.go` to verify the correct construction of the Telegram URL with and without the `telegram_thread_id`. This involved refactoring `pkg/providers/telegram/telegram.go` to allow mocking of the `shoutrrr.Send` function for testing purposes. This feature allows you to direct notifications to specific topics in your Telegram groups, providing more granular control over where notifications appear.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThe updates introduce support for an optional Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant TelegramProvider
participant shoutrrrSendFunc
User->>TelegramProvider: Send(message, options)
alt TelegramThreadID is set
TelegramProvider->>TelegramProvider: Combine ChatID and ThreadID
else TelegramThreadID is empty
TelegramProvider->>TelegramProvider: Use ChatID only
end
TelegramProvider->>shoutrrrSendFunc: Send(serviceURL, message)
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
dwisiswant0
left a comment
There was a problem hiding this comment.
integration test fails & conflicts
This commit introduces the ability to send notifications to specific message threads (topics) within Telegram groups.
The following changes were made:
telegram_thread_idfield to the Telegram provider configuration inpkg/providers/telegram/telegram.go.Sendfunction in the Telegram provider to append thetelegram_thread_idto thetelegram_chat_idin the Shoutrrr URL if provided. The format used ischat_id:thread_id.README.mdto include documentation for the newtelegram_thread_idfield and provided a link to the Shoutrrr documentation for instructions on obtaining themessage_thread_id.pkg/providers/telegram/telegram_test.goto verify the correct construction of the Telegram URL with and without thetelegram_thread_id. This involved refactoringpkg/providers/telegram/telegram.goto allow mocking of theshoutrrr.Sendfunction for testing purposes.This feature allows you to direct notifications to specific topics in your Telegram groups, providing more granular control over where notifications appear.
Summary by CodeRabbit