SleepyBot - Events
To handle irc-events you implement sleep-functions prefixed with bot instead of sub which are called by the bot.
The passed parameters are accessible in three ways:
1. as $1, $2, etc.
2. as @_[0], @_[1], etc.
3. as values in the special hash %_, for example
in onMessage(String channel, String sender, String login, String hostname, String message):
%_['channel'], %_['sender'], %_['login'], %_['hostname'], %_['message'].
The keys are named as the parameters to that functions in the PircBot API.
Example:
# handle public messages bot onMessage { # $1 = @_[0] = %_['channel'], $2 = @_[1] = %_['sender'], ... if ( 'jircii' isin %_['message'] ) { sendMessage( %_['channel'], %_['sender'] . ', jIRCii is cool, yeah!' ); } }
Events | Descriptions |
---|---|
SleepyBot 1.1 API | |
onAction(String sender, String login, String hostname, String target, String action) | This method is called whenever an ACTION is sent from a user. |
onChannelInfo(String channel, int userCount, String topic) | After calling the listChannels() function, the server will start to send us information about each channel on the server. |
onConnect() | This method is called once the bot has successfully connected to the IRC server. |
onDeop(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient) | Called when a user (possibly us) gets operator status taken away. |
onDeVoice(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient) | Called when a user (possibly us) gets voice status removed. |
onDisconnect() | This method carries out the actions to be performed when the bot gets disconnected. |
onFileTransferFinished(DccFileTransfer transfer, Exception e) | This method gets called when a DccFileTransfer has finished. |
onFinger(String sourceNick, String sourceLogin, String sourceHostname, String target) | This method is called whenever we receive a FINGER request. |
onIncomingChatRequest(DccChat chat) | This method will be called whenever a DCC Chat request is received. |
onIncomingFileTransfer(DccFileTransfer transfer) | This method is called whenever a DCC SEND request is sent to the bot. |
onInvite(String targetNick, String sourceNick, String sourceLogin, String sourceHostname, String channel) | Called when we are invited to a channel by a user. |
onJoin(String channel, String sender, String login, String hostname) | This method is called whenever someone (possibly us) joins a channel which we are on. |
onKick(String channel, String kickerNick, String kickerLogin, String kickerHostname, String recipientNick, String reason) | This method is called whenever someone (possibly us) is kicked from any of the channels that we are in. |
onMessage(String channel, String sender, String login, String hostname, String message) | This method is called whenever a message is sent to a channel. |
onMode(String channel, String sourceNick, String sourceLogin, String sourceHostname, String mode) | Called when the mode of a channel is set. |
onNickChange(String oldNick, String login, String hostname, String newNick) | This method is called whenever someone (possibly us) changes nick on any of the channels that we are on. |
onNotice(String sourceNick, String sourceLogin, String sourceHostname, String target, String notice) | This method is called whenever we receive a notice. |
onOp(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient) | Called when a user (possibly us) gets granted operator status for a channel. |
onPart(String channel, String sender, String login, String hostname) | This method is called whenever someone (possibly us) parts a channel which we are on. |
onPing(String sourceNick, String sourceLogin, String sourceHostname, String target, String pingValue) | This method is called whenever we receive a PING request from another user. |
onPrivateMessage(String sender, String login, String hostname, String message) | This method is called whenever a private message is sent to the bot. |
onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason) | This method is called whenever someone (possibly us) quits from the server. |
onRemoveChannelBan(String channel, String sourceNick, String sourceLogin, String sourceHostname, String hostmask) | Called when a hostmask ban is removed from a channel. |
onRemoveChannelKey(String channel, String sourceNick, String sourceLogin, String sourceHostname, String key) | Called when a channel key is removed. |
onRemoveChannelLimit(String channel, String sourceNick, String sourceLogin, String sourceHostname) | Called when the user limit is removed for a channel. |
onRemoveInviteOnly(String channel, String sourceNick, String sourceLogin, String sourceHostname) | Called when a channel has 'invite only' removed. |
onRemoveModerated(String channel, String sourceNick, String sourceLogin, String sourceHostname) | Called when a channel has moderated mode removed. |
onRemoveNoExternalMessages(String channel, String sourceNick, String sourceLogin, String sourceHostname) | Called when a channel is set to allow messages from any user, even if they are not actually in the channel. |
onRemovePrivate(String channel, String sourceNick, String sourceLogin, String sourceHostname) | Called when a channel is marked as not being in private mode. |
onRemoveSecret(String channel, String sourceNick, String sourceLogin, String sourceHostname) | Called when a channel has 'secret' mode removed. |
onRemoveTopicProtection(String channel, String sourceNick, String sourceLogin, String sourceHostname) | Called when topic protection is removed for a channel. |
onServerPing(String response) | The actions to perform when a PING request comes from the server. |
onServerResponse(int code, String response) | This method is called when we receive a numeric response from the IRC server. |
onSetChannelBan(String channel, String sourceNick, String sourceLogin, String sourceHostname, String hostmask) | Called when a user (possibly us) gets banned from a channel. |
onSetChannelKey(String channel, String sourceNick, String sourceLogin, String sourceHostname, String key) | Called when a channel key is set. |
onSetChannelLimit(String channel, String sourceNick, String sourceLogin, String sourceHostname, int limit) | Called when a user limit is set for a channel. |
onSetInviteOnly(String channel, String sourceNick, String sourceLogin, String sourceHostname) | Called when a channel is set to 'invite only' mode. |
onSetModerated(String channel, String sourceNick, String sourceLogin, String sourceHostname) | Called when a channel is set to 'moderated' mode. |
onSetNoExternalMessages(String channel, String sourceNick, String sourceLogin, String sourceHostname) | Called when a channel is set to only allow messages from users that are in the channel. |
onSetPrivate(String channel, String sourceNick, String sourceLogin, String sourceHostname) | Called when a channel is marked as being in private mode. |
onSetSecret(String channel, String sourceNick, String sourceLogin, String sourceHostname) | Called when a channel is set to be in 'secret' mode. |
onSetTopicProtection(String channel, String sourceNick, String sourceLogin, String sourceHostname) | Called when topic protection is enabled for a channel. |
onTime(String sourceNick, String sourceLogin, String sourceHostname, String target) | This method is called whenever we receive a TIME request. |
onTopic(String channel, String topic, String setBy, long date, boolean changed) | This method is called whenever a user sets the topic, or when the bot joins a new channel and discovers its topic. |
onUnknown(String line) | This method is called whenever we receive a line from the server that the bot (the underlying PircBot) has not been programmed to recognise. |
onUserList(String channel, User[] users) | This method is called when we receive a user list from the server after joining a channel. |
onUserMode(String targetNick, String sourceNick, String sourceLogin, String sourceHostname, String mode) | Called when the mode of a user is set. |
onVersion(String sourceNick, String sourceLogin, String sourceHostname, String target) | This method is called whenever we receive a VERSION request. |
onVoice(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient) | Called when a user (possibly us) gets voice status granted in a channel. |
onChatRequestAccepted(DccChat chat) | Called when a chat request has been accepted. See dccSendChatRequest. |
onChatReadline(DccChat chat, String line) | Called when a new line of text has been arived. See chatReadLine. |
ululatus.org Valid XHTML 1.0! Valid CSS! Last modified 16 Oct 2008 13:03