My aim is to create an IRC bot, with the following minimal features:
-
automatic parallel connections to multiple servers, and to multiple channels within a server, automatic reconnect on network errors
-
authentication of users (with password and/or using services available on the network)
-
implementation of a simple wiki-like database, users with sufficient privileges can create records (storing creation and modification time for each record, storing old versions as well)
-
controlling the bot via a tcp port: users with sufficient privileges can connect to the bot using a utility program and can control it to execute given commands (for example connect to a new server if the bot is not connected to any server)
-
other extra nice features: RSS reader (announces the link of new entries to a given channel), sending forgotten password via e-mail.
lpbot has been written in C, using the following external libraries:
You need make and gcc installed, then you can build it using the
$ make
command.
If you want to monitor the traffic of the bot, add -DDEBUG to CFLAGS
in Makefile.
Now all you need is to customize config.xml, the setting names are
pretty self-explaining.
The following features are available for a user:
-
automatic parallel connect to multiple servers
-
automatic join to multiple channels, if the connect was successful
-
automatic reconnect on network error (ping timeout, read/write error)
-
commands are available via the public channel (via highlight) or in a private query as well
-
identifycommand, it requires no more parameters in case using services, or requires one password parameter if configured to use password authentication -
dbcommand, it has 3 subcommands:db get titleto query an existing record,db put title text hereto insert a new record or update an existing one anddb del titleto delete a record. -
the bot binds to port 1100 and you can access the commands via telnet as well (the syntax is
<login> PRIVMSG lpbot <command>) -
connectcommand to connect to a new server:connect test localhost 6667 lpbot2 #lpbot_local -
you can configure rss feeds in the config and the bot announces the new entries on the configured channels from time to time (interval can be set via the
rss_intervaloption). -
the
remindcommand will send your password to your email address. -
the
lpbotctlutility can be used to control the bot once it is disconnected from all servers. usage:lpbotctl [user] [host] [port]. it defaults to the current system user name, localhost and 1100, respectively. -
there are few commands in addition to the ones which were described in the specification: the
pingcommand replies with apong, and theeval <command>parameter is available for administrators to make the bot execute any IRC command.
The API documentation of the modules is available here.
From github.