glados.plugin module¶
-
class
glados.plugin.
GladosPlugin
(config: glados.plugin.PluginConfig, bot: glados.bot.GladosBot, **kwargs)[source]¶ Bases:
object
Parent class for a GLaDOS Plugin
- Parameters
name (str) – the name of the plugin
bot (GladosBot) – the GLaDOS bot that this plugin will use
-
add_route
(route_type: glados.route_type.RouteType, route: Union[glados.route_type.EventRoutes, str], function: Callable)[source]¶ Add a new route to the plugin
- Parameters
route_type (RouteType) – what type of route this is this
route (Union[EventRoutes, str]) – what is the route to be added
function (Callable) – the function to be executed when this route runs
-
property
routes
¶ List all routes for the plugin.
-
send_request
(request: glados.request.GladosRequest, **kwargs)[source]¶ This is the function to be called when sending a request to a plugin.
This function is responsible for validating the slack signature if needed. It also returns and empty string if the function called returns None.
- Parameters
request (GladosRequest) – the request object to be sent
kwargs –
-
class
glados.plugin.
PluginConfig
(name, config_file, module=None, enabled=False, bot=None, **kwargs)[source]¶ Bases:
object
-
update
(config: glados.plugin.PluginConfig, use_base_module: bool = True)[source]¶ Update a config object using the default values from the config object passed in.
- Parameters
config (PluginConfig) – the config object to use as the base. By default the module property will be set from the base config object only
use_base_module (bool) – if set true use the value of module and package from the base config object only.
-
-
class
glados.plugin.
PluginImporter
(plugins_folder: str, plugins_config_folder: str)[source]¶ Bases:
object
-
discover_plugins
()[source]¶ Discover all plugin config files in the plugins folder
- Returns
list of all yaml config files
- Return type
list
-