Feat(send-message): Use html if html tags found
All checks were successful
Webhook-Everything/Webhook-Everything/pipeline/head This commit looks good
All checks were successful
Webhook-Everything/Webhook-Everything/pipeline/head This commit looks good
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user