Fix message format

This commit is contained in:
Astra 2026-02-19 16:16:47 +00:00
parent b29f1d546d
commit f6cbac70ad

View file

@ -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 {