Skip to main content

🏁 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!

filename tips

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!

example.plugin.js
//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!

example.plugin.js
//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!

ModuleTypeNotes
clientdiscord.ClientThe client of the bot. Used for almost everything!
configobjectThe Open Ticket config. Same variables as config.json
eventsobjectCollection of Open Ticket events. Event listeners can be added!
utilsobject[PARTIALLY BROKEN] Utilities like the log system & the database.
actionsempty 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!

example.plugin.js
//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!