🏁 Getting Started
Hey there! If you see this page, you are probably someone who wants to create an Open Ticket plugin! But no worries, in this documentation you will find everything you will need!
Use Cases
It's recommended to read this page before creating plugins if you didn't visit this page before!
Location & Filename
Open Ticket plugins are stored in the ./plugins/
directory! All plugins are required to have a filename with .plugin.js
!
If your plugin doesn't have this, then it won't work!
Please use a simple file name that is easy to remember, read & write. Here are some tips:
- ✅ use lowercase characters & numbers (e.g.
moderation.plugin.js
) - ✅ use a dash (
-
) instead of spaces & underscores (e.g.log-system.plugin.js
) - ❌ don't use long file names (e.g.
this-is-a-very-cool-plugin.plugin.js
)
Plugin Structure
Every plugin needs to have some basic code that is required to run the plugin. We will go trough the following code step-by-step!
//import discord
const discord = require("discord.js")
//import api & get modules
const {client,config,events,utils,actions} = require("../core/api/api.js")
//everything inside this function will be executed at startup
module.exports = () => {
//...
}
Imports & Modules
The first part of the code are the imports. Here, you will import discord.js
& the Open Ticket API
for methods that plugins can use!
//import discord
const discord = require("discord.js")
//import api & get modules
const {client,config,events,utils,actions} = require("../core/api/api.js")
Here you can find everything related to modules from the Open Ticket api!
Module | Type | Notes |
---|---|---|
client | discord.Client | The client of the bot. Used for almost everything! |
config | object | The Open Ticket config. Same variables as config.json |
events | object | Collection of Open Ticket events. Event listeners can be added! |
utils | object | [PARTIALLY BROKEN] Utilities like the log system & the database. |
actions | empty object | [BROKEN] Using actions, plugins could control the bot in a limited way! (e.g. creating & closing tickets) |
All information about events can be found in the API Reference!
The Main Code
The main code is the part of the plugin that will be executed on startup. It's everything in the module.exports
function!
Here, you need to put all the code from your plugin!
//everything inside this function will be executed at startup
module.exports = () => {
//...
}
Examples
You can find many examples in the official plugin list. Here, you can also upload your own plugin if you want to make it a public plugin!