Plugin Reference

This document contains the base plugin and commands Python references.

plugin module

class shellbot.plugin.SharedView(name, config, state, essential)

Contains data shared with all commands in a same plugin.

Parameters:
  • name (str) – The plugin name.
  • config (py314.config.FileConfig) – Plugin configuration.
  • state (State) – The plugin state.
  • essential (bool) – The essential plugin flag.
class shellbot.plugin.Plugin(config, credentials=None, **kwargs)

Represent a ShellBot Plugin.

Parameters:
name

str – The plugin name given by the configuration file.

brief

str – The plugin brief given by the configuration file.

commands

dict – Arrows key → command, where key is a command name and command is an instance of Command.

aliases

dict – Arrows alias → name, where alias is a command alias and name is a full command name.

shared

SharedView – A shared object for commands.

name

str – The plugin name.

brief

str – A brief plugin explanation.

essential

bool – Essential component (disabling not allowed).

Return the URL (Markdown style) for the commands documentation.

visible

bool – Global default plugin’s visibility.

reload()

Reload the static data from the configuration file.

resolve(string)

Return the command object called string or None.

Parameters:string (str) – The command or alias name.
Returns:The desired command or None.
coroutine debug(*args, **kwargs)

A coroutine for debug purposes.

coroutine dispatch(ctx)

Execute the command in a specific ctx.

Parameters:ctx (Context) – The command context.
coroutine update()

Called by the client on an update event. Only enabled plugins can be updated at runtime.

coroutine update_remote()

Called by the client on an update API event.

Reload only API keys/credentials if the plugin needs these latter. Only enabled plugins can be updated at runtime.

class shellbot.plugin.EssentialPlugin(*args)

Represent an essential Plugin.

class shellbot.plugin.DisabledPlugin(*args)

Represent a disabled Plugin.

class shellbot.plugin.HiddenPlugin(*args)

Represent a hidden Plugin.

class shellbot.plugin.Importer(bot, path)

A context manager to create extensions for a bot and according to a configuration folder.

Parameters:
  • bot (ShellBotClient) – The bot the plugin factory is attached to.
  • path (str) – The configuration folder.
class shellbot.plugin.Library

A mapping of Plugin instances.

has(name)

Check that name is a plugin name.

get(name, default=None)

Return the plugin named name or default if this fails.

resolve(*names, syntax=<Syntax.PLUGIN: 2>)

For name in names, find a Component, i.e. a Command or a Plugin object called name. The output is a single object if names has only one item and is a list otherwise.

Parameters:syntax (Syntax [optional]) – A syntax pattern.
plugin_of(name)

Return the Plugin associated with the command named name.

Parameters:name (str) – A command name.
classmethod load(bot, path)

Create a Library from the plugins given by Importer based on bot and path.

Parameters:
  • bot (ShellBotClient) – The bot the plugin factory is attached to.
  • path (str) – The configuration folder.
load_extension(extension)

Attempt to add the extension to the current library.

Parameters:extension (Plugin) – The plugin to add.
unload_extension(name)

Unload the extension from the current library.

Parameters:name (str) – Plugin name.
enabled

list – A list of globally enabled Plugin.

disabled

list – A list of globally disabled Plugin.

defaults

list – A list of visible Plugin.

essentials

list – A list of essentials Plugin.

names

set – Plugin names.

enabled_names

set – Enabled plugin names.

disabled_names

set – Disabled plugin names.

default_names

set – Default plugin names.

essential_names

set – Essential plugin names.

reload_all()

Call Plugin.reload() on current plugins.

coroutine update_all()

Call Plugin.update() on current plugins.

coroutine update_remote_all()

Call Plugin.update_remote() on current plugins.

Administration