Feat(send-message): Use html if html tags found
All checks were successful
Webhook-Everything/Webhook-Everything/pipeline/head This commit looks good

This commit is contained in:
2025-12-08 02:12:42 +08:00
parent 61ee85b606
commit 5de4e97add

View File

@@ -39,7 +39,16 @@ func (env *Env) TelegramSend(chatIDShort string, msg string) error {
return err
}
chatMsg := tgbotapi.NewMessage(chatIDMap.ChatID, msg)
chatMsg.ParseMode = "MarkdownV2"
htmlTags := []string{"<b>", "</b>", "<i>", "</i>", "<u>", "</u>", "<a ", "</a>", "<code>", "</code>", "<pre>", "</pre>"}
for _, tag := range htmlTags {
if strings.Contains(msg, tag) {
chatMsg.ParseMode = "HTML"
break
}
}
_, err = bot.Send(chatMsg)
if err != nil {
log.Println(err)