zebot a fun (barking) modular irc bot
Copyright (c) 2002 Bruno Boettcher
zebot is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2
of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
customize your zebot.conf file and run ./zebot on any shell
ircbot written in perl, extensible through self-writable perl - modules using
OO-techniques. Thought more as a toy, even if channel camping facilities and
user managment are included: the thing acts as a dog :D
The origin from this bot comes from a french linux journal, which showed how to
write a basic bot in perl.
This code was then heavily extended, adding especially the ability to
differentiate between owner,ops and normal users. A further addition was mainly
the addition of OO-build modules.
Actually the bot was/is rewritten to use POE::Component architecture. The core
part is allready completely converted, using the P:C:IRC module for the
communication with the irc server, the modules are in rewriting stage.
The actual bot is fun writing and playing with, since it sort of emulates a
dog: tease it and it bites you, be gentle with it and it rewards you ;D
- PAM
-
acknowledge the users to pertain to a certain user group on a
certain channel, used by many other modules, e.g. to decide if a user has
operator rights or not.
- Operators
-
a module that check join messages and gives joining users
operator rights, depending on the PAM module.
- Mailbox
-
leave messages for certain users, if the user is present the
message is delivered immediately, otherwise the user is presented the message
as soon as he joins.
- File Server:
-
a module that allows users to browse a filesystem, request
some files and be served those files in a queued fashion.
- FServer-spider:
-
a module that looks for Fserver banners in the monitored
channels and connects to those fservers fetching regularly a listing of their
content and managing download lists, fetching the files requested by the user.
- Retorsion:
-
get on the nerves of the bot and fear its modulated and
increasing violence :D
- Others
-
Port some fun modules from other well known irc bots.
- new, Constructor
-
The constructor of a zebot object, initializes a number of datastructures that will be used later, creates a blessed reference
- init
-
Here we really build up this object
- _default, Default handler
-
for the stuff that couldn't be identifyed, or where we don't have specifyed a
handler
- _start, session initialisation
-
This gets executed as soon as the kernel sets up this session.
- irc_001
-
connection to a server achieved
-
After we successfully log into the IRC server, join a channel.
- irc_socketerr
-
failed to make the connection to the server
- _stop
-
allow the garbage collector to remove this
- irc_connected
-
handle connects and hopefully reconnects
- irc_disconnected
-
Reconnect to the server when we die.
- irc_ctcp_ping
-
react to a ping request
- irc_ctcpreply_ping
-
Gives lag results for outgoing PINGs.
- channel_join_topic
-
we received a channel topic
- channel_join_success
-
we managed to join the channel
- giveModules
-
issue the list of installed modules
- irc_mode
-
react on mode change issued by someone
- irc_notice
-
react on notice send to the actual chan
- irc_public
-
react on a line send to the actual chan
- irc_msg
-
react on private msg send directly to the bot
- irc_ctcp_action
-
react on private msg send directly to the bet
- irc_ctcp_version
-
spit out the version num and info when asked through ctcp version
- irc_kick
-
react on some user or the bot itself beeing kicked
- irc_part
-
react on some user leaving the channel
- irc_quit
-
react on some user dropping out of the channel
- irc_join
-
react on some user joining the channel
- irc_dcc_get
-
data was transmitted successfully
-
Notifies you that another block of data has been successfully
transferred from the client on the other end of your DCC GET con-
nection. ARG0 is the connection's magic cookie, ARG1 is the nick
of the person on the other end, ARG2 is the port number, ARG3 is
the filename, ARG4 is the total file size, and ARG5 is the number
of bytes successfully transferred so far.
- irc_dcc_chat
-
DCC chat stuff incoming
- irc_dcc_done
-
react on some dcc transfer success
- irc_dcc_error
-
react on some dcc transfer fail
- irc_dcc_request
-
react on some dcc transfer/chat proposal
-
You receive this event when another IRC client sends you a DCC SEND
or CHAT request out of the blue. You can examine the request and
decide whether or not to accept it here. ARG0 is the nick of the
client on the other end. ARG1 is the type of DCC request (CHAT,
SEND, etc.). ARG2 is the port number. ARG3 is a "magic cookie"
argument, suitable for sending with 'dcc_accept' events to signify
that you want to accept the connection (see the 'dcc_accept' docs).
For DCC SEND and GET connections, ARG4 will be the filename, and
ARG5 will be the file size.
- setircserver
-
prepare a connection with the ircserver
- connectServer
-
use the data from the serverlist and the nickname for a given network to
connect to a server
- setstreamName
-
open the log file
- parseCmdlineArgument
-
parse in the arguments from the command line, and store them in a temporary
structure, we need to do this, since some of the settings could affect the way
the settings from files are read... and since we want command line args to
override file set parms, we need to split this in 2 stages....
-
TODO i made this before beeing aware of GetOpt this should be used instead of my code here.... especially since it could be added online explanation of the settings, on the other side i didn't find out on the fast way how to preparse
- loadSettings
-
load form the conf file the different bot settings means using the setting
configpath all files ending with conf (and as soon as i figured out how to
setup the same stuff in XML, also ending with .xml) the config directory is
scanned for conf files and read in and added to the setings of the bot.
-
TODO, leave the non loaded actors settings away...
- dumpSettings
-
issue the actual settings of the bot
- saveSettings
-
save actual bot settings to the conf file
- loadActor
-
load the object definitions of eventual external modules
- dropActor
-
drop the object definitions of eventual external modules
- closeActor
-
let the different modules come to a gracious end
- reloadActors
-
conveninence method to tell the system to close down the modules, purge them
from the system, reload them and initialize them
- getMesg
-
fetch the message handler and ask it for the given translation of a token into a localized string
this method takes the arguments in the following order:
language,
token to be translated,
the mode of the actual message
a default string in case the token couldn't be found
- setting
-
setter/getter for the settings, to be able to choose any format for those
settings without disturbing the rest of the program...
- irc_invite
-
got invited by someone..
- irc_ping
-
got invited by someone..
- channel_namelist
-
got invited by someone..
the french linux journal and J-M Libs for the impulsion to write this thing
the guys from the perl usenet group for their steady help
the guys from the POE list and especially R. Caputo for their intensive help about all this POE stuff.
and last but not least Mark Fowler who helped me with his own bot to understand and isolate the parts of POE::IRC that needed to be spawned on their own to make this bot multi server aware.
Actually i am the only developer and user of this bot, seems there are too much
projects out there with irc bots, so that mine doesn't look appealing enough
for people to come even visit its project page :D but who cares, in a not so
far future this bot will have gained a complete peer-to-peer filetransfer
ability, and will be IMHO an absolute killer app for people wanting to share
and download stuff from irc channels.
Bruno Böttcher <bboett at adlp.org>
zebot home page http://www.freesoftware.fsf.org/zebot/
Net::IRC,
RFC 1459,
http://www.irchelp.org/,
http://poe.perl.org/
http://www.cs.cmu.edu/~lenzo/perl/,
http://www.infobot.org/,