Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.mxscho:pircbotx:2.1'
}
dependencies {
implementation("com.github.mxscho:pircbotx:2.1")
}
<dependency>
<groupId>com.github.mxscho</groupId>
<artifactId>pircbotx</artifactId>
<version>2.1</version>
</dependency>
libraryDependencies += "com.github.mxscho" % "pircbotx" % "2.1"
:dependencies [[com.github.mxscho/pircbotx "2.1"]]
January 2016 PircBotX 2.1 is finally released!
June 2015 We've moved from Google Code! Issues, wiki, javadocs, and git mirror are on GitHub. Mercurial mirror is on BitBucket
Current Version: 2.1 - See Migration Guide to 2.x and ChangeLog for more information
PircBotX is a powerful and flexible Java IRC library forked from the popular PircBot framework, bringing many new up-to-date features and bug fixes in an official alternative distribution.
Checkout the Wiki for tutorials and documentation
##PircBotX in 3 Steps A brief getting started guide
import org.pircbotx.Configuration;
import org.pircbotx.PircBotX;
import org.pircbotx.hooks.ListenerAdapter;
import org.pircbotx.hooks.types.GenericMessageEvent;
public class MyListener extends ListenerAdapter {
@Override
public void onGenericMessage(GenericMessageEvent event) {
//When someone says ?helloworld respond with "Hello World"
if (event.getMessage().startsWith("?helloworld"))
event.respond("Hello world!");
}
public static void main(String[] args) throws Exception {
//Configure what we want our bot to do
Configuration configuration = new Configuration.Builder()
.setName("PircBotXUser") //Set the nick of the bot. CHANGE IN YOUR CODE
.addServer("irc.freenode.net") //Join the freenode network
.addAutoJoinChannel("#pircbotx") //Join the official #pircbotx channel
.addListener(new MyListener()) //Add our listener that will be called on Events
.buildConfiguration();
//Create our bot with the configuration
PircBotX bot = new PircBotX(configuration);
//Connect to the server
bot.startBot();
}
}
?helloworld
. Your bot will respond with Hello world!
Since its a GenericMessageEvent, it will also respond when private messaged. Congratulations, you just wrote your first bot!PircBotX can do so much more! Read the docs for more information
Most answers can be found in the docs, javadocs (http://thelq.github.io/pircbotx/latest/apidocs/) and the wiki
If you can't find an answer, ask on IRC at irc.freenode.net/#pircbotx . We also have a mailing list
This project is licensed under GNU GPL v3 to be compatible with the PircBot license.
It is assumed that commercial users can buy the commercial license of PircBot which grants "modification of the Product's source-code and incorporation of the modified source-code into your software"
The PircBot developer has ignored multiple emails asking for a less restrictive license and clarification of the commercial license. Users can show support by respectfully asking him directly at . More up to date information is available at in Issue #63