frontend: cleanup telegram replies
This commit is contained in:
parent
df18bd153c
commit
721b3f6cc7
@ -43,5 +43,9 @@ func dn42WhoisFilter(whois string) string {
|
||||
commandResult += s + "\n"
|
||||
}
|
||||
|
||||
return commandResult + fmt.Sprintf("\n%d line(s) skipped.\n", skippedLines)
|
||||
if skippedLines > 0 {
|
||||
return commandResult + fmt.Sprintf("\n%d line(s) skipped.\n", skippedLines)
|
||||
} else {
|
||||
return commandResult
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,9 @@ func telegramBatchRequestFormat(servers []string, endpoint string, command strin
|
||||
results := batchRequest(servers, endpoint, command)
|
||||
result := ""
|
||||
for i, r := range results {
|
||||
result += servers[i] + "\n"
|
||||
if len(servers) > 1 {
|
||||
result += servers[i] + "\n"
|
||||
}
|
||||
result += postProcess(r) + "\n\n"
|
||||
}
|
||||
return result
|
||||
@ -149,7 +151,7 @@ func webHandlerTelegramBot(w http.ResponseWriter, r *http.Request) {
|
||||
response := &tgWebhookResponse{
|
||||
Method: "sendMessage",
|
||||
ChatID: request.Message.Chat.ID,
|
||||
Text: "```\n" + strings.TrimSpace(commandResult) + "\n```",
|
||||
Text: "```\n" + commandResult + "\n```",
|
||||
ReplyToMessageID: request.Message.MessageID,
|
||||
ParseMode: "Markdown",
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user