Skip to content

pircbotx/pircbotx

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Java CI

PircBotX is a powerful Java IRC Client library for bots and user clients. Version v2.3 (2022)

  • Provides 63 IRC events in a multi-threaded listener system, including
    • Optimized Channel/User Model
    • Standard and reverse/passive DCC Chat and Filesharing powered by java.nio
    • CTCP VERSION, ACTION, PING, TIME, and FINGER
    • User modes op, voice, halfop, superops, and owner
    • Channel modes invite only, quiet, moderated, secret, limit, key
    • BANLIST, LIST (Channels), NAMES, QUIETLIST, WHO, and WHOIS
    • 001-005 server info, MOTD
    • Core IRC commands JOIN, QUIT, KICK, BAN, INVITE, AWAY, MODE, TOPIC
    • Nickserv integration with self register and other user's registration status
    • Auto join channels, auto WHO and MODE on channel join
  • Connection features
    • IRCv3 CAP negotiation with native support for SASL, away-notify, and message tags
    • Robust connection handling with server list, attempt all DNS entries, auto retry, auto reconnect
    • Supports TLS IRC servers
    • Supports IPv6 IRC servers and DCC clients
    • Output message throttling, auto long line split
    • WEBIRC authentication
    • Built in Ident server
    • MultiBotManager utility runs multiple bots on multiple servers
  • Formatting utility for color, bold/underline/italics, and reverse
  • Supports SLF4J MDC with context info, Marker on IO logs
  • Java 8 to 17 Compatible
  • High performance Parser

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();
    }
}
  • Join the #pircbotx channel on irc.freenode.net and send ?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.

Support

Most answers can be found in the docs, javadocs (https://pircbotx.github.io/pircbotx/latest/apidocs/) and the wiki.

We also have a mailing list.

Status

PircBotX is stable with a majority of the modern IRC spec implemented. Feature requests and pull requests welcome.