diff --git a/bot/config.go b/bot/config.go index 344ca9d..2186d7c 100644 --- a/bot/config.go +++ b/bot/config.go @@ -197,13 +197,20 @@ func (bc *BotController) configHandleAbout(m *tb.Message, params ...string) { if version == "" { version = "not specified" } - _, err := bc.Bot.Send(m.Sender, fmt.Sprintf(`Version information about [LucaBernstein/beancount\-bot\-tg](https://github.com/LucaBernstein/beancount\-bot\-tg) + _, err := bc.Bot.Send(m.Sender, escapeCharacters(fmt.Sprintf(`Version information about [LucaBernstein/beancount-bot-tg](https://github.com/LucaBernstein/beancount-bot-tg) Version: [%s](%s)`, version, - strings.ReplaceAll(versionLink, "-", "\\-"), - ), tb.ModeMarkdownV2) + versionLink, + ), ".", "-"), tb.ModeMarkdownV2) if err != nil { bc.Logf(ERROR, m, "Sending bot message failed: %s", err.Error()) } } + +func escapeCharacters(s string, c ...string) string { + for _, char := range c { + s = strings.ReplaceAll(s, char, "\\"+char) + } + return s +} diff --git a/docker-compose.yml b/docker-compose.yml index 9d564b5..d00dfca 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,7 @@ services: - POSTGRES_USER=$POSTGRES_USER - POSTGRES_PASSWORD=$POSTGRES_PASSWORD app: - image: ghcr.io/lucabernstein/beancount-bot-tg:main + image: ghcr.io/lucabernstein/beancount-bot-tg:release container_name: bc_tg_bot restart: unless-stopped networks: