fatbotslim.irc.bot¶
This module contains IRC protocol related stuff.
- class fatbotslim.irc.bot.IRC(settings)[source]¶
The main IRC bot class.
The only expected argument is the bot’s configuration, it should be a dict with at least the following keys defined:
- server: the ircd’s host (str)
- port: the ircd’s port (int)
- ssl: connect to the server using SSL (bool)
- channels: the channels to join upon connection (list)
- nick: the bot’s nickname (str)
- realname: the bot’s real name (str)
Parameters: settings (dict) – bot configuration. - add_handler(handler, args=None, kwargs=None)[source]¶
Registers a new handler.
Parameters: - handler (fatbotslim.handlers.BaseHandler) – handler to register.
- args (list) – positional arguments to pass to the handler’s constructor.
- kwargs (dict) – keyword arguments to pass to the handler’s constructor.
- cmd(command, args, prefix=None)[source]¶
Sends a command to the server.
Parameters: - command (unicode) – IRC code to send.
- args (basestring) – arguments to pass with the command.
- prefix (str or None) – optional prefix to prepend to the command.
- disable_rights()[source]¶
Disables rights management provided by fatbotslim.handlers.RightsHandler.
- enable_rights()[source]¶
Enables rights management provided by fatbotslim.handlers.RightsHandler.
- notice(target, msg)[source]¶
Sends a NOTICE to an user or channel.
Parameters: - target (str) – user or channel to send to.
- msg (basestring) – message to send.
- class fatbotslim.irc.bot.Message(data)[source]¶
Holds informations about a line received from the server.
Parameters: data (unicode) – line received from the server.
- exception fatbotslim.irc.bot.NullMessage[source]¶
Raised when an empty line is received from the server.