Skip to content

Commit

Permalink
feat: MarkdownV2 for Telegram announcer (#3435)
Browse files Browse the repository at this point in the history
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 81de8ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/pipe/telegram/telegram.go
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions www/docs/customization/announce/telegram.md
Expand Up @@ -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.