diff --git a/frontend/telegram_bot.go b/frontend/telegram_bot.go index 8491f9e..4767e42 100644 --- a/frontend/telegram_bot.go +++ b/frontend/telegram_bot.go @@ -145,22 +145,24 @@ func webHandlerTelegramBot(w http.ResponseWriter, r *http.Request) { } commandResult = strings.TrimSpace(commandResult) - if len(commandResult) > 0 { - // Create a JSON response - w.Header().Add("Content-Type", "application/json") - response := &tgWebhookResponse{ - Method: "sendMessage", - ChatID: request.Message.Chat.ID, - Text: "```\n" + commandResult + "\n```", - ReplyToMessageID: request.Message.MessageID, - ParseMode: "Markdown", - } - data, err := json.Marshal(response) - if err != nil { - println(err.Error()) - return - } - // println(string(data)) - w.Write(data) + if len(commandResult) < 0 { + commandResult = "empty result" } + + // Create a JSON response + w.Header().Add("Content-Type", "application/json") + response := &tgWebhookResponse{ + Method: "sendMessage", + ChatID: request.Message.Chat.ID, + Text: "```\n" + commandResult + "\n```", + ReplyToMessageID: request.Message.MessageID, + ParseMode: "Markdown", + } + data, err := json.Marshal(response) + if err != nil { + println(err.Error()) + return + } + // println(string(data)) + w.Write(data) }