This commit is contained in:
DJj123dj
2022-07-25 20:09:52 +02:00
parent 0ee9a312eb
commit c1ba677b82
17 changed files with 231 additions and 37 deletions
+56
View File
@@ -0,0 +1,56 @@
# OT-API Documentation
Extend open ticket with your own features!
The api is made for EXTENDING open ticket, not replacing! So with this api you are not able to replace existing features! You can only add your own features!
### DISCLAIMER:
Only edit or extend the code when you know what you are doing!
If open ticket crashes while you change the code, then we can't help you!
**DO IT ON YOUR OWN RISK!**
## Events:
Everything in the `events.js` file!
### onTicketOpen(...)
This function is executed when a new ticket is created. It happens after everything else is done, so the channel is already created!
Parameters:
- user: `discord.User`
- channel: `discord.TextChannel`
- guild: `discord.Guild`
- date: `Date`
- ticketdata: `OT TicketData` or `false` (more info further down this document)
### onTicketClose(...)
This function is executed when a ticket gets closed, it can happen multiple times with one ticket (because of reopen).
Parameters:
- user: `discord.User`
- channel: `discord.TextChannel`
- guild: `discord.Guild`
- date: `Date`
- ticketdata: `OT TicketData` or `false` (more info further down this document)
### onTicketDelete(...)
This function is executed when a ticket gets deleted, it can happen only 1 time.
Parameters:
- user: `discord.User`
- channel: `discord.TextChannel`
- guild: `discord.Guild`
- date: `Date`
- ticketdata: `OT TicketData` or `false` (more info further down this document)
### onTicketReopen(...)
...
### onTranscriptCreation(...)
...
### onCommand(...)
...
### onReactionRole(...)
...
+3
View File
@@ -0,0 +1,3 @@
{
"version":"1.0.0"
}
+26
View File
@@ -0,0 +1,26 @@
const discord = require('discord.js')
const bot = require("../../../index")
const client = bot.client
const config = bot.config
const log = bot.errorLog.log
const l = bot.language
const storage = bot.storage
/** FOR DEVELOPERS ONLY!!
* Don't change anything in this file, read the api documentation first!
* look into "api docs.md" for the docs!
*/
//used when creating plugins!
exports.enableApiLogs = false
//this is used when embedding open ticket into another bot
exports.embeddedMode = false
exports.clientLocation = require("../../../index").client
/** !! WARNING !!
* Only edit or extend the code when you know what you are doing!
* If open ticket crashes while you change the code, then we can't help you!
*
* DO IT ON YOUR OWN RISK!
*/
+9
View File
@@ -0,0 +1,9 @@
const discord = require("discord.js")
const client = require("../../../index").client
module.exports = () => {
//this code will run when the bot starts!
}
+55
View File
@@ -0,0 +1,55 @@
const discord = require('discord.js')
const bot = require('../../../index')
const client = bot.client
const config = bot.config
const log = bot.errorLog.log
const l = bot.language
const storage = bot.storage
/**
*
* @param {discord.User} user
* @param {discord.TextChannel} channel
* @param {discord.Guild} guild
* @param {Date} date
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:Object|false}} ticketdata
*/
exports.onTicketOpen = (user,channel,guild,date,ticketdata) => {
//system
bot.errorLog.log("api","new ticket created",[{key:"userid",value:user.id},{key:"channelid",value:channel.id},{key:"guildid",value:guild.id},{key:"ticketdata",value:JSON.stringify(ticketdata)}])
//custom code
}
/**
*
* @param {discord.User} user
* @param {discord.TextChannel} channel
* @param {discord.Guild} guild
* @param {Date} date
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:Object|false}} ticketdata
*/
exports.onTicketClose = (user,channel,guild,date,ticketdata) => {
//system
bot.errorLog.log("api","ticket closed",[{key:"userid",value:user.id},{key:"channelid",value:channel.id},{key:"guildid",value:guild.id},{key:"ticketdata",value:JSON.stringify(ticketdata)}])
//custom code
}
/**
*
* @param {discord.User} user
* @param {discord.TextChannel} channel
* @param {discord.Guild} guild
* @param {Date} date
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:Object|false}} ticketdata
*/
exports.onTicketDelete = (user,channel,guild,date,ticketdata) => {
//system
bot.errorLog.log("api","ticket deleted",[{key:"userid",value:user.id},{key:"channelid",value:channel.id},{key:"guildid",value:guild.id},{key:"ticketdata",value:JSON.stringify(ticketdata)}])
//custom code
}