choose message template format HTML/MarkDown#80
Conversation
metalmatze
left a comment
There was a problem hiding this comment.
Very cool contribution. Thanks!
A few small comments. But that should be fixable quickly.
|
|
||
| a.Flag("parse.mode", "The template formatting mode HTML/Markdown"). | ||
| Envar("TEMPLATE_FORMAT"). | ||
| Default(string(telebot.ModeHTML)). |
There was a problem hiding this comment.
Rather than introducing a direct dependency on telebot in the main.go, could we create both ParseHTML and ParseMarkdown in pkg/telegram.
There was a problem hiding this comment.
I used telebot.ParseMode because telebot.SendMessage() depends on it, we can do what you said above, but still, I need to cast the param in telebot.SendMessage() to telebot.ParseMode to be able to compile cf:
pkg/telegram/bot.go:320:85: cannot use b.parseMode (type ParseMode) as type telebot.ParseMode in field value
make: *** [build] Error 2
What do you think? casting casting still holds the dependancy anyway.
| logger log.Logger | ||
| revision string | ||
| startTime time.Time | ||
| parseMode telebot.ParseMode |
There was a problem hiding this comment.
Can we set this still to telebot.ModeHTML as this is the current default.
|
Nice feature, I would love to use it. |
This MR let the user choose the template message format between HTML and Markdown. The format can be submitted as a parameter
parse.modeor envTEMPLATE_FORMATThe docker image is available
rg.fr-par.scw.cloud/devel/alertmanager-bot:0.4.1for testing