Pircbot events not being handled

Hello. I am new to the twitch developing scene and in general any kind of developing regarding bots and anything that has to do with the internet really. I am an university student, so none of my courses really delved into APIs and so on. I mainly use Java, though I know C as well, and use Eclipse as IDE.

I still thought I’d take on the challenge, but, even after browsing through quite a few APIs to interact with twitch, I found the most “userfriendly” of all was pircbot, though it’s the oldest it should be enough to do what I want to do - and that is to react to simple commands. I know there is a newer version, PircBotX or something, but I am struggling to get it into my project, same goes for Kitteh.

So, my question is: am I doing something wrong with my code (which, if so, I can happily copy here for you to take a look at) or is twitch behaving in a different manner and, therefore, Pircbot is no longer catching the events through its handling system?

Thanks to all for reading! :slight_smile:

Hey,
so as it is stated in the Github repository of pIRCBotX:

PircBot was forked due to its many issues and lack of maintenance

You can also see this in the repository that it last got updated around 6 years ago. Because of that, it is very likely that most of the features are deprecated nowadays. Also the events got improved, which shows that the ones from the original pIRCBot, did either not work anymore, or were not “good” enough, to be used in projects. I would suggest, you take a look at the pIRCBotX documentation and try learning how to work with it. Maybe you find fun in building chatbots and think about some more advanced bots. Here are always people ready to help you if you come across any questions ^^. However, i can take a look at your code, to ensure its really the library thats deprecated.

^^

Hey. I had a chat today with a friend, and we figured out the issue with the event handling. Pretty much I had read the beginner’s guide wrong and overridden the methods in the wrong class. So that’s good, however I will definitely look into pIRCBotX, my main issue so far was installing it. I was taught/I learned how to add a library through a JAR file, but it doesn’t look like pIRCBotX follows that route. If you could help me on that I’d be very thankful :slight_smile:

Alright, interesting that it still works.

So like many other Java libraries, pIRCBotX uses Maven as a build-managing-tool. If you dont know, what you use software like this for: Imagine a Library, that uses other libraries aswell. You dont want to download 5 JARs and import them in your project. Also if a new version of the library you want comes out and it gets the logic of those other libraries itself, you would have to manually all remove them, download the new jar, import it, etc. If you use a tool like Maven, you have a file, where you specifiy dependencies(in your use-case the library). Maven then automatically imports all needed sub-dependencies. And if you want to change the version, you just change it in the one file and Maven does the rest. Of course there is more than that to it, but thats how it overall works, for a user like you. If you use an IDE like Eclipse or IntellIJ, you can already specify that a project should use Maven, when you create it. Then you just put this text in the so called pom.xml, which is a file that tells Maven everything it needs to know about the libraries you use. To then import for example pIRCBotX, you simply put this:

<dependency>
    <groupId>com.github.pircbotx</groupId>
    <artifactId>pircbotx</artifactId>
    <version>2.2</version>
</dependency>

Between the <dependencies></dependencies>. Then it should already work fine

It didn’t work. We had to figure out it was overridden in the wrong class haha. But now it so far works okay.

As for Maven, I had read something about it, but I can’t figure out where to find this pom.xml file. Plus, I’m using an older version of Java, Java 1.7, because that’s what the teacher wanted us to use for the course, I don’t know if this causes any issues with Maven and the libraries to implement.
But even assuming I was using the latest version of Java, where can I find the pom.xml file in a new project? I am indeed using Eclipse.

Sorry for bothering and for the beginner level ^^"

No worries ^^. You would have to create a new project and tell eclipse to use Maven. Your Java version should not really matter. Take a look at this: https://www.toolsqa.com/java/maven/create-new-maven-project-eclipse/

Thanks for the input :slight_smile: I’ll definitely look into it!

1 Like