Skip to content

Commit

Permalink
Get self correct colour
Browse files Browse the repository at this point in the history
  • Loading branch information
pblop committed Oct 31, 2023
1 parent a707900 commit b3ee2e3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/main/java/eu/pabl/twitchchat/twitch_integration/Bot.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,22 @@ public void onMessage(MessageEvent event) throws Exception {

@Override
public void onUnknown(UnknownEvent event) throws Exception {
System.out.println("UNKNOWN TWITCH EVENT: " + event.toString());
switch (event.getCommand()) {
case "USERSTATE" -> {
// Info about our user. More at https://dev.twitch.tv/docs/irc/commands/#userstate
// Set our correct colour :).
String colorTag = event.getTags().get("color");
if (colorTag != null) {
Color userColor = Color.decode(colorTag);
TextColor formattingColor = TextColor.fromRgb(userColor.getRGB());

putFormattingColor(getUsername(), formattingColor);
}
}
default -> {
System.out.println("UNKNOWN TWITCH EVENT: " + event.toString());
}
}
}

@Override
Expand Down

0 comments on commit b3ee2e3

Please sign in to comment.