Nanobot manual

From Insomnia 24/7 Wiki
Revision as of 15:23, 1 March 2011 by imported>Wikiadmin (Configuration)
Jump to: navigation, search

Environment

All you need for this bot to run is a Perl environment.
You you don't already have Perl installed, please do that first.
If you have modules you want to load, make a directory named "modules" in the same folder where your nanobot.pl resides, and place your module files in there.

Configuration

To configure your bots settings like the server and nickname, open nanobot.pl in a text editor.
Just a few lines into the file, you will find this block of text:
$version = "Nanobot 3.0";
$server = 'irc.insomnia247.nl';
$port = 6667;
$sslport = 6669;
$botnick = 'nanobot';
$botuser = 'nanobot';
$nsp = '';
@channels = ("#bots", "#yourchannel");
@opers = ("insomnia247.nl", "rootedker.nl", "fbi.gov", "eye.spy");
$modchan = '#yourchannel';
$datadir = 'botdata';
$moddir = 'modules';
@autoload = ();
$wisecrack_seen_botnick = "I'm right here. I mean ... really, how did you miss that one?";
$wisecrack_seen_self = "I can see you! You're right there! That's right, I can see.";
$wait_for_ping = 0;
$connect_timeout = 120;
$ping_timeout = 300;
These are the variables that hold the bots configuration, we will now go over each of these values and what they do
version: This is the version number of the bot, normally you will not have to change this.
server: This holds the value of the server you want your bot to connect to.
This can be either a hostname (irc.myircserver.com), an IPv4 address (127.0.0.1) or an IPv6 address (::1).
port: The port number of the IRC server you want to connect to. (Usually 6667.)
sslport: The port number the IRC server uses for SSL connections. (Can be ignored if you don't use SSL.)
botnick: The bots nickname. This is how the bot will show up in channels etc.
botuser: Username for the bot. In IRC terms, it is "nickname!username@hostname".
nsp: NickServ password for your bot's nickname. Can be left blank if the bot's nick is not registered, or if you do not want it to identify with NickServ.
channels: List of channels the bot will join when it connects to the server. @channels = ("#frist", "#second", "#third");
opers: Hostnames or hostmasks for bot admins. Note that they must appear as the bot sees them. @opers = ("my.ip.here", "and.some.vhost.com");
Only the hostname should be added. (So if you are someguy!bob@SOMEHASH-my.isp.com you should add "SOMEHASH-my.isp.com".)
modchan: This is the bots main channel, auto voice, auto oper and auto kick will be preformed here.
datadir: Directory where the bot stores data for it's modchan. (Will be created if it doesn't exist.)
moddir: Directory where the bot will look for modules. (Will be created if it doesn't exist.)
autoload: List of modules that should be loaded automatically when the bot starts up. (Module name only.) @autoload = ("mymodule", "kickban", "anothermodule");
wisecrack_seen_botnick: Line the bot will say when the !seen command is given for the bots own nickname.
wisecrack_seen_self: Line the bot will say when the !seen command is given for the users own nickname.
wait_for_ping: Used to tell the bot if it needs to wait for a PING request before joining channels. (0 = No, 1 = Yes)
If your bot seems to connect, but isn't joining channels, this might well be your problem.
connect_timeout: Time in seconds before giving up trying to connect to the IRC server.
ping_timeout: Time in seconds the bot will wait before assuming a network timeout and tries to reconnect.

Starting command

To start the bot, simply go into the directory where the nanobot.pl file is located and type:
 perl nanobot.pl

Commandline options

The following options may be appended:

-s or --ssl: Tell the bot to use Secure Socket Layers for it's connection.
-h or --help: Print a short help on which functions are available.
-v or --version: Print the version number and exit.
-q or --quiet: Don't generate any output.
-d or --debug: Print debugging lines. May be used twice to see all incomming and outgoing traffic.

Short and long options may be interchanged.

Example:
 perl nanobot.pl --ssl -d --debug
This would start the bot with Secure Socket Layers, and it's most verbose level of debugging.

Bot commands

Commands: !command
Example !help
Command arguments: [argument]
Example: !voice Bobby
Multiple options for the same argument: [argument 1|argument 2]
Example: !bot on

Public commands

!help Sends available commands to the user.
!version Sends the running version to the user.
!seen [nickname] Shows when the user was last seen, and what he said.

Admin commands

!quit [message] Stop the bot. (Message arguement may be ignored.)
!join [channel] Join specified channel.
!part [channel] Part specified channel.
!topic [topic] Set new topic in current channel.
!mode [modeline] Raw IRC mode line. Example: !mode #mychannel +i Bobby
!nick [botnick] Change the bots nickname.
!loadlist Load lists containing hostmasks for auto-oper, auto-voice etc. for the modchan.
!modchan [channel] Set active channel. Returms current modchan when no arguemnet is given.
!bot [on|off] Switch bot on or off. (Auto voice, auto oper, seen command etc.) On by default.
!all [op|hop|voice] Give this status to every user who enters the modchan.
!none [op|hop|voice] Undo for the !all command.
!add [op|hop|voice|kick] [hostmask] Add hostmask to the specified list.
![op|deop|hop|dehop|voice|devoice] [nick] Give/take ops, half-ops and voice. When no nickname is given, action is preformed on yourself.
!kick [nick] Kick user from the channel.
![ban|unban] [hostmask] Ban/unban hosts from the current channel.
!admin [add|del] [hostmask] Control admin access to the bot. When no hostmask is given, the current list of admins is returned.
!raw [data] Send raw data to the IRC server.

Module commands

![load|unload|reload] [module] Load / unload / reload a module. (Bare module name only, no directory name or .pm)
!loaded List currently loaded modules.
!available List all available modules.
!pubmods [on|off] Switch public usage of modules on or off. (This effectively makes everyone a bot admin for the modules.)
Calling a command in a module follows this syntax
!modulename.command [Args]
Arguments may or may not be needed, this depends on the command and the module.
When only !modulename is called, it will execute the module's "help" command if one is available.