Gikkman / Java-Twirk

Small, basic library for communication via the Twitch chat. Java 8 compatible
MIT License
54 stars 22 forks source link

Chat not updating in real time #43

Closed Letal1s closed 2 years ago

Letal1s commented 2 years ago

When trying to use the onAnything event, the event is only ran when previous old messages are loaded in on application start. Any messages that are sent after twirk has connected don't go through.

Whispers seem to be picked up fine when using onPrivMsg, it just doesn't pick up general chats.

This is the code I currently have:

static final Twirk twirk = new TwirkBuilder("XXXXXX", "XXXXXX", "oauth:XXXXXXX").setVerboseMode(true).build();

public static void main(String[] args) {
        try {
            twirk.connect();
            System.out.println("Connected to Twitch chat.");
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        twirk.addIrcListener(new TwirkListener() {
            @Override
            public void onAnything(String unformatedMessage) {
                System.out.println("Message received.");
            }
        });
}

I get a bunch of "Message received." logs when the application starts, but no more logs when new messages are sent in chat. I've also noticed that messages sent using twirk.channelMessage() don't show up on my page until chat is refreshed. Has something changed in Twitch recently or could it be something to do with my bot account like a setting that needs to be changed?

This happens when using the latest from the repo, not a JAR release.

Thanks.

Gikkman commented 2 years ago

I can't seem to reproduce it... Are you sure you get the channel name right? It i the only way I can cause the same situation to occur.

I think it is important to have the channel name in lower-case, for some reason. Could you verify?

Letal1s commented 2 years ago

Aha, putting the channel name in lower case seemed to have sorted it. Sorry about that!

Gikkman commented 2 years ago

You do raise a good point of friction though. I'll make sure to cast the channel name to lower-case automatically in the next version!