crazy-max / diun

Receive notifications when an image is updated on a Docker registry
https://crazymax.dev/diun/
MIT License
2.78k stars 108 forks source link

feat(telegram): add support for chat topics #1125

Open jon4hz opened 3 months ago

jon4hz commented 3 months ago

This PR adds support for telegram chat topics.

github.com/go-telegram-bot-api/telegram-bot-api doesn't have support for topics despite several open PRs, so I switched it out with a more up-to-date library.

Diun supports sending messages to multiple chats so ChatTopics is a 2d slice, which allows diun to send messages to multiple chats and multiple topics.

I couldn't quite figure out how the environment variables are parsed, so I'm not 100% sure if the parsing of multi dimensional arrays works. I'll test that before I remove the draft status.

This is my first time contributing to diun so please let me know if I overlooked something or if have any other comments so far!

Closes #948 and #1031

jon4hz commented 3 months ago

As it seems github.com/crazy-max/gonfig doesn't support multidimensional arrays and I'm getting an error FTL Cannot load configuration error="failed to decode configuration from file: unsupported simple value type: slice". So I did a little refactor and chatTopics is now a simple array, allowing you to define only one topic per chatID.