Plugin System
Plugins are a way to expand the functionality of JJMumbleBot.
JJMumbleBot comes built-in with the Bot Commands Plugin,
Images Plugin, Media Plugin and more.
Creating Custom Plugins
Plugins are easy to create with the provided 'plugin_template.py' file.
Every plugin must be named 'Plugin' and derive from the PluginBase class and implement its methods.
Using the
plugin_template.py
file is highly recommended to quickly create functional plugins for JJMumbleBot.
All custom plugins must be placed in the plugins/extensions/ directory.
If you are a developer looking to make a JJMumbleBot plugin, but don't know where to start,
then generate a template plugin like so: python3 JJMumbleBot/utility/plugin_template_generator.py my_example_plugin
.
This plugin will be generated in the JJMumbleBot/user_generated/
directory, and must be placed in the JJMumbleBot/plugins/extensions/
directory to work.
- Create a python file and create a class with the name 'Plugin' that derives from the PluginBase class.
Look at theplugin_template.py
file for more information. - Implement all the methods from the
PluginBase
abstract class. - Use the
__init__ constructor
to initialize the plugin. - Create a method per command in the format:
cmd_mycommand
to process commands from users - Be sure to prefix every command method with
cmd_
before your command name - You're provided with the user's text in every plugin to use.
- If you need to reference the mumble instance, use the instance from the global_access script.
- Use the quit method to stop any processes created by the plugin and clean-up other code before the bot quits
Advanced features:
Plugin callback system: Allows plugin callbacks for mumble server events.
Is it a system that all plugins can use to directly interface with mumble server events such as receiving audio, messages, user connection/disconnection, etc.For example, if you want a plugin to execute some code in response to a user connecting to the server, that is now possible!
Simple Setup
- Create a method:
def my_plugin_method(self): ...
- Import the global_settings script:
from JJMumbleBot.settings import global_settings
- Register the plugin method to the core callbacks of the global_settings script:
global_settings.core_callbacks.append_to_callback(callback_type, my_plugin_method)