public class OutputIRC extends Object
Modifier and Type | Method and Description |
---|---|
void |
action(String target,
String action)
Sends an action to the channel or to a user.
|
void |
changeNick(String newNick)
Attempt to change the current nick (nickname) of the bot when it is
connected to an IRC server.
|
void |
ctcpCommand(String target,
String command)
Sends a CTCP command to a channel or user.
|
void |
ctcpResponse(String target,
String message)
Send a CTCP response to the target channel or user.
|
void |
identify(String password)
Identify the bot with NickServ, supplying the appropriate password.
|
void |
invite(String target,
String channel)
Sends an invitation to join a channel.
|
void |
joinChannel(String channel)
Joins a channel.
|
void |
joinChannel(String channel,
String key)
Joins a channel with a key.
|
void |
listChannels()
Issues a request for a list of all channels on the IRC server.
|
void |
listChannels(String parameters)
Issues a request for a list of all channels on the IRC server.
|
void |
message(String target,
String message)
Sends a message to a channel or a private message to a user.
|
void |
mode(String target,
String mode) |
void |
notice(String target,
String notice)
Sends a notice to the channel or to a user.
|
void |
quitServer()
Quits from the IRC server.
|
void |
quitServer(String reason)
Quits from the IRC server with a reason.
|
void |
whois(String target)
Send "WHOIS target"
|
void |
whoisDetail(String target)
Send "WHOIS target target" for more detail
|
@ConstructorProperties(value="bot") @Generated(value="lombok") public OutputIRC(@NonNull PircBotX bot)
public void joinChannel(String channel)
channel
- The name of the channel to join (eg "#cs").public void joinChannel(String channel, String key)
channel
- The name of the channel to join (eg "#cs").key
- The key that will be used to join the channel.public void quitServer()
DisconnectEvent
will be dispatched as soon as the IRC
server disconnects us.public void quitServer(String reason)
DisconnectEvent
will be dispatched
as soon as the IRC server disconnects us.reason
- The reason for quitting the server.public void ctcpCommand(String target, String command)
sendCTCPCommand("Dave", "VERSION");
. The
type of response to such commands is largely dependant on the target
client software.target
- The name of the channel or user to send the CTCP message
to.command
- The CTCP command to send.public void ctcpResponse(String target, String message)
CoreHooks
class already handles responding to the most common
CTCP commands. Only respond to other commands that aren't implementedtarget
- The target of the responsemessage
- The message to sendpublic void message(String target, String message)
Some examples: -
// Send the message "Hello!" to the channel #cs. sendMessage("#cs", "Hello!"); // Send a private message to Paul that says "Hi". sendMessage("Paul", "Hi");You may optionally apply colours, boldness, underlining, etc to the message by using the
Colors
class.target
- The name of the channel or user nick to send to.message
- The message to send.Colors
public void action(String target, String action)
target
- The name of the channel or user nick to send to.action
- The action to send.Colors
public void notice(String target, String notice)
target
- The name of the channel or user nick to send to.notice
- The notice to send.public void changeNick(String newNick)
newNick
- The new nick to use.public void invite(String target, String channel)
target
- The nick or channel to invitechannel
- The channel you are inviting them to join.public void listChannels()
ChannelInfoEvent
will be dispatched which you will need to listen
for if you want to do anything useful.
NOTE: This will do nothing if a channel list is already in effect
ChannelInfoEvent
public void listChannels(String parameters)
ChannelInfoEvent
will be dispatched which you will need to listen
for if you want to do anything useful
Some IRC servers support certain parameters for LIST requests. One example is a parameter of ">10" to list only those channels that have more than 10 users in them. Whether these parameters are supported or not will depend on the IRC server software.
NOTE: This will do nothing if a channel list is already in effect
parameters
- The parameters to supply when requesting the list.ChannelInfoEvent
public void identify(String password)
This method issues a raw NICKSERV command to the server, and is therefore safer than the alternative approach of sending a private message to NickServ. The latter approach is considered dangerous, as it may cause you to inadvertently transmit your password to an untrusted party if you connect to a network which does not run a NickServ service and where the untrusted party has assumed the nick "NickServ". However, if your IRC network is only compatible with the private message approach, you may typically identify like so:
sendMessage("NickServ", "identify PASSWORD");
Note that this method will add a temporary listener for ConnectEvent if the bot is not logged in yet. If the bot is logged in the command is sent immediately to the server
password
- The password which will be used to identify with
NickServ.public void whois(String target)
target
- public void whoisDetail(String target)
target
- Copyright © 2010–2020 Leon Blakey. All rights reserved.