.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.07) .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Bot::BasicBot 3pm" .TH Bot::BasicBot 3pm "2008-08-04" "perl v5.10.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Bot::BasicBot \- simple irc bot baseclass .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& # with all defaults \& my $bot = Bot::BasicBot\->new( channels => ["#bottest"] ); \& $bot\->run(); \& \& # with all known options \& my $bot = Bot::BasicBot\->new( \& \& server => "irc.example.com", \& port => "6667", \& channels => ["#bottest"], \& \& nick => "basicbot", \& alt_nicks => ["bbot", "simplebot"], \& username => "bot", \& name => "Yet Another Bot", \& \& ignore_list => [qw(dipsy dadadodo laotse)], \& \& charset => "utf\-8", # charset the bot assumes the channel is using \& \& ); \& $bot\->run(); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Basic bot system designed to make it easy to do simple bots, optionally forking longer processes (like searches) concurrently in the background. .PP There are several examples of bots using Bot::BasicBot in the examples/ folder in the Bot::BasicBot tarball. If you installed Bot::BasicBot through \&\s-1CPAN\s0, see http://jerakeen.org/programming/Bot\-BasicBot for more docs and examples. .PP A quick summary, though \- You want to define your own package that subclasses Bot::BasicBot, override various methods (documented below), then call \fInew()\fR and \fIrun()\fR on it. .SH "STARTING THE BOT" .IX Header "STARTING THE BOT" .Sh "new( key => value, .. )" .IX Subsection "new( key => value, .. )" Creates a new instance of the class. Name value pairs may be passed which will have the same effect as calling the method of that name with the value supplied. Returns a Bot::BasicBot object, that you can call 'run' on later. .PP eg: .PP .Vb 1 \& my $bot = Bot::BasicBot\->new( nick => \*(Aqsuperbot\*(Aq, channels => [ \*(Aq#superheroes\*(Aq ] ); .Ve .Sh "\fIrun()\fP" .IX Subsection "run()" Runs the bot. Hands the control over to the \s-1POE\s0 core. .SH "METHODS TO OVERRIDE" .IX Header "METHODS TO OVERRIDE" In your Bot::BasicBot subclass, you want to override some of the following methods to define how your bot works. These are all object methods \- the (implicit) first parameter to all of them will be the bot object. .Sh "\fIinit()\fP" .IX Subsection "init()" called when the bot is created, as part of \fInew()\fR. Override to provide your own init. Return a true value for a successful init, or undef if you failed, in which case \fInew()\fR will die. .Sh "said($args)" .IX Subsection "said($args)" This is the main method that you'll want to override in your subclass \- it's the one called by default whenever someone says anything that we can hear, either in a public channel or to us in private that we shouldn't ignore. .PP You'll be passed a hashref that contains the arguments described below. Feel free to alter the values of this hash \- it won't be used later on. .IP "who" 4 .IX Item "who" Who said it (the nick that said it) .IP "raw_nick" 4 .IX Item "raw_nick" The raw \s-1IRC\s0 nick string of the person who said it. Only really useful if you want more security for some reason. .IP "channel" 4 .IX Item "channel" The channel in which they said it. Has special value \*(L"msg\*(R" if it was in a message. Actually, you can send a message to many channels at once in the \s-1IRC\s0 spec, but no-one actually does this so this is just the first one in the list. .IP "body" 4 .IX Item "body" The body of the message (i.e. the actual text) .IP "address" 4 .IX Item "address" The text that indicates how we were addressed. Contains the string \&\*(L"msg\*(R" for private messages, otherwise contains the string off the text that was stripped off the front of the message if we were addressed, e.g. \*(L"Nick: \*(R". Obviously this can be simply checked for truth if you just want to know if you were addressed or not. .PP You should return what you want to say. This can either be a simple string (which will be sent back to whoever was talking to you as a message or in public depending on how they were talking) or a hashref that contains values that are compatible with say (just changing the body and returning the structure you were passed works very well.) .PP Returning undef will cause nothing to be said. .ie n .Sh "emoted( $args )" .el .Sh "emoted( \f(CW$args\fP )" .IX Subsection "emoted( $args )" This is a secondary method that you may wish to override. It gets called when someone in channel 'emotes', instead of talking. In its default configuration, it will simply pass anything emoted on channel through to the \f(CW\*(C`said\*(C'\fR handler. .PP \&\f(CW\*(C`emoted\*(C'\fR receives the same data hash as \f(CW\*(C`said\*(C'\fR. .ie n .Sh "chanjoin( $mess )" .el .Sh "chanjoin( \f(CW$mess\fP )" .IX Subsection "chanjoin( $mess )" Called when someone joins a channel. \f(CW$mess\fR is an object similar to a \&\fIsaid()\fR message, \f(CW$mess\fR\->{who} is the nick of the user who joined, \&\f(CW$mess\fR\->{channel} is the channel they joined. .PP This is a do-nothing implementation, override this in your subclass. .ie n .Sh "chanpart( $mess )" .el .Sh "chanpart( \f(CW$mess\fP )" .IX Subsection "chanpart( $mess )" Called when someone leaves a channel. \f(CW$mess\fR is an object similar to a \&\fIsaid()\fR message, \f(CW$mess\fR\->{who} is the nick of the user who left, \&\f(CW$mess\fR\->{channel} is the channel they left. .PP This is a do-nothing implementation, override this in your subclass. .ie n .Sh "got_names( $mess )" .el .Sh "got_names( \f(CW$mess\fP )" .IX Subsection "got_names( $mess )" Whenever we have been given a definitive list of 'who is in the channel', this function will be called. As usual, \f(CW$mess\fR is a hash. \f(CW$mess\fR\->{channel} will be the channel we have information for, \f(CW$mess\fR\->{names} is a hashref, where the keys are the nicks of the users, and the values are more hashes, containing the two keys 'op' and 'voice', indicating if the user is a chanop or voiced respectively. .PP The reply value is ignored. .PP Normally, I wouldn't override this method \- instead, just use the names call when you want to know who's in the channel. Override this only if you want to be able to do something as soon as possible. Also be aware that the names list can be changed by other events \- kicks, joins, etc, and this method won't be called when that happens. .ie n .Sh "topic( $mess )" .el .Sh "topic( \f(CW$mess\fP )" .IX Subsection "topic( $mess )" Called when the topic of the channel changes. \f(CW$mess\fR\->{channel} is the channel the topic was set in, \f(CW$mess\fR\->{who} is the nick of the user who changed the channel, and \f(CW$mess\fR\->{topic} will be the new topic of the channel. .ie n .Sh "nick_change( $mess )" .el .Sh "nick_change( \f(CW$mess\fP )" .IX Subsection "nick_change( $mess )" When a user changes nicks, this will be called. \f(CW$mess\fR looks like .PP .Vb 3 \& { from => "old_nick", \& to => "new_nick", \& } .Ve .ie n .Sh "kicked( $mess )" .el .Sh "kicked( \f(CW$mess\fP )" .IX Subsection "kicked( $mess )" Called when a user is kicked from the channel. \f(CW$mess\fR looks like: .PP .Vb 5 \& { channel => "#channel", \& who => "nick", \& kicked => "kicked", \& reason => "reason", \& } .Ve .PP The reply value is ignored. .Sh "\fItick()\fP" .IX Subsection "tick()" This is an event called every regularly. The function should return the amount of time until the tick event should next be called. The default tick is called 5 seconds after the bot starts, and the default implementation returns '0', which disables the tick. Override this and return non-zero values to have an ongoing tick event. .PP Use this function if you want the bot to do something periodically, and don't want to mess with 'real' \s-1POE\s0 things. .PP Call the schedule_tick event to schedule a tick event without waiting for the next tick. .Sh "help" .IX Subsection "help" This is the other method that you should override. This is the text that the bot will respond to if someone simply says help to it. This should be considered a special case which you should not attempt to process yourself. Saying help to a bot should have no side effects whatsoever apart from returning this text. .Sh "connected" .IX Subsection "connected" An optional method to override, gets called after we have connected to the server .SH "BOT METHODS" .IX Header "BOT METHODS" There are a few methods you can call on the bot object to do things. These are as follows: .Sh "schedule_tick(time)" .IX Subsection "schedule_tick(time)" Causes the tick event to be called in 'time' seconds (or 5 seconds if time is left unspecified). Note that if the tick event is due to be called already, this will override it, you can't schedule multiple future events with this funtction. .Sh "forkit" .IX Subsection "forkit" This method allows you to fork arbitrary background processes. They will run concurrently with the main bot, returning their output to a handler routine. You should call \f(CW\*(C`forkit\*(C'\fR in response to specific events in your \f(CW\*(C`said\*(C'\fR routine, particularly for longer running processes like searches, which will block the bot from receiving or sending on channel whilst they take place if you don't fork them. .PP \&\f(CW\*(C`forkit\*(C'\fR takes the following arguments: .IP "run" 4 .IX Item "run" A coderef to the routine which you want to run. Bear in mind that the routine doesn't automatically get the text of the query \- you'll need to pass it in \f(CW\*(C`arguments\*(C'\fR (see below) if you want to use it at all. .Sp Apart from that, your \f(CW\*(C`run\*(C'\fR routine just needs to print its output to \&\f(CW\*(C`STDOUT\*(C'\fR, and it will be passed on to your designated handler. .IP "handler" 4 .IX Item "handler" Optional. A method name within your current package which we can return the routine's data to. Defaults to the built-in method \&\f(CW\*(C`say_fork_return\*(C'\fR (which simply sends data to channel). .IP "body" 4 .IX Item "body" Optional. Use this to pass on the body of the incoming message that triggered you to fork this process. Useful for interactive proceses such as searches, so that you can act on specific terms in the user's instructions. .IP "who" 4 .IX Item "who" The nick of who you want any response to reach (optional inside a channel.) .IP "channel" 4 .IX Item "channel" Where you want to say it to them in. This may be the special channel \&\*(L"msg\*(R" if you want to speak to them directly .IP "address" 4 .IX Item "address" Optional. Setting this to a true value causes the person to be addressed (i.e. to have \*(L"Nick: \*(R" prepended to the front of returned message text if the response is going to a public forum. .IP "arguments" 4 .IX Item "arguments" Optional. This should be an anonymous array of values, which will be passed to your \f(CW\*(C`run\*(C'\fR routine. Bear in mind that this is not intelligent \- it will blindly spew arguments at \f(CW\*(C`run\*(C'\fR in the order that you specify them, and it is the responsibility of your \f(CW\*(C`run\*(C'\fR routine to pick them up and make sense of them. .Sh "say( key => value, .. )" .IX Subsection "say( key => value, .. )" Say something to someone. You should pass the following arguments: .IP "who" 4 .IX Item "who" The nick of who you are saying this to (optional inside a channel.) .IP "channel" 4 .IX Item "channel" Where you want to say it to them in. This may be the special channel \&\*(L"msg\*(R" if you want to speak to them directly .IP "body" 4 .IX Item "body" The body of the message. I.e. what you want to say. .IP "address" 4 .IX Item "address" Optional. Setting this to a true value causes the person to be addressed (i.e. to have \*(L"Nick: \*(R" prepended to the front of the message text if this message is going to a pulbic forum. .PP You can also make non-OO calls to \f(CW\*(C`say\*(C'\fR, which will be interpreted as coming from a process spawned by \f(CW\*(C`forkit\*(C'\fR. The routine will serialise any data it is sent, and throw it to \s-1STDOUT\s0, where POE::Wheel::Run can pass it on to a handler. .Sh "emote( key => value, .. )" .IX Subsection "emote( key => value, .. )" \&\f(CW\*(C`emote\*(C'\fR will return data to channel, but emoted (as if you'd said \*(L"/me writes a spiffy new bot\*(R" in most clients). It takes the same arguments as \f(CW\*(C`say\*(C'\fR, listed above. .ie n .Sh "reply($mess, $body)" .el .Sh "reply($mess, \f(CW$body\fP)" .IX Subsection "reply($mess, $body)" Reply to a message \f(CW$mess\fR. Will reply to an incoming message with the text '$body', in a privmsg if \f(CW$mess\fR was a privmsg, in channel if not, and prefixes if \f(CW$mess\fR was prefixed. Mostly a shortcut method \- it's roughly equivalent to \f(CW$mess\fR\->{body} = \f(CW$body\fR; \f(CW$self\fR\->say($mess); .Sh "channel_data" .IX Subsection "channel_data" .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" Get or set methods. Changing most of these values when connected won't cause sideffects. e.g. changing the server will not cause a disconnect and a reconnect to another server. .PP Attributes that accept multiple values always return lists and either accept an arrayref or a complete list as an argument. .PP The usual way of calling these is as keys to the hash passed to the \&'new' method. .Sh "server" .IX Subsection "server" The server we're going to connect to. Defaults to \&\*(L"irc.perl.org\*(R". .Sh "port" .IX Subsection "port" The port we're going to use. Defaults to \*(L"6667\*(R" .Sh "password" .IX Subsection "password" The server password for the server we're going to connect to. Defaults to undef. .Sh "ssl" .IX Subsection "ssl" A boolean to indicate whether or not the server we're going to connect to is an \s-1SSL\s0 server. Defaults to 0. .Sh "nick" .IX Subsection "nick" The nick we're going to use. Defaults to five random letters and numbers followed by the word \*(L"bot\*(R" .Sh "alt_nicks" .IX Subsection "alt_nicks" Alternate nicks that this bot will be known by. These are not nicks that the bot will try if it's main nick is taken, but rather other nicks that the bot will recognise if it is addressed in a public channel as the nick. This is useful for bots that are replacements for other bots...e.g, your bot can answer to the name \*(L"infobot: \*(R" even though it isn't really. .Sh "username" .IX Subsection "username" The username we'll claim to have at our ip/domain. By default this will be the same as our nick. .Sh "name" .IX Subsection "name" The name that the bot will identify itself as. Defaults to \&\*(L"$nick bot\*(R" where \f(CW$nick\fR is the nick that the bot uses. .Sh "channels" .IX Subsection "channels" The channels we're going to connect to. .Sh "quit_message" .IX Subsection "quit_message" The quit message. Defaults to \*(L"Bye\*(R". .Sh "ignore_list" .IX Subsection "ignore_list" The list of irc nicks to ignore \fBpublic\fR messages from (normally other bots.) Useful for stopping bot cascades. .Sh "charset" .IX Subsection "charset" \&\s-1IRC\s0 has no defined character set for putting high-bit chars into channel. In general, people tend to assume latin\-1, but in case your channel thinks differently, the bot can be told about different charsets. .PP This feature requires perl 5.8+, I'm not fannying about with charsets under any other version of perl. .Sh "flood" .IX Subsection "flood" Set to '1' to disable the built-in flood protection of POE::Compoent::IRC .SH "STATES" .IX Header "STATES" These are the \s-1POE\s0 states that we register in order to listen for \s-1IRC\s0 events. For the most part you don't need to worry about these, unless you want to override them to do something clever. .Sh "start_state" .IX Subsection "start_state" Called when we start. Used to fire a \*(L"connect to irc server event\*(R" .Sh "reconnect" .IX Subsection "reconnect" Connects the bot to the \s-1IRC\s0 server. Called 1 second after the 'start' event. .PP in an ideal world, this will never get called again \- we schedule it for 'x' seconds in the future, and whenever we see a server ping we reset this counter again. This means that it'll get run if we haven't seen anything from the server for a while, so we can assume that something bad has happened. At that point we shotgun the \s-1IRC\s0 session and restart everything, so we reconnect to the server. .PP This is by far the most reliable way I have found of ensuring that a bot will reconnect to a server after it's lost a network connection for some reason. .PP By default, the timeout is 300 seconds. It can be set by changing \&\f(CW$Bot::BasicBot::RECONNECT_TIMEOUT\fR. .Sh "stop_state" .IX Subsection "stop_state" Called when we're stopping. Shutdown the bot correctly. .Sh "irc_001_state" .IX Subsection "irc_001_state" Called when we connect to the irc server. This is used to tell the irc server that we'd quite like to join the channels. .PP We also ignore ourselves. We don't want to hear what we have to say. .Sh "irc_disconnected_state" .IX Subsection "irc_disconnected_state" Called if we are disconnected from the server. Logs the error and schedules a reconnect event. .Sh "irc_error_state" .IX Subsection "irc_error_state" Called if there is an irc server error. Logs the error and schedules a reconnect event. .Sh "irc_kicked_state" .IX Subsection "irc_kicked_state" Called on kick. If we're kicked then it's best to do nothing. Bots are normally called in wrapper that restarts them if we die, which may end us up in a busy loop. Anyway, if we're not wanted, the best thing to do would be to hang around off channel. .Sh "irc_join_state" .IX Subsection "irc_join_state" Called if someone joins. Used for nick tracking .Sh "irc_nick_state" .IX Subsection "irc_nick_state" Called if someone changes nick. Used for nick tracking. .Sh "irc_mode_state" .IX Subsection "irc_mode_state" .Sh "irc_said_state" .IX Subsection "irc_said_state" Called if we recieve a private or public message. This formats it into a nicer format and calls 'said' .Sh "irc_emoted_state" .IX Subsection "irc_emoted_state" Called if someone \*(L"emotes\*(R" on channel, rather than directly saying something. Currently passes the emote striaght to \f(CW\*(C`irc_said_state\*(C'\fR which deals with it as if it was a spoken phrase. .Sh "irc_received_state" .IX Subsection "irc_received_state" Called by \f(CW\*(C`irc_said_state\*(C'\fR and \f(CW\*(C`irc_emoted_state\*(C'\fR in order to format channel input into a more copable-with format. .Sh "irc_ping_state" .IX Subsection "irc_ping_state" The most reliable way I've found of doing auto-server-rejoin is to listen for pings. Every ping we get, we put off rejoining the server for another few mins. If we haven't heard a ping in a while, the rejoin code will get called. .PP Recently, I've adapted this for servers that don't send pings very often, and reset the counter any time _anything_ interesting happens. .PP You can change the amount of time the bot waits between events before calling a reconnect event by changing \f(CW$Bot::BasicBot::RECONNECT_TIMEOUT\fR to a value in seconds. The default is '500'. .Sh "irc_chanjoin_state" .IX Subsection "irc_chanjoin_state" Called if someone joins a channel. .Sh "irc_chanpart_state" .IX Subsection "irc_chanpart_state" Called if someone parts a channel. .Sh "irc_chan_received_state" .IX Subsection "irc_chan_received_state" Called by \f(CW\*(C`irc_chanjoin_state\*(C'\fR and \f(CW\*(C`irc_chanpart_state\*(C'\fR in order to format channel joins and parts into a more copable-with format. .Sh "fork_close_state" .IX Subsection "fork_close_state" Called whenever a process forked by POE::Wheel::Run (in \f(CW\*(C`forkit\*(C'\fR) terminates, and allows us to delete the object and associated data from memory. .Sh "fork_error_state" .IX Subsection "fork_error_state" Called if a process forked by POE::Wheel::Run (in \f(CW\*(C`forkit\*(C'\fR) hits an error condition for any reason. Does nothing, but can be overloaded in derived classes to be more useful .Sh "tick_state" .IX Subsection "tick_state" the \s-1POE\s0 state for the tick event. Reschedules a tick event for the future if the tick method returned a value. .Sh "names_state" .IX Subsection "names_state" .Sh "names_done_state" .IX Subsection "names_done_state" .Sh "topic_raw_state" .IX Subsection "topic_raw_state" .Sh "topic_state" .IX Subsection "topic_state" .SH "OTHER METHODS" .IX Header "OTHER METHODS" .Sh "\s-1AUTOLOAD\s0" .IX Subsection "AUTOLOAD" Bot::BasicBot implements \s-1AUTOLOAD\s0 for sending arbitrary states to the underlying POE::Component::IRC compoment. So for a \f(CW$bot\fR object, sending .PP .Vb 1 \& $bot\->foo("bar"); .Ve .PP is equivalent to .PP .Vb 1 \& $poe_kernel\->post(BASICBOT_ALIAS, "foo", "bar"); .Ve .Sh "log" .IX Subsection "log" Logs the message. This method merely prints to \s-1STDERR\s0 \- If you want smarter logging, override this method \- it will have simple text strings passed in \&\f(CW@_\fR. .Sh "ignore_nick($nick)" .IX Subsection "ignore_nick($nick)" Return true if this nick should be ignored. Ignores anything in the ignore list .Sh "nick_strip" .IX Subsection "nick_strip" Takes a nick and hostname (of the form \*(L"nick!hostname\*(R") and returns just the nick .Sh "charset_decode( foo, bar, baz )" .IX Subsection "charset_decode( foo, bar, baz )" Converts a string of bytes into a perl string, using the bot's charset. (under perls before 5.8, just returns the thing it's passed. .PP Takes a list of strings, returns a list of strings, this is useful in the contexts that I tend to be calling it from. Bytes that cannot be decoded are converted to '?' symbols \- see http://search.cpan.org/~dankogai/Encode\-2.09/Encode.pm#Handling_Malformed_Data .Sh "charset_encode( foo, bar, baz )" .IX Subsection "charset_encode( foo, bar, baz )" Converts a list of perl strings into a list of byte sequences, using the bot's charset. See charset_decode. .SH "AUTHOR" .IX Header "AUTHOR" Tom Insam .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "CREDITS" .IX Header "CREDITS" The initial version of Bot::BasicBot was written by Mark Fowler, and many thanks are due to him. .PP Nice code for dealing with emotes thanks to Jo Walsh. .PP Various patches from Tom Insam, including much improved rejoining, \&\s-1AUTOLOAD\s0 stuff, better interactive help, and a few \s-1API\s0 tidies. .PP Maintainership for a while was in the hands of Simon Kent . Don't know what he did. :\-) .PP I recieved patches for tracking joins and parts from Silver, sat on them for two months, and have finally applied them. Thanks, dude. He also sent me changes for the tick event \s-1API\s0, which made sense. .SH "SYSTEM REQUIREMENTS" .IX Header "SYSTEM REQUIREMENTS" Bot::BasicBot is based on \s-1POE\s0, and really needs the latest version as of writing (0.22), since POE::Wheel::Run (used for forking) is still under development, and the interface recently changed. With earlier versions of \s-1POE\s0, forking will not work, and the makefile process will carp if you have < 0.22. Sorry. .PP You also need POE::Component::IRC. .SH "BUGS" .IX Header "BUGS" During the make, make test make install process, \s-1POE\s0 will moan about its kernel not being run. I'll try and gag it in future releases, but hey, release early, release often, and it's not a fatal error. It just looks untidy. .PP Don't call your bot \*(L"0\*(R". .PP Nick tracking blatantly doesn't work yet. In Progress. .PP \&\f(CW\*(C`fork_error_state\*(C'\fR handlers sometimes seem to cause the bot to segfault. I'm not yet sure if this is a POE::Wheel::Run problem, or a problem in our implementation. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1POE\s0, POE::Component::IRC .PP Possibly Infobot, at http://www.infobot.org