Skip to content

Nemubot first launch

nemunaire edited this page Sep 8, 2014 · 6 revisions

Prepare the configuration

Copy the file bot_sample.xml and edit the new file to follow your settings.

<nemubotconfig nick="nemubot" realname="nemubot" owner="someone" ip="42.42.42.42">
  <server server="irc.freenode.org" port="6667" password="secret" autoconnect="true">
    <channel name="#nemutest" />
  </server>
  <load path="cmd_server" />
  <load path="ycc" />
  <load path="velib" />
</nemubotconfig>

nemubotconfig tag

The nick field indicates the name used by the bot. If someone talks to it, it recognizes that the message is for it if this one begins by nick:.

The owner field indicates the name of the user that can fully control the bot through special messages.

The ip field is used to serve DCC connection.

server tag

If the ssl attribute is present, the connection will be made over TLS.

Each attribute available on nemubotconfig can be overwritted on the server tag.

You can connect the bot to multiple servers by duplicating the server tag.

channel tag

Nemubot can automaticaly joins channels after connection. Just fill one channel tag per channel to connect. Indicate the channel name in the name attribute.

If a password is needed to join the channel, you can add a password attribute to the tag.

include tag

This tag just load another nemubot configuration file, located at path attribute.

Usage:

  <load path="configs/freenode.xml" />

module tag

This tag will load a module.

Basic usage:

  <module name="more" />

Usage with some configuration:

  <module name="more">
    <configitem key1="value1" key2="value2" />
  </module>

XML nodes are accessible in module code as CONF global variable.

Launch the bot

The easiest way to launch the bot is by executing the file nemubot.py with the configuration file as first argument. In this case, it will load the file and contained modules, connect to listed servers and waiting for messages!

You can also use the nemubot shell: just type the command ./nemubot.py in your shell. Some debug line will be shown and next, a prompt will wait for you to enter a command; type load bot.xml where bot.xml is the name of the configuration file containing your configuration.

Quit the bot

In order to close nemubot, you just have to type quit in the prompt. You can also press Ctrl-D with an empty line. It will save all loaded modules, shutdown launched modules, shutdown servers connection and then quit.

How to update/upgrade/restart/reload a part of the bot?

If you change a part of the bot, you don't need to restart the program. Just type reset in the prompt. This command will save and shutdown all modules, clean the module list and then reload all Python code. The connected servers aren't reloaded. In order to refresh their code, use the command hotswap.