BotRPC
— JSON RPC Controller¶
PyIRCBot has a json rpc interface for controlling some aspects of the bot remotely via JSON-RPC.
It’s important to know the different states a module can be in.
- Deported - Module’s code exists on disk but has not been read
- Imported - Module’s code exists in memory but has not been instantiated
- Loaded - Module’s code exists in memory and has been instantiated. “Running” modules are of this state.
-
class
pyircbot.rpc.
BotRPC
(main)[source]¶ Bases:
threading.Thread
Parameters: main (PyIRCBot) – A reference to the PyIRCBot instance this instance will control -
deportModule
(moduleName)[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
-
eval
(code)[source]¶ Execute arbitrary python code on the bot
Parameters: code (str) – Python code to pass to eval
-
exec
(code)[source]¶ Execute arbitrary python code on the bot
Parameters: code (str) – Python code to pass to exec
-
getLoadedModules
()[source]¶ Return a list of active modules
Returns: list – [‘ModuleName1’, ‘ModuleName2’]
-
getPluginVar
(moduleName, moduleVarName)[source]¶ Extract a property from an active module and return it
Parameters: Returns: mixed – Any basic type extracted from an active module
-
importModule
(moduleName)[source]¶ Import a module
Parameters: moduleName (str) – Name of the module to import
-
loadModule
(moduleName)[source]¶ Activate a module.
Parameters: moduleName (str) – Name of the module to activate
-
pluginCommand
(moduleName, methodName, argList)[source]¶ Run a method of an active module
Parameters: Returns: mixed – Any basic type the target method may return
-
redoModule
(moduleName)[source]¶ Reload a running module from disk
Parameters: moduleName (str) – Name of the target module
-
reloadModule
(moduleName)[source]¶ Deactivate and activate a module.
Parameters: moduleName (str) – Name of the target module
-