From f6cbac70ada2561855926e7edd34ba533f3a6d1d Mon Sep 17 00:00:00 2001 From: Astra Date: Thu, 19 Feb 2026 16:16:47 +0000 Subject: [PATCH] Fix message format --- pkg/utils/utils.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index d425d87..371fc2c 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -54,7 +54,14 @@ func GetInfoFromMsg(msg string) (userId int64, username, joinReason, declinedBy, index := LastIndexRuneInRunes([]rune(lines[0]), '[') userID, _ := strconv.Atoi(string([]rune(lines[0])[index+1 : len([]rune(lines[0]))-1])) - return int64(userID), EscapeHTML(username), EscapeHTML(joinReason), declinedBy, declinedAt + // Extract username from "for %s [" part + forIndex := strings.Index(lines[0], "for ") + bracketIndex := strings.Index(lines[0][forIndex:], "[") + if forIndex != -1 && bracketIndex != -1 { + username = strings.TrimSpace(lines[0][forIndex+4 : forIndex+bracketIndex]) + } + + return int64(userID), username, EscapeHTML(joinReason), declinedBy, declinedAt } func LastIndexRuneInRunes(runes []rune, r rune) int {