// Path: src/main/java/net/programmer/igoodie/twitchspawn/easteregg/Developers.java
// public class Developers {
// 
//     public static final Set<String> TWITCH_NICKS = new HashSet<>(
//             Arrays.asList("iGoodiex", "TheDiaval", "Girloflegend"));
// 
// }


import net.programmer.igoodie.twitchspawn.easteregg.Developers;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;
package net.programmer.igoodie.twitchspawn.tracer.model;



public class TwitchChatMessage {

    public static final Pattern TWITCH_CHAT_PATTERN = Pattern.compile("^@(?<tags>.*?) (:(?<user>.*?)!.*?\\.tmi\\.twitch\\.tv) PRIVMSG #(?<channel>.*?) :(?<msg>.*)$");

    private String raw;

    public String username;
    public String message;
    public Set<String> badges; // admin, bits, broadcaster, global_mod, moderator, subscriber, staff, turbo, vip, glhf-pledge
    public int subscriptionMonths;
    public boolean isDeveloper;

    public TwitchChatMessage(String raw) {
        this.raw = raw;
        this.badges = new HashSet<>();

        Matcher matcher = TWITCH_CHAT_PATTERN.matcher(raw);

        if (matcher.matches()) {
            Map<String, String> tags = parseTags(matcher.group("tags"));

            String displayName = tags.getOrDefault("display-name", "");
            this.username = displayName.isEmpty() ? matcher.group("user") : displayName;

            Stream.of(tags.getOrDefault("badges", "").split(",")).forEach(badgeRaw -> {
                if (badgeRaw.isEmpty()) return;
// Path: src/main/java/net/programmer/igoodie/twitchspawn/easteregg/Developers.java
// public class Developers {
// 
//     public static final Set<String> TWITCH_NICKS = new HashSet<>(
//             Arrays.asList("iGoodiex", "TheDiaval", "Girloflegend"));
// 
// }


// Path: src/main/java/net/programmer/igoodie/twitchspawn/tracer/model/TwitchChatMessage.java
import net.programmer.igoodie.twitchspawn.easteregg.Developers;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;

package net.programmer.igoodie.twitchspawn.tracer.model;



public class TwitchChatMessage {

    public static final Pattern TWITCH_CHAT_PATTERN = Pattern.compile("^@(?<tags>.*?) (:(?<user>.*?)!.*?\\.tmi\\.twitch\\.tv) PRIVMSG #(?<channel>.*?) :(?<msg>.*)$");

    private String raw;

    public String username;
    public String message;
    public Set<String> badges; // admin, bits, broadcaster, global_mod, moderator, subscriber, staff, turbo, vip, glhf-pledge
    public int subscriptionMonths;
    public boolean isDeveloper;

    public TwitchChatMessage(String raw) {
        this.raw = raw;
        this.badges = new HashSet<>();

        Matcher matcher = TWITCH_CHAT_PATTERN.matcher(raw);

        if (matcher.matches()) {
            Map<String, String> tags = parseTags(matcher.group("tags"));

            String displayName = tags.getOrDefault("display-name", "");
            this.username = displayName.isEmpty() ? matcher.group("user") : displayName;

            Stream.of(tags.getOrDefault("badges", "").split(",")).forEach(badgeRaw -> {
                if (badgeRaw.isEmpty()) return;
                String[] parts = badgeRaw.split("/", 2);