PyIRCBot — Main class of the bot

Main bot class

class pyircbot.pyircbot.ModuleLoader[source]

Bases: object

deportmodule(name)[source]

Remove a module’s code from memory. If the module is loaded it will be unloaded silently.

Parameters:moduleName (str) – Name of the module to import
getBestModuleForService(service)[source]

Get the first module that provides the specified service

Parameters:service (str) – name of the service searched for
Returns:object – the module object, if found. None if not found.
getmodulebyname(name)[source]

Get a module object by name

Parameters:name (str) – name of the module to return
Returns:object – the module object
getmodulesbyservice(service)[source]

Get a list of modules that provide the specified service

Parameters:service (str) – name of the service searched for
Returns:list – a list of module objects
importmodule(name)[source]

Import a module

Parameters:moduleName (str) – Name of the module to import
loadmodule(name)[source]

Activate a module.

Parameters:moduleName (str) – Name of the module to activate
modules = None

instances of modules

redomodule(name)[source]

Reload a running module from disk

Parameters:moduleName (str) – Name of the target module
reloadmodule(name)[source]

Deactivate and activate a module.

Parameters:moduleName (str) – Name of the target module
unloadmodule(name)[source]

Deactivate a module.

Parameters:moduleName (str) – Name of the module to deactivate
class pyircbot.pyircbot.PrimitiveBot(botconfig)[source]

Bases: pyircbot.pyircbot.ModuleLoader

closeAllModules()[source]

Deport all modules (for shutdown). Modules are unloaded in the opposite order listed in the config.

getConfigPath(moduleName)[source]

Return the absolute path for a module’s config file

Parameters:moduleName (str) – the module who’s config file we want
getDataPath(moduleName)[source]

Return the absolute path for a module’s data dir

Parameters:moduleName (str) – the module who’s data dir we want
class pyircbot.pyircbot.PyIRCBot(botconfig)[source]

Bases: pyircbot.pyircbot.PrimitiveBot

Parameters:botconfig (dict) – The configuration of this instance of the bot. Passed by main.py.
disconnect(message)[source]

Send quit message and disconnect from IRC.

Parameters:
  • message (str) – Quit message
  • reconnect (bool) – True causes a reconnection attempt to be made after the disconnect
getConfigPath(moduleName)[source]

Return the absolute path for a module’s config file

Parameters:moduleName (str) – the module who’s config file we want
getDataPath(moduleName)[source]

Return the absolute path for a module’s data dir

Parameters:moduleName (str) – the module who’s data dir we want
initModules()[source]

load modules specified in instance config

kill(message='Help! Another thread is killing me :(', forever=True)[source]

Close the connection violently

Parameters:
  • sys_exit (bool) – True causes sys.exit(0) to be called
  • message (str) – Quit message
log = None

Reference to logger object

loop = None

Reference to BotRPC thread

ratelimit = None

IRC protocol handler

run()[source]
version = '5.0.0'