Create A Plugin
Create a new Blitz plugin to install on Blitz bots
When creating plugins, you should avoid using Deno or Node specific features to make your plugin compatible with both the JSR and NPM package.
CLI Command
You will then be asked questions to help Blitz create the config file for you.
Questions
The name of your plugin
A short description of what your plugin does
The name of your plugin
Files
Structure
Your plugin should have a similar structure to this.
Uses
Holds the commands for your plugin.
Holds the events for your plugin.
Holds the manifest data and config for your plugin.
blitz.config.yaml
The blitz.config.yaml
file contains all the metadata for your plugin. You can also add config valuese to this to allow users to customize your plugin.
Example blitz.config.yaml
Manifest Values
The name of your plugin
A short description of what your plugin does
The version of your plugin
Adding Config
You can add config values inside of your plugins blitz.config.yaml
file which will be passed into your plugins commands and events.
This basic example of a blitz.config.yaml file contains a config key called cool_message
.
In any of the plugins commands or events you can access this.
This would log This is a cool message
.
Commands
All commands for a plugin must go inside of the /commands
folder in the root of the plugin.
Commands are built using the discord.js SlashCommandBuilder class.
Example Command
Notice the import from npm:discord.js
? This is a specific deno import which allows us to use discord.js within deno.
Example Command (Config)
For this command to work you would have to add greetMsg
to your blitz.config.yaml
file.
Events
All events for a plugin must go inside of the /events
folder in the root of the plugin.
Example Event
Example Event (Config)
For this event to work you would have to add message
to your blitz.config.yaml
file.
Test Plugin
You can test a plugin locally with one command.
CLI Command
CLI Params
Your bots token to test the plugin on