...
 
Commits (2)
......@@ -172,7 +172,7 @@ func GetStringResponse(chatID int64) []string {
index := 1
for _, k := range chatPairList {
text += "*#" + strconv.Itoa(index) + "* " + chatData.User[k.Key].Username + ": " + strconv.FormatUint(chatData.User[k.Key].Message, 10) + "\n"
text += "*#" + strconv.Itoa(index) + "* " + stringEscape(chatData.User[k.Key].Username) + ": " + strconv.FormatUint(chatData.User[k.Key].Message, 10) + "\n"
index++
summaryMessagesTotal += chatData.User[k.Key].Message
......@@ -204,3 +204,13 @@ func AddRecord(update tgbotapi.Update) {
func GetHelp() string {
return "*Statistics*\nGet statistics of the current chat with `/stats`.\n"
}
func stringEscape(text string) string {
text = strings.Replace(text, "_", "\\_", -1)
text = strings.Replace(text, "*", "\\*", -1)
text = strings.Replace(text, "[", "\\[", -1)
text = strings.Replace(text, "`", "\\`", -1)
text = strings.Replace(text, "#", "\\#", -1)
text = strings.Replace(text, "@", "\\@", -1)
return text
}