From 541cfd9b6fd2ce98c892c8dcaac883ca5d680bdc Mon Sep 17 00:00:00 2001 From: boypt <1033514+boypt@users.noreply.github.com> Date: Wed, 25 Dec 2019 17:38:50 +0800 Subject: [PATCH] print bad msg --- bot/service.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bot/service.go b/bot/service.go index 2776fa73..f7c518ec 100644 --- a/bot/service.go +++ b/bot/service.go @@ -122,7 +122,16 @@ func BroadNews(source *model.Source, subs []model.Subscribe, contents []model.Co log.Println(err) if strings.Contains(err.Error(), "Forbidden") { log.Printf("Unsubscribe UserID:%d SourceID:%d", sub.UserID, sub.SourceID) - _ = sub.Unsub() + sub.Unsub() + } + + /* + Telegram return error if markdown message has incomplete format. + Print the msg to warn the user + api error: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 894 + */ + if strings.Contains(err.Error(), "parse entities") { + log.Println("Markdown Err: ", msg) } } }