Pircbot, problems with retrieving a full userList. Java

Doing a twitchbot as a little hobby project and stumble on a little problem. I want to make a viewer list where it automatically shows when viewers enter my channel. The problem i got is that the list that is being retrieved only shows the bot. I have read through the javadocs and i thought that i did everything correctly but i just cant get it to work.

So when the bot connects to a server the onuserlist() method is called and retrieves a userlist, but the only user it gets is the bot. Even if i got 5, 10, 100 people in my channel.

@Override
    protected void onUserList(String channel, User[] users) {

        for (User user1 : users) {
            System.out.println(user1);
            model.addElement(user1.getNick());
        }
        super.onUserList(channel, users);

    }

The onjoin() method should update the userlist with the following piece of code and it is called everytime someone joins. But even here it is the same problem, the only user that it can find is the bot. I wonder know if someone has got a better knowledge about pircbots and knows what i might be doing wrong?

  User[] user=bot.getUsers("#mychannel");
        for(int i =0; i<user.length;i++){
            System.out.println(user[i]);
    }

According to the java doc it should give me a User array of all the people in my channel, but it only gives me one.

http://www.jibble.org/javadocs/pircbot/

You need to request the membership capability before joining the channel. See

https://github.com/justintv/Twitch-API/blob/master/IRC.md#membership

thank you very much! i can now recieve a bit more but it doesnt work to a 100%. if i join a channel with 100viewers+ it doesnt get all of them but around 20-30 at the begining and all people that joins after that gets added. but i still miss alot of viewers when the onuserlist method gets called. Do you know why?

If there’s over a thousand people in the channel, only OPs get listed. For a more reliable list, send an HTTP request to http://tmi.twitch.tv/group/user/3ventic/chatters (replace my name with the channel you want to check). It can be very slow at times and it’s not part of kraken so it could change or disappear without notice.

2 Likes

Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.