@@ -1111,29 +1111,34 @@ func IsGameBotMessage(text string) bool {
11111111}
11121112
11131113// ParseMonitorEvents 텍스트에서 모니터링 이벤트 파싱
1114+ // chatTimestampPattern 채팅 타임스탬프 패턴: "HH:MM 이름" 형식
1115+ var chatTimestampPattern = regexp .MustCompile (`^\d{2}:\d{2}\s+\S+` )
1116+
11141117func ParseMonitorEvents (text string ) []MonitorEvent {
11151118 var events []MonitorEvent
11161119
11171120 lines := strings .Split (text , "\n " )
11181121
1119- // 블록 단위로 분석 (여러 줄이 하나의 이벤트)
1120- // 빈 줄 또는 구분자로 블록 분리
1122+ // 타임스탬프("HH:MM 이름") 기준으로 블록 분리
1123+ // 타임스탬프 없는 줄( 빈 줄, [⚔️전투], [🏆결과] 등)은 이전 메시지의 연속
11211124 var currentBlock []string
11221125
11231126 for _ , line := range lines {
1124- line = strings .TrimSpace (line )
1125- if line == "" || strings . HasPrefix ( line , "━" ) || strings . HasPrefix ( line , "─" ) {
1126- // 블록 종료 - 분석
1127+ trimmed : = strings .TrimSpace (line )
1128+ if chatTimestampPattern . MatchString ( trimmed ) {
1129+ // 새 타임스탬프 → 이전 블록 마감
11271130 if len (currentBlock ) > 0 {
11281131 blockText := strings .Join (currentBlock , "\n " )
11291132 if evt := parseMonitorBlock (blockText ); evt != nil {
11301133 events = append (events , * evt )
11311134 }
1132- currentBlock = nil
11331135 }
1134- continue
1136+ currentBlock = []string {trimmed }
1137+ } else if trimmed != "" {
1138+ // 타임스탬프 없는 줄 → 이전 블록에 병합
1139+ currentBlock = append (currentBlock , trimmed )
11351140 }
1136- currentBlock = append ( currentBlock , line )
1141+ // 빈 줄은 무시 (블록 분리 안 함 )
11371142 }
11381143
11391144 // 마지막 블록 처리
@@ -1227,7 +1232,7 @@ func parseMonitorBlock(text string) *MonitorEvent {
12271232 if matches := monitorBattleWinnerPattern .FindStringSubmatch (text ); len (matches ) > 1 {
12281233 for i := 1 ; i < len (matches ); i ++ {
12291234 if matches [i ] != "" {
1230- evt .Winner = matches [i ]
1235+ evt .Winner = strings . TrimSuffix ( matches [i ], "님" )
12311236 winnerFound = true
12321237 break
12331238 }
0 commit comments