Core¶
-
class
glados.core.
Glados
(config_file=None, plugins_folder=None, bots_config_dir=None, plugins_config_dir=None)[source]¶ Bases:
object
Glados is the core of the GLaDOS package.
- Parameters
config_file (
Optional
[str
]) – path to config fileplugins_folder (
Optional
[str
]) – path to plugins folderbots_config_dir (
Optional
[str
]) – path to bots config folderplugins_config_dir (
Optional
[str
]) – path to plugin config folder.
Notes
If
config_file
is passed in and the file hasplugins_folder
,bots_config_dir
,plugins_config_dir
in it , then the other parameters are not required-
add_bot
(bot)[source]¶ Add a new bot to GLaDOS.
- Parameters
bot (
GladosBot
) – the bot to be added to GLaDOS- Return type
NoReturn
-
add_plugin
(plugin)[source]¶ Add a plugin to GLaDOS
- Parameters
plugin (
GladosPlugin
) – the plugin to be added to GLaDOS- Return type
NoReturn
-
import_plugins
(bot_name=None)[source]¶ Import all discovered plugins and add them to the plugin list.
- Parameters
bot_name (
Optional
[str
]) – If set GLaDOS will only import the bot name that is provided here.- Return type
NoReturn
-
read_config
(bot_name=None)[source]¶ Read the GLaDOS config file. If a bot name is provided it will only install that bot. Else it will install all bots.
- Parameters
bot_name (
Optional
[str
]) – If provided, install only the bot with this name.- Return type
NoReturn
-
request
(request)[source]¶ Send a request to GLaDOS. This returns whatever the plugin returns.
This function will also set the datastore session for the request, try to find the interaction in the datastore and fetch it. This info is available in the request.
- Parameters
request (
GladosRequest
) – the request to be sent to GLaDOS