public class PircBotX extends Object implements Comparable<PircBotX>, Closeable
It provides an event-driven architecture to handle common IRC events, flood protection, DCC support, ident support, and more.
Methods of the PircBotX class can be called to send events to the IRC server that it connects to. For example, calling the sendMessage method will send a message to a channel or user on the IRC server. Multiple servers can be supported using multiple instances of PircBotX.
To perform an action when the PircBotX receives a normal message from the IRC
server, you would listen for the MessageEvent in your listener (see
ListenerAdapter
). Many other events are dispatched as well for other
incoming lines
Forked and Maintained by Leon Blakey in PircBotX
Modifier and Type | Class and Description |
---|---|
static class |
PircBotX.State |
Modifier and Type | Field and Description |
---|---|
static String |
VERSION
The definitive version number of this release of PircBotX.
|
Constructor and Description |
---|
PircBotX(Configuration configuration)
Constructs a PircBotX with the provided configuration.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
If for some reason you absolutely need to stop PircBotX now instead of
gracefully closing with
OutputIRC.quitServer() , this will close
the socket which causes read loop to terminate which will shutdown
PircBotX shortly. |
int |
compareTo(PircBotX other)
Compare
bot id's . |
boolean |
equals(Object o) |
int |
getBotId()
Unique number for this bot
|
Configuration |
getConfiguration()
Configuration used for this bot
|
int |
getConnectionId() |
DccHandler |
getDccHandler() |
List<String> |
getEnabledCapabilities()
Enabled CAP features
|
InputParser |
getInputParser() |
InetAddress |
getLocalAddress() |
String |
getNick()
Returns the current nick of the bot.
|
String |
getServerHostname() |
ServerInfo |
getServerInfo() |
int |
getServerPort() |
PircBotX.State |
getState() |
User |
getUserBot()
Gets the bots own user object.
|
UserChannelDao<User,Channel> |
getUserChannelDao()
User-Channel mapper
|
int |
hashCode() |
boolean |
isConnected()
Returns whether or not the PircBotX is currently connected to a server.
|
boolean |
isNickservIdentified() |
OutputIRC |
send()
Deprecated.
|
OutputCAP |
sendCAP() |
OutputDCC |
sendDCC() |
OutputIRC |
sendIRC() |
OutputRaw |
sendRaw() |
void |
startBot()
Start the bot by connecting to the server.
|
void |
stopBotReconnect()
Do not try connecting again in the future.
|
String |
toString()
Returns a String representation of this object.
|
public static final String VERSION
public PircBotX(@NonNull Configuration configuration)
configuration
- Fully built Configurationpublic void startBot() throws IOException, IrcException
Configuration.isAutoReconnect()
is true this will continuously
reconnect to the server until stopBotReconnect()
is called or
an exception is thrown from connectingIOException
- if it was not possible to connect to the server.IrcException
public void stopBotReconnect()
public OutputRaw sendRaw()
public OutputIRC sendIRC()
@Deprecated public OutputIRC send()
public OutputCAP sendCAP()
public OutputDCC sendDCC()
public String getNick()
public boolean isConnected()
public String toString()
Version{PircBotX x.y.z Java IRC Bot - www.jibble.org}
Connected{true}
Server{irc.dal.net}
Port{6667}
Password{}
public User getUserBot()
UserChannelDao.getUserBot()
public ServerInfo getServerInfo()
public InetAddress getLocalAddress()
public int getConnectionId()
public void close()
OutputIRC.quitServer()
, this will close
the socket which causes read loop to terminate which will shutdown
PircBotX shortly.close
in interface Closeable
close
in interface AutoCloseable
OutputIRC.quitServer()
public int compareTo(PircBotX other)
bot id's
. This is useful for sorting lists of
Channel objects.compareTo
in interface Comparable<PircBotX>
other
- Other channel to compare topublic PircBotX.State getState()
@Generated(value="lombok") public int getBotId()
@Generated(value="lombok") public Configuration getConfiguration()
@Generated(value="lombok") public InputParser getInputParser()
@Generated(value="lombok") public UserChannelDao<User,Channel> getUserChannelDao()
@Generated(value="lombok") public DccHandler getDccHandler()
@Generated(value="lombok") public List<String> getEnabledCapabilities()
@Generated(value="lombok") public String getServerHostname()
@Generated(value="lombok") public int getServerPort()
@Generated(value="lombok") public boolean isNickservIdentified()
Copyright © 2010–2020 Leon Blakey. All rights reserved.