Skip to content
Permalink
Browse files
feat: MarkdownV2 for Telegram announcer (#3435)
Set MarkdownV2 as parse mode for Telegram announcer.

This allows for additional formatting in the announcement, such as
`code` or _italic_ sections. For details, see the official [Telegram Bot
API](https://core.telegram.org/bots/api#markdownv2-style).

If someone has the time (not added in this PR), I think it would be
great to add a field to the Telegram config for the parse mode. This
would allow setting a different parse mode than MarkdownV2, such as
HTML.

This fixes #3431.
  • Loading branch information
stnokott committed Oct 5, 2022
1 parent bb6c53e commit 81de8addf1e05de380f0e1200e8bebf4feba2541
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
@@ -46,6 +46,7 @@ func (Pipe) Announce(ctx *context.Context) error {
}

tm := api.NewMessage(ctx.Config.Announce.Telegram.ChatID, msg)
tm.ParseMode = "MarkdownV2"
_, err = bot.Send(tm)
if err != nil {
return fmt.Errorf("announce: failed to announce to telegram: %w", err)
@@ -25,5 +25,7 @@ announce:
message_template: 'Awesome project {{.Tag}} is out!'
```

You can format your message using MarkdownV2, for reference, see the [Telegram Bot API](https://core.telegram.org/bots/api#markdownv2-style).

!!! tip
Learn more about the [name template engine](/customization/templates/).

0 comments on commit 81de8ad

Please sign in to comment.