action
public String action(IRCMessage message)
action is invoked by the bot when someone types a message starting
with a member of getCommands().
- action in interface IRCBotModule
message
- The original message sent to the
channel. Provided if some command needs further information
from it, like for instance the nick of the sender.
- A String containing a message to be sent to the IRC channel
as a reply to the command invocation or null if no reply is needed.
getDescription
public String getDescription(String topic,
Language lang)
getDescription is called to get the information printed by the
!help command.
- getDescription in interface IRCBotModule
topic
- Either the string returned by
getModuleName().toLowerCase()
or a member of
getCommands()
. The convention says that the call
getDescription(getModuleName().toLowerCase())
should return a brief description about the module. This
information should not overlap with information given by calls
where the topic
is a member of
getCommands()
.lang
- What language to use for the reply.
- A String containing all the info needed to use this
module, tailored to the given topic. If the topic is
unexpected, the return value should be null.
getModuleName
public String getModuleName()
getModuleName is called to get the name of this module. The
name is used when building the list of loaded modules. A module
name may contain capital letters.
- getModuleName in interface IRCBotModule
- A String containing the name of this module.
parseMessage
public String parseMessage(IRCMessage message)
parseMessage is called by the bot with every message that is
sent to the IRC channel with the exception for messages
beginning with a command prefix, and messages sent by the bot
itself. If the implementing module does not care about the
communication in the channel, this method should immediately
return null without looking at the message.
- parseMessage in interface IRCBotModule
- parseMessage in interface AbstractIRCBotModule
message
- The message sent to the IRC channel.
- A String containing a reply to the message, or null if
nothing should be sent to the IRC channel.
saveState
public void saveState(SaveState state)
saveState is called when a module is unloaded from the bot or
whenever the IRC command !save is issued. Use it to save any
settings or other data needed for this modules operation. If
this module does not keep any data that needs to be stored for
later sessions, this method should be empty.
Use the SaveState.add
method to put new data into
the state. Each data object that is to be stored in the state
should be tagged with a unique identifier. The identifier will
be padded with the name of the module so that identifiers in
different modules will not clash.
- saveState in interface IRCBotModule
- saveState in interface AbstractIRCBotModule
state
- The state to write to.