Getting JOIN messages with pIRCbot to work - Java

What I want to do: Have my bot detect when a user joins my twitch channel

I have looked through the documentation of pIRCbot (http://www.jibble.org/javadocs/pircbot/index.html) and I am aware that it has a onJoin() method which should allow the bot to know when someone joins the channel. I have not been able to get any success with this method (using a very simple sendMessage(channel, "welcome to the channel, " + sender); type of thing) and I know that I need to somehow get the Twitch Membership stuff working. I have looked at the Twitch page (https://github.com/justintv/Twitch-API/blob/master/IRC.md) referring to the Membership stuff and I dont understand it. Being new to IRC and Twitch Chat Development it would really help me to see some example code so I could understand what it is I need to do. Looking at the documentation just isn’t making sense and I am not sure how to perform the '< CAP REQ :twitch.tv/membership

:tmi.twitch.tv CAP * ACK :twitch.tv/membership’ part of this. What does this code look like? How to perform in Java and pIRCbot?

I am sure this has been heavily covered in other posts and I apologize but I am just not getting it. Thanks for any and all help on this.

PircBot.sendRawLine("CAP REQ :twitch.tv/membership"); should be the syntax. PircBot will be your instantiation of that class.

1 Like

Thank you very much @george that worked. I see join messages now and can proceed.

When looking at the documentation, once the membership is established, which it now is, it says that you can get access to NAMES, JOIN, PART and MODE. So, for example, for the NAMES, does that mean I should be able to do something like…
PircBot.sendRawLine(“NAMES”);
…to get all the users in the channel? Or is it just saying that my onUserList() method should work now that I can “access that info” ?

Thank you

You can’t manually request NAMES. If you send the membership CAP before joining a channel, NAMES will be sent along with the join.

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