Solved merge conflicts
This commit is contained in:
+271
-145
@@ -1,28 +1,8 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW CONFIG VARIABLES?
|
||||
* - Make the change to the config file in (./config/) and be aware of the following things:
|
||||
* - The variable has a clear name and its function is obvious.
|
||||
* - The variable is in the correct position/category of the config.
|
||||
* - The variable contains a default placeholder to suggest the contents.
|
||||
* - If there's a (./devconfig/), also modify this file.
|
||||
* - Register the config in loadAllConfigs() in (./src/data/framework/configLoader.ts)
|
||||
* - The variable should be added to the "formatters" in the correct position.
|
||||
* - Add autocomplete for the variable in ODJsonConfig_Default... in (./src/core/api/defaults/config.ts)
|
||||
* - Add the variable to the config checker in (./src/data/framework/checkerLoader.ts)
|
||||
* - Make sure the variable is compatible with the Interactive Setup CLI.
|
||||
* - The variable should be added by the migration manager (./src/core/startup/migration.ts) when missing.
|
||||
* - Update the Open Ticket Documentation.
|
||||
*
|
||||
* IF VARIABLE IS FROM questions.json, options.json OR panels.json:
|
||||
* - Check (./src/data/openticket/...) for loading/unloading of data.
|
||||
* - Check (./src/actions/createTicket.ts) and related files.
|
||||
* - Check (./src/builders), (./src/actions), (./src/data) & (./src/commands) in general in the areas that were changed.
|
||||
*/
|
||||
|
||||
export const loadAllConfigCheckers = async () => {
|
||||
export async function loadAllConfigCheckers(){
|
||||
opendiscord.checkers.add(new api.ODChecker("opendiscord:general",opendiscord.checkers.storage,0,opendiscord.configs.get("opendiscord:general"),defaultGeneralStructure,{cliDisplayName:"General Config",cliDisplayDescription:"Configure the bot token, status, colors, permissions & more."}))
|
||||
opendiscord.checkers.add(new api.ODChecker("opendiscord:questions",opendiscord.checkers.storage,2,opendiscord.configs.get("opendiscord:questions"),defaultQuestionsStructure,{cliDisplayName:"Questions Config",cliDisplayDescription:"Create, modify & delete questions which are used in options."}))
|
||||
opendiscord.checkers.add(new api.ODChecker("opendiscord:options",opendiscord.checkers.storage,1,opendiscord.configs.get("opendiscord:options"),defaultOptionsStructure,{cliDisplayName:"Options Config",cliDisplayDescription:"Create, modify & delete options which are used in panels."}))
|
||||
@@ -30,14 +10,14 @@ export const loadAllConfigCheckers = async () => {
|
||||
opendiscord.checkers.add(new api.ODChecker("opendiscord:transcripts",opendiscord.checkers.storage,0,opendiscord.configs.get("opendiscord:transcripts"),defaultTranscriptsStructure,{cliDisplayName:"Transcript Config",cliDisplayDescription:"Configure everything related to transcripts."}))
|
||||
}
|
||||
|
||||
export const loadAllConfigCheckerFunctions = async () => {
|
||||
export async function loadAllConfigCheckerFunctions(){
|
||||
opendiscord.checkers.functions.add(new api.ODCheckerFunction("opendiscord:unused-options",defaultUnusedOptionsFunction))
|
||||
opendiscord.checkers.functions.add(new api.ODCheckerFunction("opendiscord:unused-questions",defaultUnusedQuestionsFunction))
|
||||
opendiscord.checkers.functions.add(new api.ODCheckerFunction("opendiscord:dropdown-options",defaultDropdownOptionsFunction))
|
||||
}
|
||||
|
||||
export const loadAllConfigCheckerTranslations = async () => {
|
||||
if ((generalConfig && generalConfig.data.system && generalConfig.data.system.useTranslatedConfigChecker) ? generalConfig.data.system.useTranslatedConfigChecker : false){
|
||||
export async function loadAllConfigCheckerTranslations(){
|
||||
if ((generalConfig && generalConfig.data.ticketSystem && generalConfig.data.ticketSystem.useTranslatedConfigChecker) ? generalConfig.data.ticketSystem.useTranslatedConfigChecker : false){
|
||||
registerDefaultCheckerSystemTranslations(opendiscord.checkers.translation,opendiscord.languages) //translate checker system text
|
||||
registerDefaultCheckerMessageTranslations(opendiscord.checkers.translation,opendiscord.languages) //translate checker messages
|
||||
registerDefaultCheckerCustomTranslations(opendiscord.checkers.translation,opendiscord.languages) //translate custom checker messages
|
||||
@@ -45,9 +25,9 @@ export const loadAllConfigCheckerTranslations = async () => {
|
||||
}
|
||||
|
||||
//GLOBAL FUNCTIONS
|
||||
export const registerDefaultCheckerSystemTranslations = (tm:api.ODCheckerTranslationRegister_Default,lm:api.ODLanguageManager_Default) => {
|
||||
export function registerDefaultCheckerSystemTranslations(tm:api.ODMappedCheckerTranslationRegister,lm:api.ODMappedLanguageManager){
|
||||
//SYSTEM
|
||||
//tm.quickTranslate(lm,"checker.system.headerOpenTicket","other","opendiscord:header-openticket") //OPEN TICKET (ignore)
|
||||
tm.quickTranslate(lm,"checker.system.headerOpenTicket","other","opendiscord:header-projectname") //OPEN TICKET
|
||||
tm.quickTranslate(lm,"checker.system.typeError","other","opendiscord:type-error") // [ERROR] (ignore)
|
||||
tm.quickTranslate(lm,"checker.system.typeWarning","other","opendiscord:type-warning") // [WARNING] (ignore)
|
||||
tm.quickTranslate(lm,"checker.system.typeInfo","other","opendiscord:type-info") // [INFO] (ignore)
|
||||
@@ -62,7 +42,7 @@ export const registerDefaultCheckerSystemTranslations = (tm:api.ODCheckerTransla
|
||||
tm.quickTranslate(lm,"checker.system.dataMessages","other","opendiscord:data-message") // message
|
||||
}
|
||||
|
||||
export const registerDefaultCheckerMessageTranslations = (tm:api.ODCheckerTranslationRegister_Default,lm:api.ODLanguageManager_Default) => {
|
||||
export function registerDefaultCheckerMessageTranslations(tm:api.ODMappedCheckerTranslationRegister,lm:api.ODMappedLanguageManager){
|
||||
//STRUCTURES
|
||||
tm.quickTranslate(lm,"checker.messages.invalidType","message","opendiscord:invalid-type") // This property needs to be the type: {0}!
|
||||
tm.quickTranslate(lm,"checker.messages.propertyMissing","message","opendiscord:property-missing") // The property {0} is missing from this object!
|
||||
@@ -137,7 +117,7 @@ export const registerDefaultCheckerMessageTranslations = (tm:api.ODCheckerTransl
|
||||
tm.quickTranslate(lm,"checker.messages.idNonExistent","message","opendiscord:id-non-existent") // The id {0} doesn't exist!
|
||||
}
|
||||
|
||||
export const registerDefaultCheckerCustomTranslations = (tm:api.ODCheckerTranslationRegister_Default,lm:api.ODLanguageManager_Default) => {
|
||||
export function registerDefaultCheckerCustomTranslations(tm:api.ODMappedCheckerTranslationRegister,lm:api.ODMappedLanguageManager){
|
||||
//CUSTOM
|
||||
tm.quickTranslate(lm,"checker.messages.invalidLanguage","message","opendiscord:invalid-language") // This is an invalid language!
|
||||
tm.quickTranslate(lm,"checker.messages.invalidButton","message","opendiscord:invalid-button") // This button needs to have at least an {0} or {1}!
|
||||
@@ -148,13 +128,30 @@ export const registerDefaultCheckerCustomTranslations = (tm:api.ODCheckerTransla
|
||||
}
|
||||
|
||||
//UTILITY FUNCTIONS
|
||||
const createMsgStructure = (id:api.ODValidId,displayName:string) => {
|
||||
/**Get the panel ids from `panels.jsonc` before it has been checked by the config checker. */
|
||||
function getUnsafePanelIds(): string[] {
|
||||
const panelsConfig = opendiscord.configs.get("opendiscord:panels")
|
||||
if (!Array.isArray(panelsConfig.data)) return []
|
||||
|
||||
const panelIds: string[] = []
|
||||
for (const unsafePanel of panelsConfig.data){
|
||||
if (unsafePanel["id"]) panelIds.push(unsafePanel["id"])
|
||||
}
|
||||
return panelIds
|
||||
}
|
||||
|
||||
function createMsgStructure(id:api.ODValidId,displayName:string){
|
||||
return new api.ODCheckerObjectStructure(id,{children:[
|
||||
{key:"dm",checker:new api.ODCheckerBooleanStructure("opendiscord:msg-dm",{cliInitDefaultValue:false,cliDisplayName:"DM Enabled",cliDisplayDescription:"Will this action be sent in DM to the creator of the ticket?"})},
|
||||
{key:"logs",checker:new api.ODCheckerBooleanStructure("opendiscord:msg-logs",{cliInitDefaultValue:true,cliDisplayName:"Logs Enabled",cliDisplayDescription:"Will this action be sent in the Discord log channel?"})},
|
||||
],cliDisplayName:displayName,cliDisplayDescription:"Configure which places this action gets logged/sent to."})
|
||||
}
|
||||
const createTicketEmbedStructure = (id:api.ODValidId) => {
|
||||
|
||||
function createPermissionStructure(id:api.ODValidId,displayName:string){
|
||||
return new api.ODCheckerCustomStructure_DiscordId(id,"role",false,["admin","everyone","none"],{cliDisplayName:displayName,cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})
|
||||
}
|
||||
|
||||
function createTicketEmbedStructure(id:api.ODValidId){
|
||||
return new api.ODCheckerEnabledObjectStructure(id,{property:"enabled",enabledValue:true,checker:new api.ODCheckerObjectStructure(id,{children:[
|
||||
{key:"enabled",checker:new api.ODCheckerBooleanStructure("opendiscord:ticket-embed-enabled",{cliDisplayName:"Enabled",cliDisplayDescription:"Enable/disable the embed of this message."})},
|
||||
{key:"title",checker:new api.ODCheckerStringStructure("opendiscord:ticket-embed-text",{maxLength:256,cliDisplayName:"Title",cliDisplayDescription:"The title of this embed."})},
|
||||
@@ -171,14 +168,16 @@ const createTicketEmbedStructure = (id:api.ODValidId) => {
|
||||
{key:"timestamp",checker:new api.ODCheckerBooleanStructure("opendiscord:ticket-embed-timestamp",{cliDisplayName:"Timestamp",cliDisplayDescription:"Add a timestamp to the embed."})}
|
||||
],cliDisplayName:"Message Embed",cliDisplayDescription:"Configure the embed of this message."}),cliInitDefaultValue:{enabled:false,title:"",description:"",customColor:"",image:"",thumbnail:"",fields:[],timestamp:false},cliDisplayName:"Message Embed",cliDisplayDescription:"Configure the embed of this message."})
|
||||
}
|
||||
const createTicketPingStructure = (id:api.ODValidId) => {
|
||||
|
||||
function createTicketPingStructure(id:api.ODValidId){
|
||||
return new api.ODCheckerObjectStructure(id,{children:[
|
||||
{key:"@here",checker:new api.ODCheckerBooleanStructure("opendiscord:ticket-ping-here",{cliDisplayName:"@here Ping",cliDisplayDescription:"Enable/disable an '@here' ping."})},
|
||||
{key:"@everyone",checker:new api.ODCheckerBooleanStructure("opendiscord:ticket-ping-everyone",{cliDisplayName:"@everyone Ping",cliDisplayDescription:"Enable/disable an '@everyone' ping."})},
|
||||
{key:"custom",checker:new api.ODCheckerCustomStructure_DiscordIdArray("opendiscord:ticket-ping-custom","role",[],{allowDoubles:false,cliDisplayPropertyName:"custom role id",cliDisplayName:"Custom Role Ping",cliDisplayDescription:"Choose your own roles to ping in this message."},{cliDisplayName:"Custom Role",cliDisplayDescription:"The discord role ID of a custom mention/ping."})},
|
||||
],cliInitDefaultValue:{"@here":true,"@everyone":false,custom:[],cliDisplayName:"Message Pings",cliDisplayDescription:"Configure the pings/mentions of this message."}})
|
||||
}
|
||||
const createPanelEmbedStructure = (id:api.ODValidId) => {
|
||||
|
||||
function createPanelEmbedStructure(id:api.ODValidId){
|
||||
return new api.ODCheckerEnabledObjectStructure(id,{property:"enabled",enabledValue:true,checker:new api.ODCheckerObjectStructure(id,{children:[
|
||||
{key:"enabled",checker:new api.ODCheckerBooleanStructure("opendiscord:panel-embed-enabled",{cliDisplayName:"Enabled",cliDisplayDescription:"Enable/disable the embed of this panel."})},
|
||||
{key:"title",checker:new api.ODCheckerStringStructure("opendiscord:panel-embed-text",{maxLength:256,cliDisplayName:"Title",cliDisplayDescription:"The title of this embed."})},
|
||||
@@ -208,35 +207,31 @@ function loadFromEnv(){
|
||||
//STRUCTURES
|
||||
export const defaultGeneralStructure = new api.ODCheckerObjectStructure("opendiscord:general",{children:[
|
||||
//INFO
|
||||
{key:"_INFO",cliHideInEditMode:true,checker:new api.ODCheckerObjectStructure("opendiscord:info",{children:[
|
||||
{key:"support",checker:new api.ODCheckerStringStructure("opendiscord:info-support",{choices:["https://otdocs.dj-dj.be"]})},
|
||||
{key:"discord",checker:new api.ODCheckerStringStructure("opendiscord:info-discord",{choices:["https://discord.dj-dj.be"]})},
|
||||
{key:"version",checker:new api.ODCheckerStringStructure("opendiscord:info-version",{custom(checker,value,locationTrace,locationId,locationDocs) {
|
||||
const lt = checker.locationTraceDeref(locationTrace)
|
||||
|
||||
if (typeof value != "string") return false
|
||||
else if (value != "open-ticket-"+opendiscord.versions.get("opendiscord:version").toString()){
|
||||
checker.createMessage("opendiscord:invalid-version","warning","The version specified in your config does not match! Make sure you have updated the config to the latest version!",lt,null,[],locationId,locationDocs)
|
||||
return false
|
||||
}else return true
|
||||
},})},
|
||||
]})},
|
||||
{key:"_CONFIG_VERSION",cliHideInEditMode:true,checker:new api.ODCheckerStringStructure("opendiscord:config-version",{custom(checker,value,locationTrace,locationId,locationDocs) {
|
||||
const lt = checker.locationTraceDeref(locationTrace)
|
||||
|
||||
if (typeof value != "string") return false
|
||||
else if (value != "open-ticket-"+opendiscord.versions.get("opendiscord:version").toString()){
|
||||
checker.createMessage("opendiscord:invalid-version","warning","The version specified in your config does not match! Make sure you have updated the config to the latest version!",lt,null,[],locationId,locationDocs)
|
||||
return false
|
||||
}else return true
|
||||
},})},
|
||||
|
||||
//BASIC
|
||||
{key:"token",checker:(loadFromEnv()) ? new api.ODCheckerStringStructure("opendiscord:token-disabled",{cliDisplayName:"Token",cliDisplayDescription:"The token of your discord bot."}) : new api.ODCheckerCustomStructure_DiscordToken("opendiscord:token",{cliDisplayName:"Token",cliDisplayDescription:"The token of your discord bot."})},
|
||||
{key:"tokenFromENV",checker:new api.ODCheckerBooleanStructure("opendiscord:token-env",{cliDisplayName:"Token From ENV",cliDisplayDescription:"Use the token from the .env file instead of general.json."})},
|
||||
{key:"tokenFromENV",checker:new api.ODCheckerBooleanStructure("opendiscord:token-env",{cliDisplayName:"Token From ENV",cliDisplayDescription:"Use the token from the .env file instead of general.jsonc."})},
|
||||
{key:"mainColor",checker:new api.ODCheckerCustomStructure_HexColor("opendiscord:main-color",true,false,{cliDisplayName:"Main Color",cliDisplayDescription:"The main color of your bot, used in almost all embeds."})},
|
||||
{key:"language",checker:new api.ODCheckerStringStructure("opendiscord:language",{
|
||||
custom:(checker,value,locationTrace,locationId,locationDocs) => {
|
||||
const lt = checker.locationTraceDeref(locationTrace)
|
||||
|
||||
if (typeof value != "string") return false
|
||||
else if (!opendiscord.defaults.getDefault("languageList").includes(value)){
|
||||
else if (!opendiscord.sharedFuses.getFuse("languageList").includes(value)){
|
||||
checker.createMessage("opendiscord:invalid-language","error","This is an invalid language!",lt,null,[],locationId,locationDocs)
|
||||
return false
|
||||
}else return true
|
||||
},
|
||||
cliAutocompleteList:opendiscord.defaults.getDefault("languageList"),
|
||||
cliAutocompleteList:opendiscord.sharedFuses.getFuse("languageList"),
|
||||
cliDisplayName:"Language",
|
||||
cliDisplayDescription:"The language of the bot. Visit README.md for a list of available translations."
|
||||
})},
|
||||
@@ -250,6 +245,7 @@ export const defaultGeneralStructure = new api.ODCheckerObjectStructure("opendis
|
||||
{key:"status",checker:new api.ODCheckerEnabledObjectStructure("opendiscord:status",{
|
||||
property:"enabled",
|
||||
enabledValue:true,
|
||||
ignoreCheckIfDisabled:true,
|
||||
checker:new api.ODCheckerObjectStructure("opendiscord:status",{children:[
|
||||
{key:"enabled",checker:new api.ODCheckerBooleanStructure("opendiscord:status-enabled",{cliDisplayName:"Enabled",cliDisplayDescription:"Enable/disable the status. When disabled, the bot will be online without any status."})},
|
||||
{key:"type",checker:new api.ODCheckerStringStructure("opendiscord:status-type",{choices:["listening","watching","playing","custom"],cliDisplayName:"Type",cliDisplayDescription:"The type of status: Listening, Watching, Playing or Custom."})},
|
||||
@@ -261,8 +257,33 @@ export const defaultGeneralStructure = new api.ODCheckerObjectStructure("opendis
|
||||
cliDisplayDescription:"Manage the status of the bot."
|
||||
})},
|
||||
|
||||
//SYSTEM
|
||||
{key:"system",checker:new api.ODCheckerObjectStructure("opendiscord:system",{children:[
|
||||
//LOGS
|
||||
{key:"logs",checker:new api.ODCheckerEnabledObjectStructure("opendiscord:logs",{property:"enabled",enabledValue:true,ignoreCheckIfDisabled:true,checker:new api.ODCheckerObjectStructure("opendiscord:logs",{children:[
|
||||
{key:"enabled",checker:new api.ODCheckerBooleanStructure("opendiscord:logs-enabled",{cliDisplayName:"Enabled",cliDisplayDescription:"Enable/disable discord logs in a discord channel."})},
|
||||
{key:"channel",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:logs-channel","channel",false,[],{cliDisplayName:"Log Channel",cliDisplayDescription:"The log message channel ID."})},
|
||||
|
||||
//LOG MESSAGES
|
||||
{key:"logMessages",checker:new api.ODCheckerObjectStructure("opendiscord:log-messages",{children:[
|
||||
{key:"creation",checker:createMsgStructure("opendiscord:msg-creation","Ticket Created")},
|
||||
{key:"closing",checker:createMsgStructure("opendiscord:msg-closing","Ticket Closed")},
|
||||
{key:"deleting",checker:createMsgStructure("opendiscord:msg-deleting","Ticket Deleted")},
|
||||
{key:"reopening",checker:createMsgStructure("opendiscord:msg-reopening","Ticket Reopened")},
|
||||
{key:"claiming",checker:createMsgStructure("opendiscord:msg-claiming","Ticket Claimed")},
|
||||
{key:"pinning",checker:createMsgStructure("opendiscord:msg-pinning","Ticket Pinned")},
|
||||
{key:"adding",checker:createMsgStructure("opendiscord:msg-adding","User Added")},
|
||||
{key:"removing",checker:createMsgStructure("opendiscord:msg-removing","User Removed")},
|
||||
{key:"renaming",checker:createMsgStructure("opendiscord:msg-renaming","Ticket Renamed")},
|
||||
{key:"moving",checker:createMsgStructure("opendiscord:msg-moving","Ticket Moved")},
|
||||
{key:"blacklisting",checker:createMsgStructure("opendiscord:msg-blacklisting","User Blacklisted")},
|
||||
{key:"transferring",checker:createMsgStructure("opendiscord:msg-transferring","Ticket Transferred")},
|
||||
{key:"topicChange",checker:createMsgStructure("opendiscord:msg-topic-change","Topic Changed")},
|
||||
{key:"priorityChange",checker:createMsgStructure("opendiscord:msg-priority-change","Priority Changed")},
|
||||
{key:"reactionRole",checker:createMsgStructure("opendiscord:msg-reaction-role","Reaction Role")},
|
||||
],cliDisplayName:"Log Messages",cliDisplayDescription:"Manage all messages & DM's for each action of the bot. (Visit docs for more info)"})},
|
||||
],cliDisplayName:"Discord Logs",cliDisplayDescription:"Manage the 'Open Ticket' logs channel."}),cliDisplayName:"Discord Logs",cliDisplayDescription:"Manage the 'Open Ticket' logs channel."})},
|
||||
|
||||
//TICKET SYSTEM
|
||||
{key:"ticketSystem",checker:new api.ODCheckerObjectStructure("opendiscord:ticket-system",{children:[
|
||||
{key:"preferSlashOverText",checker:new api.ODCheckerBooleanStructure("opendiscord:prefer-slash-over-text",{cliDisplayName:"Prefer Slash Over Text",cliDisplayDescription:"Prefer displaying slash commands over text commands in help menus."})},
|
||||
{key:"sendErrorOnUnknownCommand",checker:new api.ODCheckerBooleanStructure("opendiscord:send-error-on-unknown-command",{cliDisplayName:"Send Error On Unknown Command",cliDisplayDescription:"Send an error when using the text-command prefix without a valid command."})},
|
||||
{key:"questionFieldsInCodeBlock",checker:new api.ODCheckerBooleanStructure("opendiscord:question-fields-in-code-block",{cliDisplayName:"Questions Fields In Code Blocks",cliDisplayDescription:"Display question fields in code blocks instead of plain text."})},
|
||||
@@ -272,7 +293,8 @@ export const defaultGeneralStructure = new api.ODCheckerObjectStructure("opendis
|
||||
{key:"useRedErrorEmbeds",checker:new api.ODCheckerBooleanStructure("opendiscord:use-red-error-embeds",{cliDisplayName:"Use Red Error Embeds",cliDisplayDescription:"Display all error messages with a red border instead of the default color of the bot."})},
|
||||
{key:"alwaysShowReason",checker:new api.ODCheckerBooleanStructure("opendiscord:always-show-reason",{cliDisplayName:"Always Show Reason",cliDisplayDescription:"Always show the reason field in embeds, even when there is no reason provided."})},
|
||||
{key:"emojiStyle",checker:new api.ODCheckerStringStructure("opendiscord:emoji-style",{choices:["before","after","double","disabled"],cliDisplayName:"Emoji Style",cliDisplayDescription:"Choose how the bot will display emojis in message titles. (Visit docs for more info)"})},
|
||||
{key:"pinEmoji",checker:new api.ODCheckerCustomStructure_EmojiString("opendiscord:pin-emoji",1,1,false,{cliDisplayName:"Pin Emoji",cliDisplayDescription:"The emoji used when pinning tickets. This is '📌' by default."})},
|
||||
{key:"pinEmoji",checker:new api.ODCheckerCustomStructure_EmojiString("opendiscord:pin-emoji",0,1,false,{cliDisplayName:"Pin Emoji",cliDisplayDescription:"The emoji used when pinning tickets. This is '📌' by default. Leave empty to disable."})},
|
||||
{key:"closeEmoji",checker:new api.ODCheckerCustomStructure_EmojiString("opendiscord:close-emoji",0,1,false,{cliDisplayName:"Pin Emoji",cliDisplayDescription:"The emoji used when closing tickets. This is '🔒' by default. Leave empty to disable."})},
|
||||
|
||||
{key:"replyOnTicketCreation",checker:new api.ODCheckerBooleanStructure("opendiscord:reply-on-ticket-creation",{cliDisplayName:"Reply On Ticket Creation",cliDisplayDescription:"When enabled, the bot will send an ephemeral reply in the channel of the panel when creating a ticket."})},
|
||||
{key:"replyOnReactionRole",checker:new api.ODCheckerBooleanStructure("opendiscord:reply-on-reaction-role",{cliDisplayName:"Reply On Reaction Role",cliDisplayDescription:"When enabled, the bot will send an ephemeral reply in the channel of the panel when using a role button."})},
|
||||
@@ -292,11 +314,7 @@ export const defaultGeneralStructure = new api.ODCheckerObjectStructure("opendis
|
||||
{key:"enableTicketDeleteButtons",checker:new api.ODCheckerBooleanStructure("opendiscord:enable-ticket-delete-buttons",{cliDisplayName:"Enable Ticket Delete Buttons",cliDisplayDescription:"Enable/disable buttons for deleting a ticket. Be aware that this doesn't disable the command!"})},
|
||||
{key:"enableTicketActionWithReason",checker:new api.ODCheckerBooleanStructure("opendiscord:enable-ticket-action-with-reason",{cliDisplayName:"Enable Ticket Action With Reason",cliDisplayDescription:"Enable/disable buttons to write an additional reason for all ticket actions."})},
|
||||
{key:"enableDeleteWithoutTranscript",checker:new api.ODCheckerBooleanStructure("opendiscord:enable-delete-without-transcript",{cliDisplayName:"Enable Delete Without Transcript",cliDisplayDescription:"Enable/disable the ability to delete tickets without a transcript."})},
|
||||
|
||||
{key:"logs",checker:new api.ODCheckerEnabledObjectStructure("opendiscord:system-logs",{property:"enabled",enabledValue:true,checker:new api.ODCheckerObjectStructure("opendiscord:system-logs",{children:[
|
||||
{key:"enabled",checker:new api.ODCheckerBooleanStructure("opendiscord:logs-enabled",{cliDisplayName:"Enabled",cliDisplayDescription:"Enable/disable discord logs in a discord channel."})},
|
||||
{key:"channel",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:logs-channel","channel",false,[],{cliDisplayName:"Log Channel",cliDisplayDescription:"The ID of the discord channel to log messages to. You can configure the messages somewhere else."})},
|
||||
],cliDisplayName:"Discord Logs",cliDisplayDescription:"Manage everything related to logs in a discord channel."}),cliDisplayName:"Discord Logs",cliDisplayDescription:"Manage everything related to logs in a discord channel."})},
|
||||
{key:"enableCreateTicketForOtherUser",checker:new api.ODCheckerBooleanStructure("opendiscord:enable-create-for-other-user",{cliDisplayName:"Enable Create ticket for other user",cliDisplayDescription:"Enable/disable the ability for admins to create a ticket for another user."})},
|
||||
|
||||
{key:"limits",checker:new api.ODCheckerEnabledObjectStructure("opendiscord:limits",{property:"enabled",enabledValue:true,checker:new api.ODCheckerObjectStructure("opendiscord:limits",{children:[
|
||||
{key:"enabled",checker:new api.ODCheckerBooleanStructure("opendiscord:limits-enabled",{cliDisplayName:"Enabled",cliDisplayDescription:"Enable/disable global limits."})},
|
||||
@@ -307,73 +325,72 @@ export const defaultGeneralStructure = new api.ODCheckerObjectStructure("opendis
|
||||
{key:"channelTopic",checker:new api.ODCheckerObjectStructure("opendiscord:channel-topic",{children:[
|
||||
{key:"showOptionName",checker:new api.ODCheckerBooleanStructure("opendiscord:topic-show-option-name",{cliDisplayName:"Show Option Name",cliDisplayDescription:"Show the option name in the channel topic."})},
|
||||
{key:"showOptionDescription",checker:new api.ODCheckerBooleanStructure("opendiscord:topic-show-option-description",{cliDisplayName:"Show Option Description",cliDisplayDescription:"Show the option description in the channel topic."})},
|
||||
{key:"showOptionTopic",checker:new api.ODCheckerBooleanStructure("opendiscord:topic-show-option-topic",{cliDisplayName:"Show Option Topic",cliDisplayDescription:"Show the option topic text in the channel topic (configured in the options.json config)."})},
|
||||
{key:"showOptionTopic",checker:new api.ODCheckerBooleanStructure("opendiscord:topic-show-option-topic",{cliDisplayName:"Show Option Topic",cliDisplayDescription:"Show the option topic text in the channel topic (configured in the options.jsonc config)."})},
|
||||
{key:"showPriority",checker:new api.ODCheckerBooleanStructure("opendiscord:topic-show-priority",{cliDisplayName:"Show Priority",cliDisplayDescription:"Show the current priority in the channel topic (auto-updated)."})},
|
||||
{key:"showClosed",checker:new api.ODCheckerBooleanStructure("opendiscord:topic-show-closed",{cliDisplayName:"Show Closed Status",cliDisplayDescription:"Show the current close/reopen status in the channel topic (auto-updated)."})},
|
||||
{key:"showClaimed",checker:new api.ODCheckerBooleanStructure("opendiscord:topic-show-claimed",{cliDisplayName:"Show Claimed Status",cliDisplayDescription:"Show the current claim status in the channel topic (auto-updated)."})},
|
||||
{key:"showPinned",checker:new api.ODCheckerBooleanStructure("opendiscord:topic-show-pinned",{cliDisplayName:"Show Pinned Status",cliDisplayDescription:"Show the current pin status in the channel topic (auto-updated)."})},
|
||||
{key:"showCreator",checker:new api.ODCheckerBooleanStructure("opendiscord:topic-show-creator",{cliDisplayName:"Show Creator",cliDisplayDescription:"Show the creator of the ticket in the channel topic (auto-updated on transfer)."})},
|
||||
{key:"showParticipants",checker:new api.ODCheckerBooleanStructure("opendiscord:topic-show-participants",{cliDisplayName:"Show Participants",cliDisplayDescription:"Show the first 5 participants of the ticket in the channel topic (auto-updated)."})},
|
||||
|
||||
],cliDisplayName:"Channel Topic",cliDisplayDescription:"Manage stats and text of ticket channel topics."})},
|
||||
|
||||
{key:"permissions",checker:new api.ODCheckerObjectStructure("opendiscord:system-permissions",{children:[
|
||||
{key:"help",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-help","role",false,["admin","everyone","none"],{cliDisplayName:"Help",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"panel",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-panel","role",false,["admin","everyone","none"],{cliDisplayName:"Panel",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"ticket",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-ticket","role",false,["admin","everyone","none"],{cliDisplayName:"Ticket",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"close",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-close","role",false,["admin","everyone","none"],{cliDisplayName:"Close",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"delete",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-delete","role",false,["admin","everyone","none"],{cliDisplayName:"Delete",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"reopen",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-reopen","role",false,["admin","everyone","none"],{cliDisplayName:"Reopen",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"claim",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-claim","role",false,["admin","everyone","none"],{cliDisplayName:"Claim",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"unclaim",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-unclaim","role",false,["admin","everyone","none"],{cliDisplayName:"Unclaim",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"pin",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-pin","role",false,["admin","everyone","none"],{cliDisplayName:"Pin",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"unpin",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-unpin","role",false,["admin","everyone","none"],{cliDisplayName:"Unpin",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"move",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-move","role",false,["admin","everyone","none"],{cliDisplayName:"Move",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"rename",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-rename","role",false,["admin","everyone","none"],{cliDisplayName:"Rename",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"add",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-add","role",false,["admin","everyone","none"],{cliDisplayName:"Add User",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"remove",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-remove","role",false,["admin","everyone","none"],{cliDisplayName:"Remove User",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"blacklist",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-blacklist","role",false,["admin","everyone","none"],{cliDisplayName:"Blacklist",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"stats",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-stats","role",false,["admin","everyone","none"],{cliDisplayName:"Stats",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"clear",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-clear","role",false,["admin","everyone","none"],{cliDisplayName:"Clear Tickets",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"autoclose",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-autoclose","role",false,["admin","everyone","none"],{cliDisplayName:"Autoclose",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"autodelete",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-autodelete","role",false,["admin","everyone","none"],{cliDisplayName:"Autodelete",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"transfer",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-transfer","role",false,["admin","everyone","none"],{cliDisplayName:"Transfer",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"topic",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-topic","role",false,["admin","everyone","none"],{cliDisplayName:"Topic",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
{key:"priority",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:permissions-priority","role",false,["admin","everyone","none"],{cliDisplayName:"Priority",cliHideDescriptionInParent:true,cliDisplayDescription:"Set the permissions to 'everyone' for everyone, 'admin' for admin only, 'none' to disable or a custom discord role ID."})},
|
||||
],cliDisplayName:"Permissions",cliDisplayDescription:"Manage all button & command permissions in the bot. (Visit docs for more info)"})},
|
||||
{key:"closedCategory",checker:new api.ODCheckerEnabledObjectStructure("opendiscord:closed-category",{property:"enabled",enabledValue:true,ignoreCheckIfDisabled:true,checker:new api.ODCheckerObjectStructure("opendiscord:closed-category",{children:[
|
||||
{key:"enabled",checker:new api.ODCheckerBooleanStructure("opendiscord:closed-category-enabled",{cliDisplayName:"Enabled",cliDisplayDescription:"Enable/disable closed category."})},
|
||||
{key:"categoryId",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:closed-category","category",true,[],{cliDisplayName:"Closed Category",cliDisplayDescription:"An additional category where tickets will be moved to when closed."})},
|
||||
],cliDisplayName:"Closed Category",cliDisplayDescription:"An additional category where tickets will be moved to when closed."}),cliDisplayName:"Closed Category",cliDisplayDescription:"An additional category where tickets will be moved to when closed."})},
|
||||
|
||||
{key:"backupCategory",checker:new api.ODCheckerEnabledObjectStructure("opendiscord:backup-category",{property:"enabled",enabledValue:true,ignoreCheckIfDisabled:true,checker:new api.ODCheckerObjectStructure("opendiscord:backup-category",{children:[
|
||||
{key:"enabled",checker:new api.ODCheckerBooleanStructure("opendiscord:backup-category-enabled",{cliDisplayName:"Enabled",cliDisplayDescription:"Enable/disable backup category."})},
|
||||
{key:"categoryId",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:backup-category","category",true,[],{cliDisplayName:"Backup Category",cliDisplayDescription:"An additional category where tickets will be created in when the original category is full (50 channels)."})},
|
||||
],cliDisplayName:"Backup Category",cliDisplayDescription:"An additional category where tickets will be created in when the original category is full (50 channels)."}),cliDisplayName:"Backup Category",cliDisplayDescription:"An additional category where tickets will be created in when the original category is full (50 channels)."})},
|
||||
|
||||
{key:"claimedCategories",checker:new api.ODCheckerArrayStructure("opendiscord:claimed-categories",{allowDoubles:false,allowedTypes:["object"],cliDisplayPropertyName:"claim category",propertyChecker:new api.ODCheckerObjectStructure("opendiscord:claimed-category",{children:[
|
||||
{key:"user",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:claimed-user","user",false,[],{cliDisplayName:"User",cliDisplayDescription:"The discord user ID of a ticket claimer."})},
|
||||
{key:"category",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:claimed-category","category",false,[],{cliDisplayName:"Category",cliDisplayDescription:"The discord category ID to move the ticket to."})}
|
||||
],cliDisplayName:"Claimed Category",cliDisplayDescription:"Move claimed tickets to the matching channel category of the user that claimed the ticket.",cliDisplayKeyInParentArray:"user",cliDisplayAdditionalKeysInParentArray:["user","category"]}),cliDisplayName:"Claimed Categories",cliDisplayDescription:"Move claimed tickets to the matching channel category of the user that claimed the ticket."})},
|
||||
|
||||
],cliDisplayName:"Ticket System",cliDisplayDescription:"Configure the 'Open Ticket' ticket system."})},
|
||||
|
||||
{key:"messages",checker:new api.ODCheckerObjectStructure("opendiscord:system-permissions",{children:[
|
||||
{key:"creation",checker:createMsgStructure("opendiscord:msg-creation","Ticket Created")},
|
||||
{key:"closing",checker:createMsgStructure("opendiscord:msg-closing","Ticket Closed")},
|
||||
{key:"deleting",checker:createMsgStructure("opendiscord:msg-deleting","Ticket Deleted")},
|
||||
{key:"reopening",checker:createMsgStructure("opendiscord:msg-reopening","Ticket Reopened")},
|
||||
{key:"claiming",checker:createMsgStructure("opendiscord:msg-claiming","Ticket Claimed")},
|
||||
{key:"pinning",checker:createMsgStructure("opendiscord:msg-pinning","Ticket Pinned")},
|
||||
{key:"adding",checker:createMsgStructure("opendiscord:msg-adding","User Added")},
|
||||
{key:"removing",checker:createMsgStructure("opendiscord:msg-removing","User Removed")},
|
||||
{key:"renaming",checker:createMsgStructure("opendiscord:msg-renaming","Ticket Renamed")},
|
||||
{key:"moving",checker:createMsgStructure("opendiscord:msg-moving","Ticket Moved")},
|
||||
{key:"blacklisting",checker:createMsgStructure("opendiscord:msg-blacklisting","User Blacklisted")},
|
||||
{key:"transferring",checker:createMsgStructure("opendiscord:msg-transferring","Ticket Transferred")},
|
||||
{key:"topicChange",checker:createMsgStructure("opendiscord:msg-topic-change","Topic Changed")},
|
||||
{key:"priorityChange",checker:createMsgStructure("opendiscord:msg-priority-change","Priority Changed")},
|
||||
{key:"reactionRole",checker:createMsgStructure("opendiscord:msg-reaction-role","Reaction Role")},
|
||||
],cliDisplayName:"Messages",cliDisplayDescription:"Manage all messages & DM's for each action of the bot. (Visit docs for more info)"})},
|
||||
],cliDisplayName:"System",cliDisplayDescription:"Configure everything related to the ticket system."})}
|
||||
//COMMAND PERMISSIONS
|
||||
{key:"permissions",checker:new api.ODCheckerObjectStructure("opendiscord:permissions",{children:[
|
||||
{key:"help",checker:createPermissionStructure("opendiscord:permissions-help","Help")},
|
||||
{key:"panel",checker:createPermissionStructure("opendiscord:permissions-panel","Panel")},
|
||||
{key:"ticket",checker:createPermissionStructure("opendiscord:permissions-ticket","Ticket")},
|
||||
{key:"close",checker:createPermissionStructure("opendiscord:permissions-close","Close")},
|
||||
{key:"delete",checker:createPermissionStructure("opendiscord:permissions-delete","Delete")},
|
||||
{key:"reopen",checker:createPermissionStructure("opendiscord:permissions-reopen","Reopen")},
|
||||
{key:"claim",checker:createPermissionStructure("opendiscord:permissions-claim","Claim")},
|
||||
{key:"unclaim",checker:createPermissionStructure("opendiscord:permissions-unclaim","Unclaim")},
|
||||
{key:"pin",checker:createPermissionStructure("opendiscord:permissions-pin","Pin")},
|
||||
{key:"unpin",checker:createPermissionStructure("opendiscord:permissions-unpin","Unpin")},
|
||||
{key:"move",checker:createPermissionStructure("opendiscord:permissions-move","Move")},
|
||||
{key:"rename",checker:createPermissionStructure("opendiscord:permissions-rename","Rename")},
|
||||
{key:"add",checker:createPermissionStructure("opendiscord:permissions-add","Add User")},
|
||||
{key:"remove",checker:createPermissionStructure("opendiscord:permissions-remove","Remove User")},
|
||||
{key:"blacklist",checker:createPermissionStructure("opendiscord:permissions-blacklist","Blacklist")},
|
||||
{key:"stats",checker:createPermissionStructure("opendiscord:permissions-stats","Stats")},
|
||||
{key:"clear",checker:createPermissionStructure("opendiscord:permissions-clear","Clear Tickets")},
|
||||
{key:"autoclose",checker:createPermissionStructure("opendiscord:permissions-autoclose","Autoclose")},
|
||||
{key:"autodelete",checker:createPermissionStructure("opendiscord:permissions-autodelete","Autodelete")},
|
||||
{key:"transfer",checker:createPermissionStructure("opendiscord:permissions-transfer","Transfer")},
|
||||
{key:"topic",checker:createPermissionStructure("opendiscord:permissions-topic","Topic")},
|
||||
{key:"priority",checker:createPermissionStructure("opendiscord:permissions-priority","Priority")},
|
||||
{key:"transcripts",checker:createPermissionStructure("opendiscord:permissions-transcripts","Transcripts History")},
|
||||
],cliDisplayName:"Permissions",cliDisplayDescription:"Manage all button & command permissions in the bot. (Visit docs for more info)"})},
|
||||
],cliDisplayName:"General",cliDisplayDescription:"General settings for the bot."})
|
||||
|
||||
export const defaultOptionsStructure = new api.ODCheckerArrayStructure("opendiscord:options",{allowedTypes:["object"],cliDisplayPropertyName:"option",propertyChecker:new api.ODCheckerObjectSwitchStructure("opendiscord:options",{objects:[
|
||||
//TICKET
|
||||
{name:"Ticket",priority:0,properties:[{key:"type",value:"ticket"}],checker:new api.ODCheckerObjectStructure("opendiscord:ticket",{cliDisplayKeyInParentArray:"name",cliDisplayAdditionalKeysInParentArray:["id","type"],cliInitSkipKeys:["readonlyAdmins"],children:[
|
||||
{key:"id",checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:ticket-id","openticket","option-ids",{regex:/^[A-Za-z0-9-éèçàêâôûî]+$/,minLength:3,maxLength:40,cliDisplayName:"Id",cliDisplayDescription:"The id of this ticket option. Used in panels."})},
|
||||
{key:"name",checker:new api.ODCheckerStringStructure("opendiscord:ticket-name",{minLength:2,maxLength:45,cliDisplayName:"Name",cliDisplayDescription:"The name of this ticket option."})},
|
||||
{key:"description",checker:new api.ODCheckerStringStructure("opendiscord:ticket-description",{maxLength:256,cliDisplayName:"Description",cliDisplayDescription:"The description of this ticket option."})},
|
||||
{key:"id",checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:id","openticket","option-ids",{regex:/^[A-Za-z0-9-éèçàêâôûî]+$/,minLength:3,maxLength:40,cliDisplayName:"Id",cliDisplayDescription:"The id of this ticket option. Used in panels."})},
|
||||
{key:"name",checker:new api.ODCheckerStringStructure("opendiscord:name",{minLength:2,maxLength:45,cliDisplayName:"Name",cliDisplayDescription:"The name of this ticket option."})},
|
||||
{key:"description",checker:new api.ODCheckerStringStructure("opendiscord:description",{maxLength:256,cliDisplayName:"Description",cliDisplayDescription:"The description of this ticket option."})},
|
||||
|
||||
//TICKET BUTTON
|
||||
{key:"button",checker:new api.ODCheckerObjectStructure("opendiscord:ticket-button",{children:[
|
||||
{key:"emoji",checker:new api.ODCheckerCustomStructure_EmojiString("opendiscord:ticket-button-emoji",0,1,true,{cliDisplayName:"Emoji",cliDisplayDescription:"The emoji of the button. At least 1 of 2 (emoji/label) must be provided."})},
|
||||
{key:"label",checker:new api.ODCheckerStringStructure("opendiscord:ticket-button-label",{maxLength:80,cliDisplayName:"Label",cliDisplayDescription:"The label of the button. At least 1 of 2 (emoji/label) must be provided."})},
|
||||
{key:"color",checker:new api.ODCheckerStringStructure("opendiscord:ticket-button-color",{choices:["gray","red","green","blue"],cliDisplayName:"Color",cliDisplayDescription:"The color of the button. Does not apply when using a dropdown panel."})},
|
||||
{key:"button",checker:new api.ODCheckerObjectStructure("opendiscord:button",{children:[
|
||||
{key:"emoji",checker:new api.ODCheckerCustomStructure_EmojiString("opendiscord:button-emoji",0,1,true,{cliDisplayName:"Emoji",cliDisplayDescription:"The emoji of the button. At least 1 of 2 (emoji/label) must be provided."})},
|
||||
{key:"label",checker:new api.ODCheckerStringStructure("opendiscord:button-label",{maxLength:80,cliDisplayName:"Label",cliDisplayDescription:"The label of the button. At least 1 of 2 (emoji/label) must be provided."})},
|
||||
{key:"color",checker:new api.ODCheckerStringStructure("opendiscord:button-color",{choices:["gray","red","green","blue"],cliDisplayName:"Color",cliDisplayDescription:"The color of the button. Does not apply when using a dropdown panel."})},
|
||||
],custom:(checker,value,locationTrace,locationId,locationDocs) => {
|
||||
const lt = checker.locationTraceDeref(locationTrace)
|
||||
//check if emoji & label exists
|
||||
@@ -389,7 +406,7 @@ export const defaultOptionsStructure = new api.ODCheckerArrayStructure("opendisc
|
||||
{key:"ticketAdmins",checker:new api.ODCheckerCustomStructure_DiscordIdArray("opendiscord:ticket-ticket-admins","role",[],{allowDoubles:false,cliDisplayPropertyName:"ticket admin role",cliDisplayName:"Ticket Admin Roles",cliDisplayDescription:"A list of role IDs that are only able to interact with this ticket option."},{cliDisplayName:"Ticket Admin Role",cliDisplayDescription:"The discord role ID of a ticket admin."})},
|
||||
{key:"readonlyAdmins",checker:new api.ODCheckerCustomStructure_DiscordIdArray("opendiscord:ticket-readonly-admins","role",[],{allowDoubles:false,cliInitDefaultValue:[],cliDisplayPropertyName:"read-only ticket admin role",cliDisplayName:"Readonly Admin Roles",cliDisplayDescription:"A list of role IDs that are only able to read this ticket option."},{cliDisplayName:"Readonly Admin Role",cliDisplayDescription:"The discord role ID of a readonly admin."})},
|
||||
{key:"allowCreationByBlacklistedUsers",checker:new api.ODCheckerBooleanStructure("opendiscord:ticket-allow-blacklisted-users",{cliDisplayName:"Allow Creation By Blacklisted Users",cliDisplayDescription:"When enabled, the blacklist doesn't apply to this ticket option/type and users are still able to create a ticket."})},
|
||||
{key:"questions",checker:new api.ODCheckerCustomStructure_UniqueIdArray("opendiscord:option-questions","openticket","question-ids","question-ids-used",{allowDoubles:false,maxLength:5,cliDisplayPropertyName:"question",cliDisplayName:"Questions",cliDisplayDescription:"A list of valid question IDs to ask before creating this ticket."},{cliDisplayName:"Question ID",cliDisplayDescription:"A valid question ID from the questions.json config.",cliAutocompleteFunc:async () => {
|
||||
{key:"questions",checker:new api.ODCheckerCustomStructure_UniqueIdArray("opendiscord:option-questions","openticket","question-ids","question-ids-used",{allowDoubles:false,maxLength:5,cliDisplayPropertyName:"question",cliDisplayName:"Questions",cliDisplayDescription:"A list of valid question IDs to ask before creating this ticket."},{cliDisplayName:"Question ID",cliDisplayDescription:"A valid question ID from the questions.jsonc config.",cliAutocompleteFunc:async () => {
|
||||
const uncheckedRawData = opendiscord.configs.get("opendiscord:questions").data
|
||||
if (!Array.isArray(uncheckedRawData)) return null
|
||||
const idList = uncheckedRawData.filter((option) => typeof option == "object" && typeof option["id"] == "string").map((option) => option.id)
|
||||
@@ -400,15 +417,8 @@ export const defaultOptionsStructure = new api.ODCheckerArrayStructure("opendisc
|
||||
{key:"channel",checker:new api.ODCheckerObjectStructure("opendiscord:ticket-channel",{cliInitSkipKeys:["backupCategory","claimedCategory"],children:[
|
||||
{key:"prefix",checker:new api.ODCheckerStringStructure("opendiscord:ticket-channel-prefix",{maxLength:25,regex:/^[^\s]*$/,cliDisplayName:"Prefix",cliDisplayDescription:"The prefix of the name of the ticket channel. (e.g. 'question-')"})},
|
||||
{key:"suffix",checker:new api.ODCheckerStringStructure("opendiscord:ticket-channel-suffix",{choices:["user-name","user-nickname","user-id","random-number","random-hex","counter-dynamic","counter-fixed"],cliDisplayName:"Suffix",cliDisplayDescription:"The suffix mode to use. The number/text will be appended after the prefix."})},
|
||||
|
||||
{key:"category",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:ticket-channel-category","category",true,[],{cliDisplayName:"Category",cliDisplayDescription:"The category the ticket will be created in. Leave empty for no category."})},
|
||||
{key:"closedCategory",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:ticket-channel-closed-category","category",true,[],{cliDisplayName:"Closed Category",cliDisplayDescription:"An additional category where the ticket will be moved to when closed."})},
|
||||
{key:"backupCategory",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:ticket-channel-backup-category","category",true,[],{cliDisplayName:"Backup Category",cliDisplayDescription:"An additional category where the ticket will be created in when the primary category is full (50 channels)."})},
|
||||
{key:"claimedCategory",checker:new api.ODCheckerArrayStructure("opendiscord:ticket-channel-claimed-category",{allowDoubles:false,allowedTypes:["object"],cliDisplayPropertyName:"claim category",propertyChecker:new api.ODCheckerObjectStructure("opendiscord:ticket-channel-claimed-category",{children:[
|
||||
{key:"user",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:ticket-channel-claimed-user","user",false,[],{cliDisplayName:"User",cliDisplayDescription:"A discord user ID of the ticket claimer."})},
|
||||
{key:"category",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:ticket-channel-claimed-category","category",false,[],{cliDisplayName:"Category",cliDisplayDescription:"A discord category ID to move the ticket to."})}
|
||||
],cliDisplayName:"Claimed Category",cliDisplayDescription:"A collection of a user ID and a category ID. The ticket will be moved to the category when this user claims the ticket."}),cliDisplayName:"Claimed Categories",cliDisplayDescription:"Add categories to move the ticket to when a user claims a ticket."})},
|
||||
{key:"topic",checker:new api.ODCheckerStringStructure("opendiscord:ticket-channel-topic",{cliDisplayName:"Channel Topic",cliDisplayDescription:"The topic text of the ticket channel. Visible in the discord client when general.json 'channelTopic'.'showOptionTopic' is enabled."})},
|
||||
{key:"topic",checker:new api.ODCheckerStringStructure("opendiscord:ticket-channel-topic",{cliDisplayName:"Channel Topic",cliDisplayDescription:"The topic text of the ticket channel. Visible in the discord client when general.jsonc 'channelTopic'.'showOptionTopic' is enabled."})},
|
||||
],cliDisplayName:"Channel",cliDisplayDescription:"Manage all settings related to the ticket channel and categories."})},
|
||||
|
||||
//DM MESSAGE
|
||||
@@ -465,14 +475,14 @@ export const defaultOptionsStructure = new api.ODCheckerArrayStructure("opendisc
|
||||
|
||||
//WEBSITE
|
||||
{name:"Website",priority:0,properties:[{key:"type",value:"website"}],checker:new api.ODCheckerObjectStructure("opendiscord:website",{cliDisplayKeyInParentArray:"name",cliDisplayAdditionalKeysInParentArray:["id","type"],children:[
|
||||
{key:"id",checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:website-id","openticket","option-ids",{regex:/^[A-Za-z0-9-éèçàêâôûî]+$/,minLength:3,maxLength:40,cliDisplayName:"Id",cliDisplayDescription:"The id of this website option. Used in panels."})},
|
||||
{key:"name",checker:new api.ODCheckerStringStructure("opendiscord:website-name",{minLength:2,maxLength:45,cliDisplayName:"Name",cliDisplayDescription:"The name of this website option."})},
|
||||
{key:"description",checker:new api.ODCheckerStringStructure("opendiscord:website-description",{maxLength:256,cliDisplayName:"Description",cliDisplayDescription:"The description of this website option."})},
|
||||
{key:"id",checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:id","openticket","option-ids",{regex:/^[A-Za-z0-9-éèçàêâôûî]+$/,minLength:3,maxLength:40,cliDisplayName:"Id",cliDisplayDescription:"The id of this website option. Used in panels."})},
|
||||
{key:"name",checker:new api.ODCheckerStringStructure("opendiscord:name",{minLength:2,maxLength:45,cliDisplayName:"Name",cliDisplayDescription:"The name of this website option."})},
|
||||
{key:"description",checker:new api.ODCheckerStringStructure("opendiscord:description",{maxLength:256,cliDisplayName:"Description",cliDisplayDescription:"The description of this website option."})},
|
||||
|
||||
//WEBSITE BUTTON
|
||||
{key:"button",checker:new api.ODCheckerObjectStructure("opendiscord:ticket-button",{children:[
|
||||
{key:"emoji",checker:new api.ODCheckerCustomStructure_EmojiString("opendiscord:ticket-button-emoji",0,1,true,{cliDisplayName:"Emoji",cliDisplayDescription:"The emoji of the button. At least 1 of 2 (emoji/label) must be provided."})},
|
||||
{key:"label",checker:new api.ODCheckerStringStructure("opendiscord:ticket-button-label",{maxLength:80,cliDisplayName:"Label",cliDisplayDescription:"The label of the button. At least 1 of 2 (emoji/label) must be provided."})},
|
||||
{key:"button",checker:new api.ODCheckerObjectStructure("opendiscord:button",{children:[
|
||||
{key:"emoji",checker:new api.ODCheckerCustomStructure_EmojiString("opendiscord:button-emoji",0,1,true,{cliDisplayName:"Emoji",cliDisplayDescription:"The emoji of the button. At least 1 of 2 (emoji/label) must be provided."})},
|
||||
{key:"label",checker:new api.ODCheckerStringStructure("opendiscord:button-label",{maxLength:80,cliDisplayName:"Label",cliDisplayDescription:"The label of the button. At least 1 of 2 (emoji/label) must be provided."})},
|
||||
],custom:(checker,value,locationTrace,locationId,locationDocs) => {
|
||||
const lt = checker.locationTraceDeref(locationTrace)
|
||||
//check if emoji & label exists
|
||||
@@ -490,15 +500,15 @@ export const defaultOptionsStructure = new api.ODCheckerArrayStructure("opendisc
|
||||
|
||||
//REACTION ROLES
|
||||
{name:"Reaction Role",priority:0,properties:[{key:"type",value:"role"}],checker:new api.ODCheckerObjectStructure("opendiscord:role",{cliDisplayKeyInParentArray:"name",cliDisplayAdditionalKeysInParentArray:["id","type"],children:[
|
||||
{key:"id",checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:role-id","openticket","option-ids",{regex:/^[A-Za-z0-9-éèçàêâôûî]+$/,minLength:3,maxLength:40,cliDisplayName:"Id",cliDisplayDescription:"The id of this role option. Used in panels."})},
|
||||
{key:"name",checker:new api.ODCheckerStringStructure("opendiscord:role-name",{minLength:2,maxLength:45,cliDisplayName:"Name",cliDisplayDescription:"The name of this role option."})},
|
||||
{key:"description",checker:new api.ODCheckerStringStructure("opendiscord:role-description",{maxLength:256,cliDisplayName:"Description",cliDisplayDescription:"The description of this role option."})},
|
||||
{key:"id",checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:id","openticket","option-ids",{regex:/^[A-Za-z0-9-éèçàêâôûî]+$/,minLength:3,maxLength:40,cliDisplayName:"Id",cliDisplayDescription:"The id of this role option. Used in panels."})},
|
||||
{key:"name",checker:new api.ODCheckerStringStructure("opendiscord:name",{minLength:2,maxLength:45,cliDisplayName:"Name",cliDisplayDescription:"The name of this role option."})},
|
||||
{key:"description",checker:new api.ODCheckerStringStructure("opendiscord:description",{maxLength:256,cliDisplayName:"Description",cliDisplayDescription:"The description of this role option."})},
|
||||
|
||||
//ROLE BUTTON
|
||||
{key:"button",checker:new api.ODCheckerObjectStructure("opendiscord:ticket-button",{children:[
|
||||
{key:"emoji",checker:new api.ODCheckerCustomStructure_EmojiString("opendiscord:ticket-button-emoji",0,1,true,{cliDisplayName:"Emoji",cliDisplayDescription:"The emoji of the button. At least 1 of 2 (emoji/label) must be provided."})},
|
||||
{key:"label",checker:new api.ODCheckerStringStructure("opendiscord:ticket-button-label",{maxLength:80,cliDisplayName:"Label",cliDisplayDescription:"The label of the button. At least 1 of 2 (emoji/label) must be provided."})},
|
||||
{key:"color",checker:new api.ODCheckerStringStructure("opendiscord:ticket-button-color",{choices:["gray","red","green","blue"],cliDisplayName:"Color",cliDisplayDescription:"The color of the button. Does not apply when using a dropdown panel."})},
|
||||
{key:"button",checker:new api.ODCheckerObjectStructure("opendiscord:button",{children:[
|
||||
{key:"emoji",checker:new api.ODCheckerCustomStructure_EmojiString("opendiscord:button-emoji",0,1,true,{cliDisplayName:"Emoji",cliDisplayDescription:"The emoji of the button. At least 1 of 2 (emoji/label) must be provided."})},
|
||||
{key:"label",checker:new api.ODCheckerStringStructure("opendiscord:button-label",{maxLength:80,cliDisplayName:"Label",cliDisplayDescription:"The label of the button. At least 1 of 2 (emoji/label) must be provided."})},
|
||||
{key:"color",checker:new api.ODCheckerStringStructure("opendiscord:button-color",{choices:["gray","red","green","blue"],cliDisplayName:"Color",cliDisplayDescription:"The color of the button. Does not apply when using a dropdown panel."})},
|
||||
],custom:(checker,value,locationTrace,locationId,locationDocs) => {
|
||||
const lt = checker.locationTraceDeref(locationTrace)
|
||||
//check if emoji & label exists
|
||||
@@ -516,13 +526,52 @@ export const defaultOptionsStructure = new api.ODCheckerArrayStructure("opendisc
|
||||
{key:"removeRolesOnAdd",checker:new api.ODCheckerCustomStructure_DiscordIdArray("opendiscord:role-remove-roles","role",[],{allowDoubles:false,cliDisplayPropertyName:"role",cliDisplayName:"Remove Roles On Add",cliDisplayDescription:"An additional list of roles to remove when the roles of this option are added. (Can be used to select between roles)"},{cliDisplayName:"Remove Role",cliDisplayDescription:"The discord role ID you want to remove when other roles are added."})},
|
||||
{key:"addOnMemberJoin",checker:new api.ODCheckerBooleanStructure("opendiscord:role-add-on-join",{cliDisplayName:"Add On Member Join",cliDisplayDescription:"Automatically add these roles to a user when joining the server."})},
|
||||
],cliDisplayName:"Reaction Role Option",cliDisplayDescription:"Manage all settings of this reaction role option."})},
|
||||
|
||||
//SUB-PANEL
|
||||
{name:"Reaction Role",priority:0,properties:[{key:"type",value:"sub-panel"}],checker:new api.ODCheckerObjectStructure("opendiscord:sub-panel",{cliDisplayKeyInParentArray:"name",cliDisplayAdditionalKeysInParentArray:["id","type"],children:[
|
||||
{key:"id",checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:id","openticket","option-ids",{regex:/^[A-Za-z0-9-éèçàêâôûî]+$/,minLength:3,maxLength:40,cliDisplayName:"Id",cliDisplayDescription:"The id of this sub-panel option. Used in panels."})},
|
||||
{key:"name",checker:new api.ODCheckerStringStructure("opendiscord:name",{minLength:2,maxLength:45,cliDisplayName:"Name",cliDisplayDescription:"The name of this sub-panel option."})},
|
||||
{key:"description",checker:new api.ODCheckerStringStructure("opendiscord:description",{maxLength:256,cliDisplayName:"Description",cliDisplayDescription:"The description of this sub-panel option."})},
|
||||
|
||||
//SUB-PANEL BUTTON
|
||||
{key:"button",checker:new api.ODCheckerObjectStructure("opendiscord:button",{children:[
|
||||
{key:"emoji",checker:new api.ODCheckerCustomStructure_EmojiString("opendiscord:button-emoji",0,1,true,{cliDisplayName:"Emoji",cliDisplayDescription:"The emoji of the button. At least 1 of 2 (emoji/label) must be provided."})},
|
||||
{key:"label",checker:new api.ODCheckerStringStructure("opendiscord:button-label",{maxLength:80,cliDisplayName:"Label",cliDisplayDescription:"The label of the button. At least 1 of 2 (emoji/label) must be provided."})},
|
||||
{key:"color",checker:new api.ODCheckerStringStructure("opendiscord:button-color",{choices:["gray","red","green","blue"],cliDisplayName:"Color",cliDisplayDescription:"The color of the button. Does not apply when using a dropdown panel."})},
|
||||
],custom:(checker,value,locationTrace,locationId,locationDocs) => {
|
||||
const lt = checker.locationTraceDeref(locationTrace)
|
||||
//check if emoji & label exists
|
||||
if (typeof value != "object") return false
|
||||
else if (value && value["emoji"].length < 1 && value["label"].length < 1){
|
||||
//label & emoji are both empty
|
||||
checker.createMessage("opendiscord:invalid-button","error",`This button needs to have at least an "emoji" or "label"!`,lt,null,[`"emoji"`,`"label"`],locationId,locationDocs)
|
||||
return false
|
||||
}else return true
|
||||
},cliDisplayName:"Button",cliDisplayDescription:"Customise the button layout of this sub-panel option."})},
|
||||
|
||||
//SUB-PANEL SETTINGS
|
||||
{key:"subPanelId",checker:new api.ODCheckerStringStructure("ot-footers:panel-id",{custom:(checker,value,locationTrace,locationId,locationDocs) => {
|
||||
const lt = checker.locationTraceDeref(locationTrace)
|
||||
if (typeof value != "string") return false
|
||||
|
||||
if (getUnsafePanelIds().includes(value)){
|
||||
//exists
|
||||
return true
|
||||
}else{
|
||||
//doesn't exist
|
||||
checker.createMessage("opendiscord:id-non-existent","error",`The panel id "${value}" doesn't exist!`,lt,null,[`"${value}"`],locationId,locationDocs)
|
||||
return false
|
||||
}
|
||||
}})},
|
||||
],cliDisplayName:"Sub-Panel Option",cliDisplayDescription:"Manage all settings of this sub-panel option."})},
|
||||
|
||||
],cliDisplayName:"Option",cliDisplayDescription:"Manage an option of one of the 3 types: ticket, website, role."}),cliDisplayName:"Options",cliDisplayDescription:"A list of all options in the bot. Here you can add, modify & remove ticket types, website buttons & reaction roles!"})
|
||||
|
||||
export const defaultPanelsStructure = new api.ODCheckerArrayStructure("opendiscord:panels",{allowedTypes:["object"],cliDisplayPropertyName:"panel",propertyChecker:new api.ODCheckerObjectStructure("opendiscord:panels",{cliDisplayKeyInParentArray:"name",cliDisplayAdditionalKeysInParentArray:["id","dropdown"],children:[
|
||||
{key:"id",checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:panel-id","openticket","panel-ids",{regex:/^[A-Za-z0-9-éèçàêâôûî]+$/,minLength:3,maxLength:40,cliDisplayName:"Id",cliDisplayDescription:"The id of this panel. Used in the /panel command."})},
|
||||
{key:"name",checker:new api.ODCheckerStringStructure("opendiscord:panel-name",{minLength:3,maxLength:50,cliDisplayName:"Name",cliDisplayDescription:"The name of this panel."})},
|
||||
{key:"dropdown",checker:new api.ODCheckerBooleanStructure("opendiscord:panel-dropdown",{cliDisplayName:"Dropdown",cliDisplayDescription:"Decide whether to use buttons or a dropdown in the panel. Dropdowns only support options of the 'ticket' type!"})},
|
||||
{key:"options",checker:new api.ODCheckerCustomStructure_UniqueIdArray("opendiscord:panel-options","openticket","option-ids","option-ids-used",{allowDoubles:false,minLength:1,maxLength:25,cliDisplayPropertyName:"option",cliDisplayName:"Options",cliDisplayDescription:"A list of valid option IDs to show in this panel."},{cliDisplayName:"Option ID",cliDisplayDescription:"A valid option ID from the options.json config.",cliAutocompleteFunc:async () => {
|
||||
{key:"options",checker:new api.ODCheckerCustomStructure_UniqueIdArray("opendiscord:panel-options","openticket","option-ids","option-ids-used",{allowDoubles:false,minLength:1,maxLength:25,cliDisplayPropertyName:"option",cliDisplayName:"Options",cliDisplayDescription:"A list of valid option IDs to show in this panel."},{cliDisplayName:"Option ID",cliDisplayDescription:"A valid option ID from the options.jsonc config.",cliAutocompleteFunc:async () => {
|
||||
const uncheckedRawData = opendiscord.configs.get("opendiscord:options").data
|
||||
if (!Array.isArray(uncheckedRawData)) return null
|
||||
const idList = uncheckedRawData.filter((option) => typeof option == "object" && typeof option["id"] == "string").map((option) => option.id)
|
||||
@@ -536,6 +585,8 @@ export const defaultPanelsStructure = new api.ODCheckerArrayStructure("opendisco
|
||||
//SETTINGS
|
||||
{key:"settings",checker:new api.ODCheckerObjectStructure("opendiscord:panel-settings",{cliInitSkipKeys:["dropdownPlaceholder","describeOptionsCustomTitle"],children:[
|
||||
{key:"dropdownPlaceholder",checker:new api.ODCheckerStringStructure("opendiscord:panel-settings-placeholder",{maxLength:100,cliInitDefaultValue:"Create a ticket!",cliDisplayName:"Dropdown Placeholder",cliDisplayDescription:"Configure the text displayed in the dropdown when nothing is selected."})},
|
||||
{key:"maximumButtonsPerRow",checker:new api.ODCheckerNumberStructure("opendiscord:panel-settings-row-amount",{min:1,max:5,floatAllowed:false,cliInitDefaultValue:5,cliDisplayName:"Maximum Buttons Per Row",cliDisplayDescription:"Set the maximum amount of buttons in a single row before starting a new one."})},
|
||||
|
||||
{key:"enableMaxTicketsWarningInText",checker:new api.ODCheckerBooleanStructure("opendiscord:panel-settings-maxtickets-text",{cliDisplayName:"Enable Max Tickets Warning (Text)",cliDisplayDescription:"Enable/disable the warning which shows how many tickets you can create in the text contents of the panel."})},
|
||||
{key:"enableMaxTicketsWarningInEmbed",checker:new api.ODCheckerBooleanStructure("opendiscord:panel-settings-maxtickets-embed",{cliDisplayName:"Enable Max Tickets Warning (Embed)",cliDisplayDescription:"Enable/disable the warning which shows how many tickets you can create in the embed of the panel."})},
|
||||
|
||||
@@ -547,20 +598,95 @@ export const defaultPanelsStructure = new api.ODCheckerArrayStructure("opendisco
|
||||
],cliDisplayName:"Settings",cliDisplayDescription:"Manage additional settings & customisability for this panel."})},
|
||||
],cliDisplayName:"Panel",cliDisplayDescription:"Manage, customise and configure a panel to your preference."}),cliDisplayName:"Panels",cliDisplayDescription:"A list of all panels in the bot. Here you can add, modify & remove existing panels or customise them to your preference."})
|
||||
|
||||
export const defaultQuestionsStructure = new api.ODCheckerArrayStructure("opendiscord:questions",{allowedTypes:["object"],cliDisplayPropertyName:"question",propertyChecker:new api.ODCheckerObjectStructure("opendiscord:questions",{cliDisplayKeyInParentArray:"name",cliDisplayAdditionalKeysInParentArray:["id","type"],children:[
|
||||
{key:"id",checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:question-id","openticket","question-ids",{regex:/^[A-Za-z0-9-éèçàêâôûî]+$/,minLength:3,maxLength:40,cliDisplayName:"Id",cliDisplayDescription:"The id of this question. Used in ticket options."})},
|
||||
{key:"name",checker:new api.ODCheckerStringStructure("opendiscord:question-name",{minLength:3,maxLength:45,cliDisplayName:"Name",cliDisplayDescription:"The name of this question."})},
|
||||
{key:"type",checker:new api.ODCheckerStringStructure("opendiscord:question-type",{choices:["short","paragraph"],cliDisplayName:"Type",cliDisplayDescription:"The type of this question (short/paragraph)."})},
|
||||
|
||||
{key:"required",checker:new api.ODCheckerBooleanStructure("opendiscord:question-required",{cliDisplayName:"Required",cliDisplayDescription:"Is this question required? If not, it can be left empty."})},
|
||||
{key:"placeholder",checker:new api.ODCheckerStringStructure("opendiscord:question-placeholder",{maxLength:100,cliDisplayName:"Placeholder",cliDisplayDescription:"The placeholder to show in the field when nothing has been written yet."})},
|
||||
|
||||
{key:"length",checker:new api.ODCheckerEnabledObjectStructure("opendiscord:question-length",{property:"enabled",enabledValue:true,checker:new api.ODCheckerObjectStructure("opendiscord:question-length",{children:[
|
||||
{key:"enabled",checker:new api.ODCheckerBooleanStructure("opendiscord:question-length-enabled",{cliDisplayName:"Enabled",cliDisplayDescription:"Enable/disable length validation for this question."})},
|
||||
{key:"min",checker:new api.ODCheckerNumberStructure("opendiscord:question-length-min",{min:0,max:1024,negativeAllowed:false,floatAllowed:false,cliDisplayName:"Min Length",cliDisplayDescription:"The minimum amount of characters required."})},
|
||||
{key:"max",checker:new api.ODCheckerNumberStructure("opendiscord:question-length-max",{min:1,max:1024,negativeAllowed:false,floatAllowed:false,cliInitDefaultValue:100,cliDisplayName:"Max Length",cliDisplayDescription:"The maximum amount of characters allowed."})},
|
||||
],cliDisplayName:"Length Validation",cliDisplayDescription:"Add length validation to the question. This way, the contents must be at least/most ... characters."}),cliDisplayName:"Length Validation",cliDisplayDescription:"Add length validation to the question. This way, the contents must be at least/most ... characters."})},
|
||||
],cliDisplayName:"Question",cliDisplayDescription:"Manage, customise and configure a question to your preference."}),cliDisplayName:"Questions",cliDisplayDescription:"A list of all questions in the bot. Here you can add, modify & remove existing questions or customise them to your preference."})
|
||||
export const defaultQuestionsStructure = new api.ODCheckerArrayStructure("opendiscord:questions",{allowedTypes:["object"],cliDisplayPropertyName:"question",propertyChecker:new api.ODCheckerObjectSwitchStructure("opendiscord:options",{objects:[
|
||||
//SHORT QUESTION
|
||||
{name:"Short Question",priority:0,properties:[{key:"type",value:"short"}],checker:new api.ODCheckerObjectStructure("opendiscord:short-question",{cliDisplayKeyInParentArray:"name",cliDisplayAdditionalKeysInParentArray:["id","type"],children:[
|
||||
{key:"id",checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:question-id","openticket","question-ids",{regex:/^[A-Za-z0-9-éèçàêâôûî]+$/,minLength:3,maxLength:40,cliDisplayName:"Id",cliDisplayDescription:"The id of this question. Used in ticket options."})},
|
||||
{key:"name",checker:new api.ODCheckerStringStructure("opendiscord:question-name",{minLength:3,maxLength:45,cliDisplayName:"Name",cliDisplayDescription:"The name of this question."})},
|
||||
{key:"description",checker:new api.ODCheckerStringStructure("opendiscord:question-description",{maxLength:100,cliDisplayName:"Description",cliDisplayDescription:"The description of this question."})},
|
||||
{key:"required",checker:new api.ODCheckerBooleanStructure("opendiscord:question-required",{cliDisplayName:"Required",cliDisplayDescription:"Is this question required? If not, it can be left empty."})},
|
||||
|
||||
{key:"placeholder",checker:new api.ODCheckerStringStructure("opendiscord:question-placeholder",{maxLength:100,cliDisplayName:"Placeholder",cliDisplayDescription:"The placeholder to show in the field when nothing has been written yet."})},
|
||||
|
||||
{key:"length",checker:new api.ODCheckerEnabledObjectStructure("opendiscord:question-length",{property:"enabled",enabledValue:true,checker:new api.ODCheckerObjectStructure("opendiscord:question-length",{children:[
|
||||
{key:"enabled",checker:new api.ODCheckerBooleanStructure("opendiscord:question-length-enabled",{cliDisplayName:"Enabled",cliDisplayDescription:"Enable/disable length validation for this question."})},
|
||||
{key:"min",checker:new api.ODCheckerNumberStructure("opendiscord:question-length-min",{min:0,max:1024,negativeAllowed:false,floatAllowed:false,cliDisplayName:"Min Length",cliDisplayDescription:"The minimum amount of characters required."})},
|
||||
{key:"max",checker:new api.ODCheckerNumberStructure("opendiscord:question-length-max",{min:1,max:1024,negativeAllowed:false,floatAllowed:false,cliInitDefaultValue:100,cliDisplayName:"Max Length",cliDisplayDescription:"The maximum amount of characters allowed."})},
|
||||
],cliDisplayName:"Length Validation",cliDisplayDescription:"Add length validation to the question. This way, the contents must be at least/most ... characters."}),cliDisplayName:"Length Validation",cliDisplayDescription:"Add length validation to the question. This way, the contents must be at least/most ... characters."})},
|
||||
],cliDisplayName:"Short Question",cliDisplayDescription:"Manage, customise and configure the short question to your preference."})},
|
||||
|
||||
//PARAGRAPH QUESTION
|
||||
{name:"Paragraph Question",priority:0,properties:[{key:"type",value:"paragraph"}],checker:new api.ODCheckerObjectStructure("opendiscord:paragraph-question",{cliDisplayKeyInParentArray:"name",cliDisplayAdditionalKeysInParentArray:["id","type"],children:[
|
||||
{key:"id",checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:question-id","openticket","question-ids",{regex:/^[A-Za-z0-9-éèçàêâôûî]+$/,minLength:3,maxLength:40,cliDisplayName:"Id",cliDisplayDescription:"The id of this question. Used in ticket options."})},
|
||||
{key:"name",checker:new api.ODCheckerStringStructure("opendiscord:question-name",{minLength:3,maxLength:45,cliDisplayName:"Name",cliDisplayDescription:"The name of this question."})},
|
||||
{key:"description",checker:new api.ODCheckerStringStructure("opendiscord:question-description",{maxLength:100,cliDisplayName:"Description",cliDisplayDescription:"The description of this question."})},
|
||||
{key:"required",checker:new api.ODCheckerBooleanStructure("opendiscord:question-required",{cliDisplayName:"Required",cliDisplayDescription:"Is this question required? If not, it can be left empty."})},
|
||||
|
||||
{key:"placeholder",checker:new api.ODCheckerStringStructure("opendiscord:question-placeholder",{maxLength:100,cliDisplayName:"Placeholder",cliDisplayDescription:"The placeholder to show in the field when nothing has been written yet."})},
|
||||
|
||||
{key:"length",checker:new api.ODCheckerEnabledObjectStructure("opendiscord:question-length",{property:"enabled",enabledValue:true,checker:new api.ODCheckerObjectStructure("opendiscord:question-length",{children:[
|
||||
{key:"enabled",checker:new api.ODCheckerBooleanStructure("opendiscord:question-length-enabled",{cliDisplayName:"Enabled",cliDisplayDescription:"Enable/disable length validation for this question."})},
|
||||
{key:"min",checker:new api.ODCheckerNumberStructure("opendiscord:question-length-min",{min:0,max:1024,negativeAllowed:false,floatAllowed:false,cliDisplayName:"Min Length",cliDisplayDescription:"The minimum amount of characters required."})},
|
||||
{key:"max",checker:new api.ODCheckerNumberStructure("opendiscord:question-length-max",{min:1,max:1024,negativeAllowed:false,floatAllowed:false,cliInitDefaultValue:100,cliDisplayName:"Max Length",cliDisplayDescription:"The maximum amount of characters allowed."})},
|
||||
],cliDisplayName:"Length Validation",cliDisplayDescription:"Add length validation to the question. This way, the contents must be at least/most ... characters."}),cliDisplayName:"Length Validation",cliDisplayDescription:"Add length validation to the question. This way, the contents must be at least/most ... characters."})},
|
||||
],cliDisplayName:"Paragraph Question",cliDisplayDescription:"Manage, customise and configure the paragraph question to your preference."})},
|
||||
|
||||
//TEXT DISPLAY QUESTION
|
||||
{name:"Text Display Question",priority:0,properties:[{key:"type",value:"text-display"}],checker:new api.ODCheckerObjectStructure("opendiscord:text-display-question",{cliDisplayKeyInParentArray:"name",cliDisplayAdditionalKeysInParentArray:["id","type"],children:[
|
||||
{key:"id",checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:question-id","openticket","question-ids",{regex:/^[A-Za-z0-9-éèçàêâôûî]+$/,minLength:3,maxLength:40,cliDisplayName:"Id",cliDisplayDescription:"The id of this text display. Used in ticket options."})},
|
||||
{key:"textContents",checker:new api.ODCheckerStringStructure("opendiscord:text-contents",{minLength:1,maxLength:2048,cliDisplayName:"Text Contents",cliDisplayDescription:"The text contents to show in the modal."})},
|
||||
],cliDisplayName:"Text Display Question",cliDisplayDescription:"Manage, customise and configure the text display question to your preference."})},
|
||||
|
||||
//DROPDOWN QUESTION
|
||||
{name:"Dropdown Question",priority:0,properties:[{key:"type",value:"dropdown"}],checker:new api.ODCheckerObjectStructure("opendiscord:dropdown-question",{cliDisplayKeyInParentArray:"name",cliDisplayAdditionalKeysInParentArray:["id","type"],children:[
|
||||
{key:"id",checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:question-id","openticket","question-ids",{regex:/^[A-Za-z0-9-éèçàêâôûî]+$/,minLength:3,maxLength:40,cliDisplayName:"Id",cliDisplayDescription:"The id of this question. Used in ticket options."})},
|
||||
{key:"name",checker:new api.ODCheckerStringStructure("opendiscord:question-name",{minLength:3,maxLength:45,cliDisplayName:"Name",cliDisplayDescription:"The name of this question."})},
|
||||
{key:"description",checker:new api.ODCheckerStringStructure("opendiscord:question-description",{maxLength:100,cliDisplayName:"Description",cliDisplayDescription:"The description of this question."})},
|
||||
{key:"required",checker:new api.ODCheckerBooleanStructure("opendiscord:question-required",{cliDisplayName:"Required",cliDisplayDescription:"Is this question required? If not, it can be left empty."})},
|
||||
|
||||
{key:"placeholder",checker:new api.ODCheckerStringStructure("opendiscord:question-placeholder",{maxLength:100,cliDisplayName:"Placeholder",cliDisplayDescription:"The placeholder to show in the field when nothing has been written yet."})},
|
||||
{key:"choices",checker:new api.ODCheckerArrayStructure("opendiscord:choices",{allowedTypes:["object"],minLength:1,maxLength:25,propertyChecker:new api.ODCheckerObjectStructure("opendiscord:choice",{children:[
|
||||
{key:"title",checker:new api.ODCheckerStringStructure("opendiscord:choice-title",{minLength:1,maxLength:100,cliDisplayName:"Title",cliDisplayDescription:"The title of this choice."})},
|
||||
{key:"description",checker:new api.ODCheckerStringStructure("opendiscord:choice-description",{maxLength:100,cliDisplayName:"Description",cliDisplayDescription:"The description of this choice."})},
|
||||
{key:"emoji",checker:new api.ODCheckerCustomStructure_EmojiString("opendiscord:choice-emoji",0,1,true,{cliDisplayName:"Emoji",cliDisplayDescription:"The emoji of the choice. Leave empty to disable."})}
|
||||
],cliDisplayName:"Choice",cliDisplayDescription:"A choice for this dropdown question."}),cliDisplayName:"Choices",cliDisplayPropertyName:"choice",cliDisplayDescription:"Manage all available choices of this dropdown question."})}
|
||||
],cliDisplayName:"Dropdown Question",cliDisplayDescription:"Manage, customise and configure the dropdown question to your preference."})},
|
||||
|
||||
//RADIO SELECT QUESTION
|
||||
{name:"Radio Select Question",priority:0,properties:[{key:"type",value:"radio-select"}],checker:new api.ODCheckerObjectStructure("opendiscord:radio-select-question",{cliDisplayKeyInParentArray:"name",cliDisplayAdditionalKeysInParentArray:["id","type"],children:[
|
||||
{key:"id",checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:question-id","openticket","question-ids",{regex:/^[A-Za-z0-9-éèçàêâôûî]+$/,minLength:3,maxLength:40,cliDisplayName:"Id",cliDisplayDescription:"The id of this question. Used in ticket options."})},
|
||||
{key:"name",checker:new api.ODCheckerStringStructure("opendiscord:question-name",{minLength:3,maxLength:45,cliDisplayName:"Name",cliDisplayDescription:"The name of this question."})},
|
||||
{key:"description",checker:new api.ODCheckerStringStructure("opendiscord:question-description",{maxLength:100,cliDisplayName:"Description",cliDisplayDescription:"The description of this question."})},
|
||||
{key:"required",checker:new api.ODCheckerBooleanStructure("opendiscord:question-required",{cliDisplayName:"Required",cliDisplayDescription:"Is this question required? If not, it can be left empty."})},
|
||||
|
||||
{key:"choices",checker:new api.ODCheckerArrayStructure("opendiscord:choices",{allowedTypes:["object"],minLength:2,maxLength:10,propertyChecker:new api.ODCheckerObjectStructure("opendiscord:choice",{children:[
|
||||
{key:"title",checker:new api.ODCheckerStringStructure("opendiscord:choice-title",{minLength:1,maxLength:100,cliDisplayName:"Title",cliDisplayDescription:"The title of this choice."})},
|
||||
{key:"description",checker:new api.ODCheckerStringStructure("opendiscord:choice-description",{maxLength:100,cliDisplayName:"Description",cliDisplayDescription:"The description of this choice."})},
|
||||
{key:"selectedByDefault",checker:new api.ODCheckerBooleanStructure("opendiscord:choice-default",{cliDisplayName:"Selected By Default",cliDisplayDescription:"Should this choice be selected by default?"})}
|
||||
],cliDisplayName:"Choice",cliDisplayDescription:"A choice for this radio select question."}),cliDisplayName:"Choices",cliDisplayPropertyName:"choice",cliDisplayDescription:"Manage all available choices of this radio select question."})}
|
||||
],cliDisplayName:"Radio Select Question",cliDisplayDescription:"Manage, customise and configure the radio select question to your preference."})},
|
||||
|
||||
//CHECKBOX SELECT QUESTION
|
||||
{name:"Checkbox Select Question",priority:0,properties:[{key:"type",value:"checkbox-select"}],checker:new api.ODCheckerObjectStructure("opendiscord:checkbox-select-question",{cliDisplayKeyInParentArray:"name",cliDisplayAdditionalKeysInParentArray:["id","type"],children:[
|
||||
{key:"id",checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:question-id","openticket","question-ids",{regex:/^[A-Za-z0-9-éèçàêâôûî]+$/,minLength:3,maxLength:40,cliDisplayName:"Id",cliDisplayDescription:"The id of this question. Used in ticket options."})},
|
||||
{key:"name",checker:new api.ODCheckerStringStructure("opendiscord:question-name",{minLength:3,maxLength:45,cliDisplayName:"Name",cliDisplayDescription:"The name of this question."})},
|
||||
{key:"description",checker:new api.ODCheckerStringStructure("opendiscord:question-description",{maxLength:100,cliDisplayName:"Description",cliDisplayDescription:"The description of this question."})},
|
||||
{key:"required",checker:new api.ODCheckerBooleanStructure("opendiscord:question-required",{cliDisplayName:"Required",cliDisplayDescription:"Is this question required? If not, it can be left empty."})},
|
||||
|
||||
{key:"limits",checker:new api.ODCheckerEnabledObjectStructure("opendiscord:amount",{property:"enabled",enabledValue:true,checker:new api.ODCheckerObjectStructure("opendiscord:amount",{children:[
|
||||
{key:"enabled",checker:new api.ODCheckerBooleanStructure("opendiscord:amount-enabled",{cliDisplayName:"Enabled",cliDisplayDescription:"Enable/disable checking the min/max amount of required checkboxes."})},
|
||||
{key:"min",checker:new api.ODCheckerNumberStructure("opendiscord:amount-min",{min:0,max:10,floatAllowed:false,cliDisplayName:"Min Amount",cliDisplayDescription:"The minimum amount of checkboxes required."})},
|
||||
{key:"max",checker:new api.ODCheckerNumberStructure("opendiscord:amount-max",{min:1,max:10,floatAllowed:false,cliInitDefaultValue:10,cliDisplayName:"Max Amount",cliDisplayDescription:"The maximum amount of checkboxes allowed."})},
|
||||
],cliDisplayName:"Checkbox Limits",cliDisplayDescription:"Verify the minimum or maximum amount of checkboxes required."}),cliDisplayName:"Checkbox Limits",cliDisplayDescription:"Verify the minimum or maximum amount of checkboxes required."})},
|
||||
|
||||
{key:"choices",checker:new api.ODCheckerArrayStructure("opendiscord:choices",{allowedTypes:["object"],minLength:1,maxLength:10,propertyChecker:new api.ODCheckerObjectStructure("opendiscord:choice",{children:[
|
||||
{key:"title",checker:new api.ODCheckerStringStructure("opendiscord:choice-title",{minLength:1,maxLength:100,cliDisplayName:"Title",cliDisplayDescription:"The title of this choice."})},
|
||||
{key:"description",checker:new api.ODCheckerStringStructure("opendiscord:choice-description",{maxLength:100,cliDisplayName:"Description",cliDisplayDescription:"The description of this choice."})},
|
||||
{key:"selectedByDefault",checker:new api.ODCheckerBooleanStructure("opendiscord:choice-default",{cliDisplayName:"Selected By Default",cliDisplayDescription:"Should this choice be selected by default?"})}
|
||||
],cliDisplayName:"Choice",cliDisplayDescription:"A choice for this checkbox select question."}),cliDisplayName:"Choices",cliDisplayPropertyName:"choice",cliDisplayDescription:"Manage all available choices of this checkbox select question."})}
|
||||
],cliDisplayName:"Checkbox Select Question",cliDisplayDescription:"Manage, customise and configure the checkbox select question to your preference."})},
|
||||
|
||||
],cliDisplayName:"Question",cliDisplayDescription:"Manage a question of one of the 6 types: short, paragraph, text-display, dropdown, radio-select, checkbox-select."}),cliDisplayName:"Questions",cliDisplayDescription:"A list of all questions in the bot. Here you can add, modify & remove existing questions or customise them to your preference."})
|
||||
|
||||
export const defaultTranscriptsStructure = new api.ODCheckerObjectStructure("opendiscord:transcripts",{children:[
|
||||
//GENERAL
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
@@ -9,7 +9,7 @@ const statsDatabase = opendiscord.databases.get("opendiscord:stats")
|
||||
const optionDatabase = opendiscord.databases.get("opendiscord:options")
|
||||
const mainServer = opendiscord.client.mainServer
|
||||
|
||||
export const loadAllCode = async () => {
|
||||
export async function loadAllCode(){
|
||||
if (!generalConfig || !mainServer || !globalDatabase || !userDatabase || !ticketDatabase || !statsDatabase || !optionDatabase) return
|
||||
|
||||
loadCommandErrorHandlingCode()
|
||||
@@ -20,7 +20,7 @@ export const loadAllCode = async () => {
|
||||
loadAutoCode()
|
||||
}
|
||||
|
||||
export const loadCommandErrorHandlingCode = async () => {
|
||||
export async function loadCommandErrorHandlingCode(){
|
||||
//COMMAND ERROR HANDLING
|
||||
opendiscord.code.add(new api.ODCode("opendiscord:command-error-handling",14,() => {
|
||||
//invalid/missing options
|
||||
@@ -30,34 +30,33 @@ export const loadCommandErrorHandlingCode = async () => {
|
||||
error.msg.channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-option-invalid").build("text",{guild:error.msg.guild,channel:error.msg.channel,user:error.msg.author,error})).message)
|
||||
}else if (error.type == "missing_option"){
|
||||
error.msg.channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-option-missing").build("text",{guild:error.msg.guild,channel:error.msg.channel,user:error.msg.author,error})).message)
|
||||
}else if (error.type == "unknown_command" && generalConfig.data.system.sendErrorOnUnknownCommand){
|
||||
}else if (error.type == "unknown_command" && generalConfig.data.ticketSystem.sendErrorOnUnknownCommand){
|
||||
error.msg.channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-unknown-command").build("text",{guild:error.msg.guild,channel:error.msg.channel,user:error.msg.author,error})).message)
|
||||
}
|
||||
})
|
||||
|
||||
//responder timeout
|
||||
opendiscord.responders.commands.setTimeoutErrorCallback(async (instance,source) => {
|
||||
instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(source,{guild:instance.guild,channel:instance.channel,user:instance.user}))
|
||||
opendiscord.responders.commands.setTimeoutErrorCallback(async (instance,origin) => {
|
||||
return await instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(origin,{guild:instance.guild,channel:instance.channel,user:instance.user}))
|
||||
},null)
|
||||
opendiscord.responders.buttons.setTimeoutErrorCallback(async (instance,source) => {
|
||||
instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(source,{guild:instance.guild,channel:instance.channel,user:instance.user}))
|
||||
opendiscord.responders.buttons.setTimeoutErrorCallback(async (instance,origin) => {
|
||||
return await instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(origin,{guild:instance.guild,channel:instance.channel,user:instance.user}))
|
||||
},null)
|
||||
opendiscord.responders.dropdowns.setTimeoutErrorCallback(async (instance,source) => {
|
||||
instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(source,{guild:instance.guild,channel:instance.channel,user:instance.user}))
|
||||
opendiscord.responders.dropdowns.setTimeoutErrorCallback(async (instance,origin) => {
|
||||
return await instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(origin,{guild:instance.guild,channel:instance.channel,user:instance.user}))
|
||||
},null)
|
||||
opendiscord.responders.modals.setTimeoutErrorCallback(async (instance,source) => {
|
||||
opendiscord.responders.modals.setTimeoutErrorCallback(async (instance,origin) => {
|
||||
if (!instance.channel){
|
||||
instance.reply({id:new api.ODId("looks-like-we-got-an-error-here"), ephemeral:true, message:{
|
||||
return await instance.reply({id:new api.ODId("opendiscord:unknown-error"), ephemeral:true, message:{
|
||||
content:":x: **Something went wrong while replying to this modal!**"
|
||||
}})
|
||||
return
|
||||
}
|
||||
instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(source,{guild:instance.guild,channel:instance.channel,user:instance.user}))
|
||||
return await instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(origin,{guild:instance.guild,channel:instance.channel,user:instance.user}))
|
||||
},null)
|
||||
}))
|
||||
}
|
||||
|
||||
export const loadStartListeningInteractionsCode = async () => {
|
||||
export async function loadStartListeningInteractionsCode(){
|
||||
//START LISTENING TO INTERACTIONS
|
||||
opendiscord.code.add(new api.ODCode("opendiscord:start-listening-interactions",13,() => {
|
||||
opendiscord.client.slashCommands.startListeningToInteractions()
|
||||
@@ -67,7 +66,7 @@ export const loadStartListeningInteractionsCode = async () => {
|
||||
}))
|
||||
}
|
||||
|
||||
export const loadDatabaseCleanersCode = async () => {
|
||||
export async function loadDatabaseCleanersCode(){
|
||||
if (!mainServer) return
|
||||
|
||||
//PANEL DATABASE CLEANER
|
||||
@@ -79,7 +78,7 @@ export const loadDatabaseCleanersCode = async () => {
|
||||
if (!validPanels.includes(panel.key)){
|
||||
try{
|
||||
const splittedId = panel.key.split("_")
|
||||
const message = await opendiscord.client.fetchGuildChannelMessage(mainServer,splittedId[0],splittedId[1])
|
||||
const message = await opendiscord.client.fetchChannelMessage(splittedId[0],splittedId[1])
|
||||
if (message) validPanels.push(panel.key)
|
||||
}catch{}
|
||||
}
|
||||
@@ -283,7 +282,7 @@ export const loadDatabaseCleanersCode = async () => {
|
||||
}))
|
||||
}
|
||||
|
||||
export const loadPanelAutoUpdateCode = async () => {
|
||||
export async function loadPanelAutoUpdateCode(){
|
||||
//PANEL AUTO UPDATE
|
||||
opendiscord.code.add(new api.ODCode("opendiscord:panel-auto-update",7,async () => {
|
||||
const globalDatabase = opendiscord.databases.get("opendiscord:global")
|
||||
@@ -303,7 +302,7 @@ export const loadPanelAutoUpdateCode = async () => {
|
||||
const splittedId = panelId.key.split("_")
|
||||
const channel = await opendiscord.client.fetchGuildTextChannel(mainServer,splittedId[0])
|
||||
if (!channel) return
|
||||
const message = await opendiscord.client.fetchGuildChannelMessage(mainServer,channel,splittedId[1])
|
||||
const message = await opendiscord.client.fetchChannelMessage(channel,splittedId[1])
|
||||
if (!message || !message.editable) return
|
||||
|
||||
message.edit((await opendiscord.builders.messages.getSafe("opendiscord:panel").build("auto-update",{guild:mainServer,channel,user:opendiscord.client.client.user,panel})).message)
|
||||
@@ -317,7 +316,7 @@ export const loadPanelAutoUpdateCode = async () => {
|
||||
}))
|
||||
}
|
||||
|
||||
export const loadDatabaseSaversCode = async () => {
|
||||
export async function loadDatabaseSaversCode(){
|
||||
//TICKET SAVER
|
||||
opendiscord.code.add(new api.ODCode("opendiscord:ticket-saver",6,() => {
|
||||
const mainVersion = opendiscord.versions.get("opendiscord:version")
|
||||
@@ -382,6 +381,8 @@ export const loadDatabaseSaversCode = async () => {
|
||||
}
|
||||
|
||||
const loadAutoCode = () => {
|
||||
const interactiveMsgState = opendiscord.states.get("opendiscord:interactive-message")
|
||||
|
||||
//AUTOCLOSE TIMEOUT
|
||||
opendiscord.code.add(new api.ODCode("opendiscord:autoclose-timeout",3,() => {
|
||||
setInterval(async () => {
|
||||
@@ -400,17 +401,23 @@ const loadAutoCode = () => {
|
||||
if (enabled && (new Date().getTime() - lastMessage.createdTimestamp) >= time){
|
||||
//autoclose ticket
|
||||
await opendiscord.actions.get("opendiscord:close-ticket").run("autoclose",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket,reason:"Autoclose",sendMessage:false})
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:autoclose-message").build("timeout",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket})).message)
|
||||
const sentMsg = await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:autoclose-message").build("timeout",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket})).message)
|
||||
await interactiveMsgState.setMsgState({channel,message:sentMsg},{
|
||||
messageType:"autoclose-message",
|
||||
messageOrigin:"other",
|
||||
messageAuthor:opendiscord.client.client.user.id,
|
||||
messageReason:"Autoclose"
|
||||
},false)
|
||||
count++
|
||||
await opendiscord.stats.get("opendiscord:global").setStat("opendiscord:tickets-autoclosed",1,"increase")
|
||||
await opendiscord.statistics.get("opendiscord:global").setStat("opendiscord:tickets-autoclosed",1,"increase")
|
||||
}
|
||||
}
|
||||
}
|
||||
opendiscord.debug.debug("Finished autoclose timeout cycle!",[
|
||||
{key:"interval",value:opendiscord.defaults.getDefault("autocloseCheckInterval").toString()},
|
||||
{key:"interval",value:opendiscord.fuses.getFuse("autocloseCheckInterval").toString()},
|
||||
{key:"closed",value:count.toString()}
|
||||
])
|
||||
},opendiscord.defaults.getDefault("autocloseCheckInterval"))
|
||||
},opendiscord.fuses.getFuse("autocloseCheckInterval"))
|
||||
}))
|
||||
|
||||
//AUTOCLOSE LEAVE
|
||||
@@ -427,8 +434,14 @@ const loadAutoCode = () => {
|
||||
if (enabled){
|
||||
//autoclose ticket
|
||||
await opendiscord.actions.get("opendiscord:close-ticket").run("autoclose",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket,reason:"Autoclose",sendMessage:false})
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:autoclose-message").build("leave",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket})).message)
|
||||
await opendiscord.stats.get("opendiscord:global").setStat("opendiscord:tickets-autoclosed",1,"increase")
|
||||
const sentMsg = await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:autoclose-message").build("leave",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket})).message)
|
||||
await interactiveMsgState.setMsgState({channel,message:sentMsg},{
|
||||
messageType:"autoclose-message",
|
||||
messageOrigin:"other",
|
||||
messageAuthor:opendiscord.client.client.user.id,
|
||||
messageReason:"Autoclose"
|
||||
},false)
|
||||
await opendiscord.statistics.get("opendiscord:global").setStat("opendiscord:tickets-autoclosed",1,"increase")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -446,7 +459,7 @@ const loadAutoCode = () => {
|
||||
if (lastMessage){
|
||||
//ticket has last message
|
||||
const disableOnClaim = ticket.option.get("opendiscord:autodelete-disable-claim").value && ticket.get("opendiscord:claimed").value
|
||||
const disableWhenNotClosed = generalConfig.data.system.autodeleteRequiresClosedTicket && !ticket.get("opendiscord:closed").value
|
||||
const disableWhenNotClosed = generalConfig.data.ticketSystem.autodeleteRequiresClosedTicket && !ticket.get("opendiscord:closed").value
|
||||
|
||||
const enabled = (disableOnClaim || disableWhenNotClosed) ? false : ticket.get("opendiscord:autodelete-enabled").value
|
||||
const days = ticket.get("opendiscord:autodelete-days").value
|
||||
@@ -457,15 +470,15 @@ const loadAutoCode = () => {
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:autodelete-message").build("timeout",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket})).message)
|
||||
await opendiscord.actions.get("opendiscord:delete-ticket").run("autodelete",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket,reason:"Autodelete",sendMessage:false,withoutTranscript:false})
|
||||
count++
|
||||
await opendiscord.stats.get("opendiscord:global").setStat("opendiscord:tickets-autodeleted",1,"increase")
|
||||
await opendiscord.statistics.get("opendiscord:global").setStat("opendiscord:tickets-autodeleted",1,"increase")
|
||||
}
|
||||
}
|
||||
}
|
||||
opendiscord.debug.debug("Finished autodelete timeout cycle!",[
|
||||
{key:"interval",value:opendiscord.defaults.getDefault("autodeleteCheckInterval").toString()},
|
||||
{key:"interval",value:opendiscord.fuses.getFuse("autodeleteCheckInterval").toString()},
|
||||
{key:"deleted",value:count.toString()}
|
||||
])
|
||||
},opendiscord.defaults.getDefault("autodeleteCheckInterval"))
|
||||
},opendiscord.fuses.getFuse("autodeleteCheckInterval"))
|
||||
}))
|
||||
|
||||
//AUTODELETE LEAVE
|
||||
@@ -477,14 +490,14 @@ const loadAutoCode = () => {
|
||||
if (!channel) return
|
||||
//ticket has been created by this user
|
||||
const disableOnClaim = ticket.option.get("opendiscord:autodelete-disable-claim").value && ticket.get("opendiscord:claimed").value
|
||||
const disableWhenNotClosed = generalConfig.data.system.autodeleteRequiresClosedTicket && !ticket.get("opendiscord:closed").value
|
||||
const disableWhenNotClosed = generalConfig.data.ticketSystem.autodeleteRequiresClosedTicket && !ticket.get("opendiscord:closed").value
|
||||
const enabled = (disableOnClaim || disableWhenNotClosed || !ticket.get("opendiscord:autodelete-enabled").value) ? false : ticket.option.get("opendiscord:autodelete-enable-leave")
|
||||
|
||||
if (enabled){
|
||||
//autodelete ticket
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:autodelete-message").build("leave",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket})).message)
|
||||
await opendiscord.actions.get("opendiscord:delete-ticket").run("autodelete",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket,reason:"Autodelete",sendMessage:false,withoutTranscript:false})
|
||||
await opendiscord.stats.get("opendiscord:global").setStat("opendiscord:tickets-autodeleted",1,"increase")
|
||||
await opendiscord.statistics.get("opendiscord:global").setStat("opendiscord:tickets-autodeleted",1,"increase")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,9 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const lang = opendiscord.languages
|
||||
|
||||
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW COMMANDS?
|
||||
* - Register the command in loadAllSlashCommands() & loadAllTextCommands() in (./src/data/framework/commandLoader.ts)
|
||||
* - Add autocomplete for the command in OD(Slash/Text)CommandManagerIds_Default in (./src/core/api/defaults/client.ts)
|
||||
* - Add the command to the help menu in (./src/data/framework/helpMenuLoader.ts)
|
||||
* - If required, new config variables should be added (incl. logs, dm-logs & permissions).
|
||||
* - Update the Open Ticket Documentation.
|
||||
* - If the command contains complex logic or can be executed from a button/dropdown, it should be placed inside an `ODAction`.
|
||||
* - Check all files, test the bot carefully & try a lot of different scenario's with different settings.
|
||||
*/
|
||||
|
||||
export const loadAllSlashCommands = async () => {
|
||||
export async function loadAllSlashCommands(){
|
||||
const commands = opendiscord.client.slashCommands
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
if (!generalConfig) return
|
||||
@@ -24,8 +14,8 @@ export const loadAllSlashCommands = async () => {
|
||||
if (!generalConfig.data.slashCommands) return
|
||||
|
||||
const allowedCommands: string[] = []
|
||||
for (const key in generalConfig.data.system.permissions){
|
||||
if (generalConfig.data.system.permissions[key] != "none") allowedCommands.push(key)
|
||||
for (const key in generalConfig.data.permissions){
|
||||
if (generalConfig.data.permissions[key] != "none") allowedCommands.push(key)
|
||||
}
|
||||
|
||||
//HELP
|
||||
@@ -97,7 +87,7 @@ export const loadAllSlashCommands = async () => {
|
||||
}))
|
||||
|
||||
//DELETE
|
||||
if (allowedCommands.includes("delete") && generalConfig.data.system.enableDeleteWithoutTranscript) commands.add(new api.ODSlashCommand("opendiscord:delete",{
|
||||
if (allowedCommands.includes("delete") && generalConfig.data.ticketSystem.enableDeleteWithoutTranscript) commands.add(new api.ODSlashCommand("opendiscord:delete",{
|
||||
type:act.ChatInput,
|
||||
name:"delete",
|
||||
description:lang.getTranslation("commands.delete"),
|
||||
@@ -642,7 +632,7 @@ export const loadAllSlashCommands = async () => {
|
||||
}))
|
||||
}
|
||||
|
||||
export const loadAllTextCommands = async () => {
|
||||
export async function loadAllTextCommands(){
|
||||
const commands = opendiscord.client.textCommands
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
if (!generalConfig) return
|
||||
@@ -664,8 +654,8 @@ export const loadAllTextCommands = async () => {
|
||||
})
|
||||
|
||||
const allowedCommands: string[] = []
|
||||
for (const key in generalConfig.data.system.permissions){
|
||||
if (generalConfig.data.system.permissions[key] != "none") allowedCommands.push(key)
|
||||
for (const key in generalConfig.data.permissions){
|
||||
if (generalConfig.data.permissions[key] != "none") allowedCommands.push(key)
|
||||
}
|
||||
|
||||
//HELP
|
||||
@@ -1216,7 +1206,7 @@ export const loadAllTextCommands = async () => {
|
||||
}))
|
||||
}
|
||||
|
||||
export const loadAllContextMenus = async () => {
|
||||
export async function loadAllContextMenus(){
|
||||
const menus = opendiscord.client.contextMenus
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
if (!generalConfig) return
|
||||
|
||||
+352
-184
@@ -1,145 +1,67 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
import * as fjs from "formatted-json-stringify"
|
||||
|
||||
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW CONFIG VARIABLES?
|
||||
* - Make the change to the config file in (./config/) and be aware of the following things:
|
||||
* - The variable has a clear name and its function is obvious.
|
||||
* - The variable is in the correct position/category of the config.
|
||||
* - The variable contains a default placeholder to suggest the contents.
|
||||
* - If there's a (./devconfig/), also modify this file.
|
||||
* - Register the config in loadAllConfigs() in (./src/data/framework/configLoader.ts)
|
||||
* - The variable should be added to the "formatters" in the correct position.
|
||||
* - Add autocomplete for the variable in ODJsonConfig_Default... in (./src/core/api/defaults/config.ts)
|
||||
* - Add the variable to the config checker in (./src/data/framework/checkerLoader.ts)
|
||||
* - Make sure the variable is compatible with the Interactive Setup CLI.
|
||||
* - The variable should be added by the migration manager (./src/core/startup/migration.ts) when missing.
|
||||
* - Update the Open Ticket Documentation.
|
||||
*
|
||||
* IF VARIABLE IS FROM questions.json, options.json OR panels.json:
|
||||
* - Check (./src/data/openticket/...) for loading/unloading of data.
|
||||
* - Check (./src/actions/createTicket.ts) and related files.
|
||||
* - Check (./src/builders), (./src/actions), (./src/data) & (./src/commands) in general in the areas that were changed.
|
||||
*/
|
||||
|
||||
export const loadAllConfigs = async () => {
|
||||
export async function loadAllConfigs(){
|
||||
const devconfigFlag = opendiscord.flags.get("opendiscord:dev-config")
|
||||
const isDevconfig = devconfigFlag ? devconfigFlag.value : false
|
||||
|
||||
opendiscord.configs.add(new api.ODJsonConfig("opendiscord:general","general.json",(isDevconfig) ? "./devconfig/" : "./config/",defaultGeneralFormatter))
|
||||
opendiscord.configs.add(new api.ODJsonConfig("opendiscord:questions","questions.json",(isDevconfig) ? "./devconfig/" : "./config/",defaultQuestionsFormatter))
|
||||
opendiscord.configs.add(new api.ODJsonConfig("opendiscord:options","options.json",(isDevconfig) ? "./devconfig/" : "./config/",defaultOptionsFormatter))
|
||||
opendiscord.configs.add(new api.ODJsonConfig("opendiscord:panels","panels.json",(isDevconfig) ? "./devconfig/" : "./config/",defaultPanelsFormatter))
|
||||
opendiscord.configs.add(new api.ODJsonConfig("opendiscord:transcripts","transcripts.json",(isDevconfig) ? "./devconfig/" : "./config/",defaultTranscriptsFormatter))
|
||||
opendiscord.configs.add(new api.ODJsonCommentsConfig("opendiscord:general","general.jsonc",(isDevconfig) ? "./devconfig/" : "./config/",defaultGeneralFormatter))
|
||||
opendiscord.configs.add(new api.ODJsonCommentsConfig("opendiscord:questions","questions.jsonc",(isDevconfig) ? "./devconfig/" : "./config/",defaultQuestionsFormatter))
|
||||
opendiscord.configs.add(new api.ODJsonCommentsConfig("opendiscord:options","options.jsonc",(isDevconfig) ? "./devconfig/" : "./config/",defaultOptionsFormatter))
|
||||
opendiscord.configs.add(new api.ODJsonCommentsConfig("opendiscord:panels","panels.jsonc",(isDevconfig) ? "./devconfig/" : "./config/",defaultPanelsFormatter))
|
||||
opendiscord.configs.add(new api.ODJsonCommentsConfig("opendiscord:transcripts","transcripts.jsonc",(isDevconfig) ? "./devconfig/" : "./config/",defaultTranscriptsFormatter))
|
||||
}
|
||||
|
||||
//FORMATTERS
|
||||
export const defaultGeneralFormatter = new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.ObjectFormatter("_INFO",true,[
|
||||
new fjs.PropertyFormatter("support"),
|
||||
new fjs.PropertyFormatter("discord"),
|
||||
new fjs.PropertyFormatter("version"),
|
||||
]),
|
||||
export const defaultGeneralFormatter = new fjs.TopLevelCommentFormatter(new fjs.MultiCommentFormatter([
|
||||
"Hi there! Thank you for installing Open Ticket.",
|
||||
"----------------------------------------------",
|
||||
"If you need any assistance with configuring the bot,",
|
||||
"feel free to use the documentation or join our Discord server:",
|
||||
"https://otdocs.dj-dj.be",
|
||||
"https://discord.dj-dj.be",
|
||||
"----------------------------------------------",
|
||||
"SETUP:",
|
||||
"1. Install the required dependencies using the command: \"npm install\"",
|
||||
"2. Configure the bot in one of the following ways:",
|
||||
" a. (easy) Using the Quick Setup CLI Tool",
|
||||
" b. (difficult) Using the JSON files in `./config/`",
|
||||
"",
|
||||
"Start the Quick Setup CLI Tool using the command: \"npm run setup\"",
|
||||
"After configuration, start the bot using the command: \"npm start\"",
|
||||
"",
|
||||
"Good luck! DJj123dj & contributors",
|
||||
].join("\n")),new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.PropertyFormatter("_CONFIG_VERSION"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.MultiCommentFormatter("Load the bot token from .env or the \"token\" field below. Leave \"token\" empty if using \"tokenFromENV\"."),
|
||||
new fjs.PropertyFormatter("token"),
|
||||
new fjs.PropertyFormatter("tokenFromENV"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("mainColor"),
|
||||
new fjs.PropertyFormatter("language"),
|
||||
new fjs.PropertyFormatter("prefix"),
|
||||
new fjs.PropertyFormatter("mainColor",new fjs.SingleCommentFormatter("Hex color used in most embeds")),
|
||||
new fjs.PropertyFormatter("language",new fjs.SingleCommentFormatter("Visit README.md for list")),
|
||||
new fjs.PropertyFormatter("prefix",new fjs.SingleCommentFormatter("Prefix used in text commands")),
|
||||
new fjs.PropertyFormatter("serverId"),
|
||||
new fjs.ArrayFormatter("globalAdmins",false,new fjs.PropertyFormatter(null)),
|
||||
new fjs.ArrayFormatter("globalAdmins",false,new fjs.PropertyFormatter(null),undefined,undefined,new fjs.SingleCommentFormatter("Have access to all commands")),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.MultiCommentFormatter("Enable/disable text or slash commands."),
|
||||
new fjs.PropertyFormatter("slashCommands"),
|
||||
new fjs.PropertyFormatter("textCommands"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.MultiCommentFormatter("Configure the status of the bot."),
|
||||
new fjs.ObjectFormatter("status",true,[
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("type"),
|
||||
new fjs.PropertyFormatter("mode"),
|
||||
new fjs.PropertyFormatter("type",new fjs.SingleCommentFormatter("Choices: listening, watching, playing, custom")),
|
||||
new fjs.PropertyFormatter("mode",new fjs.SingleCommentFormatter("Choices: online, invisible, idle, dnd")),
|
||||
new fjs.PropertyFormatter("text"),
|
||||
new fjs.PropertyFormatter("state"),
|
||||
new fjs.PropertyFormatter("state",new fjs.SingleCommentFormatter("Additional text (Leave empty to disable)")),
|
||||
]),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ObjectFormatter("system",true,[
|
||||
new fjs.PropertyFormatter("preferSlashOverText"),
|
||||
new fjs.PropertyFormatter("sendErrorOnUnknownCommand"),
|
||||
new fjs.PropertyFormatter("questionFieldsInCodeBlock"),
|
||||
new fjs.PropertyFormatter("displayFieldsWithQuestions"),
|
||||
new fjs.PropertyFormatter("showGlobalAdminsInPanelRoles"),
|
||||
new fjs.PropertyFormatter("disableVerifyBars"),
|
||||
new fjs.PropertyFormatter("useRedErrorEmbeds"),
|
||||
new fjs.PropertyFormatter("alwaysShowReason"),
|
||||
new fjs.PropertyFormatter("emojiStyle"),
|
||||
new fjs.PropertyFormatter("pinEmoji"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("replyOnTicketCreation"),
|
||||
new fjs.PropertyFormatter("replyOnReactionRole"),
|
||||
new fjs.PropertyFormatter("askPriorityOnTicketCreation"),
|
||||
new fjs.PropertyFormatter("removeParticipantsOnClose"),
|
||||
new fjs.PropertyFormatter("disableAutocloseAfterReopen"),
|
||||
new fjs.PropertyFormatter("autodeleteRequiresClosedTicket"),
|
||||
new fjs.PropertyFormatter("adminOnlyDeleteWithoutTranscript"),
|
||||
new fjs.PropertyFormatter("allowCloseBeforeMessage"),
|
||||
new fjs.PropertyFormatter("allowCloseBeforeAdminMessage"),
|
||||
new fjs.PropertyFormatter("useTranslatedConfigChecker"),
|
||||
new fjs.PropertyFormatter("pinFirstTicketMessage"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("enableTicketClaimButtons"),
|
||||
new fjs.PropertyFormatter("enableTicketCloseButtons"),
|
||||
new fjs.PropertyFormatter("enableTicketPinButtons"),
|
||||
new fjs.PropertyFormatter("enableTicketDeleteButtons"),
|
||||
new fjs.PropertyFormatter("enableTicketActionWithReason"),
|
||||
new fjs.PropertyFormatter("enableDeleteWithoutTranscript"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ObjectFormatter("logs",true,[
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("channel"),
|
||||
]),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ObjectFormatter("limits",true,[
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("globalMaximum"),
|
||||
new fjs.PropertyFormatter("userMaximum"),
|
||||
]),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ObjectFormatter("channelTopic",true,[
|
||||
new fjs.PropertyFormatter("showOptionName"),
|
||||
new fjs.PropertyFormatter("showOptionDescription"),
|
||||
new fjs.PropertyFormatter("showOptionTopic"),
|
||||
new fjs.PropertyFormatter("showPriority"),
|
||||
new fjs.PropertyFormatter("showClosed"),
|
||||
new fjs.PropertyFormatter("showClaimed"),
|
||||
new fjs.PropertyFormatter("showPinned"),
|
||||
new fjs.PropertyFormatter("showCreator"),
|
||||
new fjs.PropertyFormatter("showParticipants"),
|
||||
]),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ObjectFormatter("permissions",true,[
|
||||
new fjs.PropertyFormatter("help"),
|
||||
new fjs.PropertyFormatter("panel"),
|
||||
new fjs.PropertyFormatter("ticket"),
|
||||
new fjs.PropertyFormatter("close"),
|
||||
new fjs.PropertyFormatter("delete"),
|
||||
new fjs.PropertyFormatter("reopen"),
|
||||
new fjs.PropertyFormatter("claim"),
|
||||
new fjs.PropertyFormatter("unclaim"),
|
||||
new fjs.PropertyFormatter("pin"),
|
||||
new fjs.PropertyFormatter("unpin"),
|
||||
new fjs.PropertyFormatter("move"),
|
||||
new fjs.PropertyFormatter("rename"),
|
||||
new fjs.PropertyFormatter("add"),
|
||||
new fjs.PropertyFormatter("remove"),
|
||||
new fjs.PropertyFormatter("blacklist"),
|
||||
new fjs.PropertyFormatter("stats"),
|
||||
new fjs.PropertyFormatter("clear"),
|
||||
new fjs.PropertyFormatter("autoclose"),
|
||||
new fjs.PropertyFormatter("autodelete"),
|
||||
new fjs.PropertyFormatter("transfer"),
|
||||
new fjs.PropertyFormatter("topic"),
|
||||
new fjs.PropertyFormatter("priority"),
|
||||
]),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ObjectFormatter("messages",true,[
|
||||
new fjs.MultiCommentFormatter("Send ticket logs to a channel or in DM of the ticket creator."),
|
||||
new fjs.ObjectFormatter("logs",true,[
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("channel"),
|
||||
new fjs.ObjectFormatter("logMessages",true,[
|
||||
new fjs.DefaultFormatter("creation",false),
|
||||
new fjs.DefaultFormatter("closing",false),
|
||||
new fjs.DefaultFormatter("deleting",false),
|
||||
@@ -157,80 +79,267 @@ export const defaultGeneralFormatter = new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.DefaultFormatter("reactionRole",false)
|
||||
]),
|
||||
]),
|
||||
])
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.MultiCommentFormatter("A large collection of settings for the ticket system."),
|
||||
new fjs.ObjectFormatter("ticketSystem",true,[
|
||||
new fjs.PropertyFormatter("preferSlashOverText",new fjs.SingleCommentFormatter("Show slashcmds in help menu's")),
|
||||
new fjs.PropertyFormatter("sendErrorOnUnknownCommand",new fjs.SingleCommentFormatter("Send error when command not found")),
|
||||
new fjs.PropertyFormatter("questionFieldsInCodeBlock",new fjs.SingleCommentFormatter("Put question answers in code blocks")),
|
||||
new fjs.PropertyFormatter("displayFieldsWithQuestions",new fjs.SingleCommentFormatter("Display embed fields together with question answers")),
|
||||
new fjs.PropertyFormatter("showGlobalAdminsInPanelRoles",new fjs.SingleCommentFormatter("Include \"globalAdmins\" in panel admin lists")),
|
||||
new fjs.PropertyFormatter("disableVerifyBars",new fjs.SingleCommentFormatter("Disable the (❌/✅) buttons")),
|
||||
new fjs.PropertyFormatter("useRedErrorEmbeds",new fjs.SingleCommentFormatter("Make errors embeds always red")),
|
||||
new fjs.PropertyFormatter("alwaysShowReason",new fjs.SingleCommentFormatter("Show reason even if none is provided")),
|
||||
new fjs.PropertyFormatter("emojiStyle",new fjs.SingleCommentFormatter("The style of emoji's in embeds. Choices: before, after, double, disabled")),
|
||||
new fjs.PropertyFormatter("pinEmoji",new fjs.SingleCommentFormatter("Channel emoji of pinned tickets (Leave empty to disable)")),
|
||||
new fjs.PropertyFormatter("closeEmoji",new fjs.SingleCommentFormatter("Channel emoji of closed tickets (Leave empty to disable)")),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("replyOnTicketCreation",new fjs.SingleCommentFormatter("Reply with a msg when a ticket is created")),
|
||||
new fjs.PropertyFormatter("replyOnReactionRole",new fjs.SingleCommentFormatter("Reply with a msg when a reaction role is used")),
|
||||
new fjs.PropertyFormatter("askPriorityOnTicketCreation",new fjs.SingleCommentFormatter("Show a dropdown to select priority")),
|
||||
new fjs.PropertyFormatter("removeParticipantsOnClose",new fjs.SingleCommentFormatter("Remove non-admins when ticket is closed")),
|
||||
new fjs.PropertyFormatter("disableAutocloseAfterReopen",new fjs.SingleCommentFormatter("Disable autoclose after ticket got reopened")),
|
||||
new fjs.PropertyFormatter("autodeleteRequiresClosedTicket",new fjs.SingleCommentFormatter("A ticket must be closed before autodelete works")),
|
||||
new fjs.PropertyFormatter("adminOnlyDeleteWithoutTranscript",new fjs.SingleCommentFormatter("Only allow \"globalAdmins\" to delete a ticket without transcript")),
|
||||
new fjs.PropertyFormatter("allowCloseBeforeMessage",new fjs.SingleCommentFormatter("Allow closing before a message is sent")),
|
||||
new fjs.PropertyFormatter("allowCloseBeforeAdminMessage",new fjs.SingleCommentFormatter("Allow closing before an admin has sent a message")),
|
||||
new fjs.PropertyFormatter("useTranslatedConfigChecker",new fjs.SingleCommentFormatter("Translate config errors in the console")),
|
||||
new fjs.PropertyFormatter("pinFirstTicketMessage",new fjs.SingleCommentFormatter("Pin the ticket message to the channel")),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.MultiCommentFormatter("Enable/disable certain buttons & features of the bot."),
|
||||
new fjs.PropertyFormatter("enableTicketClaimButtons"),
|
||||
new fjs.PropertyFormatter("enableTicketCloseButtons"),
|
||||
new fjs.PropertyFormatter("enableTicketPinButtons"),
|
||||
new fjs.PropertyFormatter("enableTicketDeleteButtons"),
|
||||
new fjs.PropertyFormatter("enableTicketActionWithReason"),
|
||||
new fjs.PropertyFormatter("enableDeleteWithoutTranscript",new fjs.SingleCommentFormatter("Allow deleting tickets without transcript")),
|
||||
new fjs.PropertyFormatter("enableCreateTicketForOtherUser",new fjs.SingleCommentFormatter("Allow creating tickets for other users")),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.MultiCommentFormatter("Set the maximum amount of simultaneous tickets."),
|
||||
new fjs.ObjectFormatter("limits",true,[
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("globalMaximum"),
|
||||
new fjs.PropertyFormatter("userMaximum"),
|
||||
]),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.MultiCommentFormatter("Choose which data is shown in the channel topic."),
|
||||
new fjs.ObjectFormatter("channelTopic",true,[
|
||||
new fjs.PropertyFormatter("showOptionName"),
|
||||
new fjs.PropertyFormatter("showOptionDescription"),
|
||||
new fjs.PropertyFormatter("showOptionTopic"),
|
||||
new fjs.PropertyFormatter("showPriority"),
|
||||
new fjs.PropertyFormatter("showClosed"),
|
||||
new fjs.PropertyFormatter("showClaimed"),
|
||||
new fjs.PropertyFormatter("showPinned"),
|
||||
new fjs.PropertyFormatter("showCreator"),
|
||||
new fjs.PropertyFormatter("showParticipants"),
|
||||
]),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.MultiCommentFormatter("Move closed tickets to a separate category."),
|
||||
new fjs.ObjectFormatter("closedCategory",true,[
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("categoryId")
|
||||
]),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.MultiCommentFormatter("Create tickets in a backup category when the original category exceeds 50 channels."),
|
||||
new fjs.ObjectFormatter("backupCategory",true,[
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("categoryId")
|
||||
]),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.MultiCommentFormatter("Move claimed tickets to a matching category of the user that claimed the ticket. Set to empty list [] to disable."),
|
||||
new fjs.ArrayFormatter("claimedCategories",true,new fjs.ObjectFormatter(null,false,[
|
||||
new fjs.PropertyFormatter("user"),
|
||||
new fjs.PropertyFormatter("category"),
|
||||
])),
|
||||
]),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.MultiCommentFormatter([
|
||||
"Set permissions for each individual command, button or action.",
|
||||
"CHOICES:",
|
||||
">> \"none\" -> Command disabled",
|
||||
">> \"everyone\" -> Allowed for everyone",
|
||||
">> \"admin\" -> Global & ticket admins only",
|
||||
">> \"DISCORD_ROLE_ID\" -> Custom role only",
|
||||
].join("\n")),
|
||||
new fjs.ObjectFormatter("permissions",true,[
|
||||
new fjs.PropertyFormatter("help"),
|
||||
new fjs.PropertyFormatter("panel"),
|
||||
new fjs.PropertyFormatter("ticket"),
|
||||
new fjs.PropertyFormatter("close"),
|
||||
new fjs.PropertyFormatter("delete"),
|
||||
new fjs.PropertyFormatter("reopen"),
|
||||
new fjs.PropertyFormatter("claim"),
|
||||
new fjs.PropertyFormatter("unclaim"),
|
||||
new fjs.PropertyFormatter("pin"),
|
||||
new fjs.PropertyFormatter("unpin"),
|
||||
new fjs.PropertyFormatter("move"),
|
||||
new fjs.PropertyFormatter("rename"),
|
||||
new fjs.PropertyFormatter("add"),
|
||||
new fjs.PropertyFormatter("remove"),
|
||||
new fjs.PropertyFormatter("blacklist"),
|
||||
new fjs.PropertyFormatter("stats"),
|
||||
new fjs.PropertyFormatter("clear"),
|
||||
new fjs.PropertyFormatter("autoclose"),
|
||||
new fjs.PropertyFormatter("autodelete"),
|
||||
new fjs.PropertyFormatter("transfer"),
|
||||
new fjs.PropertyFormatter("topic"),
|
||||
new fjs.PropertyFormatter("priority"),
|
||||
new fjs.PropertyFormatter("transcripts"),
|
||||
]),
|
||||
]))
|
||||
|
||||
export const defaultQuestionsFormatter = new fjs.ArrayFormatter(null,true,new fjs.ObjectSwitchFormatter(null,[
|
||||
export const defaultQuestionsFormatter = new fjs.TopLevelCommentFormatter(new fjs.MultiCommentFormatter([
|
||||
"OPEN TICKET MODAL QUESTIONS",
|
||||
"----------------------------------------------",
|
||||
"Create customizable modal questions that will be shown before creating a ticket.",
|
||||
"Each ticket option (config/options.jsonc) can contain a maximum of 5 questions.",
|
||||
"There are 6 types of questions available: short, paragraph, dropdown, radio-select, checkbox-select, text-display",
|
||||
"",
|
||||
"TIP: Create new questions by copying everything between and including the {...} brackets of a question. Paste it after the last question and make sure that they are seperated by a comma."
|
||||
].join("\n")),new fjs.ArrayFormatter(null,true,new fjs.ObjectSwitchFormatter(null,[
|
||||
{key:"type",value:"short",formatter:new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.MultiCommentFormatter("A short text input modal question."),
|
||||
new fjs.PropertyFormatter("id"),
|
||||
new fjs.PropertyFormatter("name"),
|
||||
new fjs.PropertyFormatter("description",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("type"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("required"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("placeholder"),
|
||||
new fjs.ObjectFormatter("length",true,[
|
||||
new fjs.MultiCommentFormatter("Configure length limits for the answer."),
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("min"),
|
||||
new fjs.PropertyFormatter("max"),
|
||||
]),
|
||||
])},
|
||||
{key:"type",value:"paragraph",formatter:new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.MultiCommentFormatter("A paragraph text input modal question."),
|
||||
new fjs.PropertyFormatter("id"),
|
||||
new fjs.PropertyFormatter("name"),
|
||||
new fjs.PropertyFormatter("description",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("type"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("required"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("placeholder"),
|
||||
new fjs.ObjectFormatter("length",true,[
|
||||
new fjs.MultiCommentFormatter("Configure length limits for the answer."),
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("min"),
|
||||
new fjs.PropertyFormatter("max"),
|
||||
]),
|
||||
])}
|
||||
]))
|
||||
|
||||
|
||||
export const defaultOptionsFormatter = new fjs.ArrayFormatter(null,true,new fjs.ObjectSwitchFormatter(null,[
|
||||
{key:"type",value:"ticket",formatter:new fjs.ObjectFormatter(null,true,[
|
||||
])},
|
||||
{key:"type",value:"text-display",formatter:new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.MultiCommentFormatter("Show text in a modal to provide extra details or explain questions."),
|
||||
new fjs.PropertyFormatter("id"),
|
||||
new fjs.PropertyFormatter("type"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("textContents"),
|
||||
])},
|
||||
{key:"type",value:"dropdown",formatter:new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.MultiCommentFormatter("A dropdown menu input modal question with up to 25 choices. \"emoji\" & \"description\" fields are optional."),
|
||||
new fjs.PropertyFormatter("id"),
|
||||
new fjs.PropertyFormatter("name"),
|
||||
new fjs.PropertyFormatter("description"),
|
||||
new fjs.PropertyFormatter("description",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("type"),
|
||||
new fjs.PropertyFormatter("required"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("placeholder"),
|
||||
new fjs.ArrayFormatter("choices",true,new fjs.ObjectFormatter(null,false,[
|
||||
new fjs.PropertyFormatter("title"),
|
||||
new fjs.PropertyFormatter("description"),
|
||||
new fjs.PropertyFormatter("emoji"),
|
||||
])),
|
||||
])},
|
||||
{key:"type",value:"radio-select",formatter:new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.MultiCommentFormatter("A radio select input modal question with up to 10 choices."),
|
||||
new fjs.PropertyFormatter("id"),
|
||||
new fjs.PropertyFormatter("name"),
|
||||
new fjs.PropertyFormatter("description",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("type"),
|
||||
new fjs.PropertyFormatter("required"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ArrayFormatter("choices",true,new fjs.ObjectFormatter(null,false,[
|
||||
new fjs.PropertyFormatter("title"),
|
||||
new fjs.PropertyFormatter("description"),
|
||||
new fjs.PropertyFormatter("selectedByDefault"),
|
||||
])),
|
||||
])},
|
||||
{key:"type",value:"checkbox-select",formatter:new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.MultiCommentFormatter("A checkbox select input modal question with up to 10 choices."),
|
||||
new fjs.PropertyFormatter("id"),
|
||||
new fjs.PropertyFormatter("name"),
|
||||
new fjs.PropertyFormatter("description",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("type"),
|
||||
new fjs.PropertyFormatter("required"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ObjectFormatter("limits",true,[
|
||||
new fjs.MultiCommentFormatter("Configure checkbox amount limits for the answer."),
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("min"),
|
||||
new fjs.PropertyFormatter("max"),
|
||||
]),
|
||||
new fjs.ArrayFormatter("choices",true,new fjs.ObjectFormatter(null,false,[
|
||||
new fjs.PropertyFormatter("title"),
|
||||
new fjs.PropertyFormatter("description"),
|
||||
new fjs.PropertyFormatter("selectedByDefault"),
|
||||
])),
|
||||
])},
|
||||
])))
|
||||
|
||||
|
||||
export const defaultOptionsFormatter = new fjs.TopLevelCommentFormatter(new fjs.MultiCommentFormatter([
|
||||
"OPEN TICKET BUTTON OPTIONS",
|
||||
"----------------------------------------------",
|
||||
"Create customizable ticket, website, reaction-role or sub-panel button options.",
|
||||
"Up to 25 options can be added to each panel in (config/panels.jsonc)",
|
||||
"There are 4 types of options available: ticket, website, role, sub-panel",
|
||||
"",
|
||||
"TIP: Create new options by copying everything between and including the {...} brackets of an option. Paste it after the last option and make sure that they are seperated by a comma."
|
||||
].join("\n")),new fjs.ArrayFormatter(null,true,new fjs.ObjectSwitchFormatter(null,[
|
||||
{key:"type",value:"ticket",formatter:new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.MultiCommentFormatter("A ticket option creates a button to open a ticket."),
|
||||
new fjs.PropertyFormatter("id"),
|
||||
new fjs.PropertyFormatter("name"),
|
||||
new fjs.PropertyFormatter("description",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("type"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ObjectFormatter("button",true,[
|
||||
new fjs.MultiCommentFormatter("Configure the button style of this option. At least one of \"emoji\" or \"label\" must be provided."),
|
||||
new fjs.PropertyFormatter("emoji"),
|
||||
new fjs.PropertyFormatter("label"),
|
||||
new fjs.PropertyFormatter("color"),
|
||||
new fjs.PropertyFormatter("color",new fjs.SingleCommentFormatter("Choices: gray, red, green, blue")),
|
||||
]),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.MultiCommentFormatter("Add up to 5 modal questions IDs from (config/questions.jsonc)."),
|
||||
new fjs.ArrayFormatter("questions",false,new fjs.PropertyFormatter(null)),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ArrayFormatter("ticketAdmins",false,new fjs.PropertyFormatter(null)),
|
||||
new fjs.ArrayFormatter("readonlyAdmins",false,new fjs.PropertyFormatter(null)),
|
||||
new fjs.PropertyFormatter("allowCreationByBlacklistedUsers"),
|
||||
new fjs.ArrayFormatter("questions",false,new fjs.PropertyFormatter(null)),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ObjectFormatter("channel",true,[
|
||||
new fjs.MultiCommentFormatter("Configure the name, topic and category of the ticket option."),
|
||||
new fjs.PropertyFormatter("prefix"),
|
||||
new fjs.PropertyFormatter("suffix"),
|
||||
new fjs.PropertyFormatter("category"),
|
||||
new fjs.PropertyFormatter("backupCategory"),
|
||||
new fjs.PropertyFormatter("closedCategory"),
|
||||
new fjs.ArrayFormatter("claimedCategory",true,new fjs.ObjectFormatter(null,false,[
|
||||
new fjs.PropertyFormatter("user"),
|
||||
new fjs.PropertyFormatter("category"),
|
||||
])),
|
||||
new fjs.PropertyFormatter("topic"),
|
||||
new fjs.PropertyFormatter("suffix",new fjs.SingleCommentFormatter("Choices: user-name, user-id, random-number, random-hex, counter-dynamic, counter-fixed")),
|
||||
new fjs.PropertyFormatter("category",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("topic",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
]),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ObjectFormatter("dmMessage",true,[
|
||||
new fjs.MultiCommentFormatter("Send a customisable message in DM when creating a ticket."),
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("text"),
|
||||
new fjs.PropertyFormatter("text",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.ObjectFormatter("embed",true,[
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("title"),
|
||||
new fjs.PropertyFormatter("description"),
|
||||
new fjs.PropertyFormatter("customColor"),
|
||||
new fjs.PropertyFormatter("title",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("description",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("customColor",new fjs.SingleCommentFormatter("Leave empty to use default color")),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("image"),
|
||||
new fjs.PropertyFormatter("thumbnail"),
|
||||
new fjs.PropertyFormatter("image",new fjs.SingleCommentFormatter("Image URL. Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("thumbnail",new fjs.SingleCommentFormatter("Image URL. Leave empty to disable")),
|
||||
new fjs.MultiCommentFormatter("Embed fields. Set to empty list [] to disable."),
|
||||
new fjs.ArrayFormatter("fields",true,new fjs.ObjectFormatter(null,false,[
|
||||
new fjs.PropertyFormatter("name"),
|
||||
new fjs.PropertyFormatter("value"),
|
||||
@@ -240,16 +349,18 @@ export const defaultOptionsFormatter = new fjs.ArrayFormatter(null,true,new fjs.
|
||||
]),
|
||||
]),
|
||||
new fjs.ObjectFormatter("ticketMessage",true,[
|
||||
new fjs.MultiCommentFormatter("Send a customisable message in the ticket with close, claim, delete, ... buttons."),
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("text"),
|
||||
new fjs.PropertyFormatter("text",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.ObjectFormatter("embed",true,[
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("title"),
|
||||
new fjs.PropertyFormatter("description"),
|
||||
new fjs.PropertyFormatter("customColor"),
|
||||
new fjs.PropertyFormatter("title",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("description",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("customColor",new fjs.SingleCommentFormatter("Leave empty to use default color")),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("image"),
|
||||
new fjs.PropertyFormatter("thumbnail"),
|
||||
new fjs.PropertyFormatter("image",new fjs.SingleCommentFormatter("Image URL. Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("thumbnail",new fjs.SingleCommentFormatter("Image URL. Leave empty to disable")),
|
||||
new fjs.MultiCommentFormatter("Embed fields. Set to empty list [] to disable."),
|
||||
new fjs.ArrayFormatter("fields",true,new fjs.ObjectFormatter(null,false,[
|
||||
new fjs.PropertyFormatter("name"),
|
||||
new fjs.PropertyFormatter("value"),
|
||||
@@ -258,44 +369,52 @@ export const defaultOptionsFormatter = new fjs.ArrayFormatter(null,true,new fjs.
|
||||
new fjs.PropertyFormatter("timestamp"),
|
||||
]),
|
||||
new fjs.ObjectFormatter("ping",true,[
|
||||
new fjs.MultiCommentFormatter("Customise the user & role mentions of this ticket message."),
|
||||
new fjs.PropertyFormatter("@here"),
|
||||
new fjs.PropertyFormatter("@everyone"),
|
||||
new fjs.ArrayFormatter("custom",true,new fjs.PropertyFormatter(null)),
|
||||
new fjs.ArrayFormatter("custom",false,new fjs.PropertyFormatter(null)),
|
||||
]),
|
||||
]),
|
||||
new fjs.ObjectFormatter("autoclose",true,[
|
||||
new fjs.MultiCommentFormatter("Autoclose this ticket after a period of inactivity or when the creator leaves the server."),
|
||||
new fjs.PropertyFormatter("enableInactiveHours"),
|
||||
new fjs.PropertyFormatter("inactiveHours"),
|
||||
new fjs.PropertyFormatter("enableUserLeave"),
|
||||
new fjs.PropertyFormatter("disableOnClaim"),
|
||||
]),
|
||||
new fjs.ObjectFormatter("autodelete",true,[
|
||||
new fjs.MultiCommentFormatter("Autodelete this ticket after a period of inactivity or when the creator leaves the server."),
|
||||
new fjs.PropertyFormatter("enableInactiveDays"),
|
||||
new fjs.PropertyFormatter("inactiveDays"),
|
||||
new fjs.PropertyFormatter("enableUserLeave"),
|
||||
new fjs.PropertyFormatter("disableOnClaim"),
|
||||
]),
|
||||
new fjs.ObjectFormatter("cooldown",true,[
|
||||
new fjs.MultiCommentFormatter("Users must wait a certain period before being able to create another ticket of this type."),
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("cooldownMinutes"),
|
||||
]),
|
||||
new fjs.ObjectFormatter("limits",true,[
|
||||
new fjs.MultiCommentFormatter("Set the maximum amount of simultaneous tickets of this option."),
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("globalMaximum"),
|
||||
new fjs.PropertyFormatter("userMaximum"),
|
||||
]),
|
||||
new fjs.ObjectFormatter("slowMode",true,[
|
||||
new fjs.MultiCommentFormatter("Enable slow-mode in the ticket channel."),
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("slowModeSeconds"),
|
||||
]),
|
||||
])},
|
||||
{key:"type",value:"website",formatter:new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.MultiCommentFormatter("A website option creates a button with a URL to an external website."),
|
||||
new fjs.PropertyFormatter("id"),
|
||||
new fjs.PropertyFormatter("name"),
|
||||
new fjs.PropertyFormatter("description"),
|
||||
new fjs.PropertyFormatter("description",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("type"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ObjectFormatter("button",true,[
|
||||
new fjs.MultiCommentFormatter("Configure the button style of this option. At least one of \"emoji\" or \"label\" must be provided."),
|
||||
new fjs.PropertyFormatter("emoji"),
|
||||
new fjs.PropertyFormatter("label"),
|
||||
]),
|
||||
@@ -303,43 +422,75 @@ export const defaultOptionsFormatter = new fjs.ArrayFormatter(null,true,new fjs.
|
||||
new fjs.PropertyFormatter("url"),
|
||||
])},
|
||||
{key:"type",value:"role",formatter:new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.MultiCommentFormatter("A reaction-role option creates a button for members to choose roles."),
|
||||
new fjs.PropertyFormatter("id"),
|
||||
new fjs.PropertyFormatter("name"),
|
||||
new fjs.PropertyFormatter("description"),
|
||||
new fjs.PropertyFormatter("description",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("type"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ObjectFormatter("button",true,[
|
||||
new fjs.MultiCommentFormatter("Configure the button style of this option. At least one of \"emoji\" or \"label\" must be provided."),
|
||||
new fjs.PropertyFormatter("emoji"),
|
||||
new fjs.PropertyFormatter("label"),
|
||||
new fjs.PropertyFormatter("color"),
|
||||
new fjs.PropertyFormatter("color",new fjs.SingleCommentFormatter("Choices: gray, red, green, blue")),
|
||||
]),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ArrayFormatter("roles",false,new fjs.PropertyFormatter(null)),
|
||||
new fjs.PropertyFormatter("mode"),
|
||||
new fjs.ArrayFormatter("removeRolesOnAdd",false,new fjs.PropertyFormatter(null)),
|
||||
new fjs.PropertyFormatter("addOnMemberJoin"),
|
||||
new fjs.PropertyFormatter("mode",new fjs.SingleCommentFormatter("What to do with the roles. Choices: add&remove, add, remove")),
|
||||
new fjs.ArrayFormatter("removeRolesOnAdd",false,new fjs.PropertyFormatter(null),undefined,undefined,new fjs.SingleCommentFormatter("Remove these old roles when new roles are added.")),
|
||||
new fjs.PropertyFormatter("addOnMemberJoin",new fjs.SingleCommentFormatter("Add these roles automatically when joining the server.")),
|
||||
])},
|
||||
{key:"type",value:"sub-panel",formatter:new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.MultiCommentFormatter("A sub-panel option creates a button which sends another panel for additional options."),
|
||||
new fjs.PropertyFormatter("id"),
|
||||
new fjs.PropertyFormatter("name"),
|
||||
new fjs.PropertyFormatter("description",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("type"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.ObjectFormatter("button",true,[
|
||||
new fjs.MultiCommentFormatter("Configure the button style of this option. At least one of \"emoji\" or \"label\" must be provided."),
|
||||
new fjs.PropertyFormatter("emoji"),
|
||||
new fjs.PropertyFormatter("label"),
|
||||
new fjs.PropertyFormatter("color",new fjs.SingleCommentFormatter("Choices: gray, red, green, blue")),
|
||||
]),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("subPanelId",new fjs.SingleCommentFormatter("Choose a panel ID from (config/panels.jsonc)")),
|
||||
])}
|
||||
]))
|
||||
])))
|
||||
|
||||
export const defaultPanelsFormatter = new fjs.ArrayFormatter(null,true,new fjs.ObjectFormatter(null,true,[
|
||||
export const defaultPanelsFormatter = new fjs.TopLevelCommentFormatter(new fjs.MultiCommentFormatter([
|
||||
"OPEN TICKET PANELS",
|
||||
"----------------------------------------------",
|
||||
"Create customizable panel messages with buttons or a dropdown.",
|
||||
"Add up to 25 options to this panel from (config/options.jsonc)",
|
||||
"Panels can be customised with text, images, colors and more.",
|
||||
"",
|
||||
"Spawn the panel in Discord using: /panel <id>",
|
||||
"",
|
||||
"TIP: Create new panels by copying everything between and including the {...} brackets of an panel. Paste it after the last panel and make sure that they are seperated by a comma."
|
||||
].join("\n")),new fjs.ArrayFormatter(null,true,new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.MultiCommentFormatter("A panel is creates a message with up to 25 options as buttons or dropdown."),
|
||||
new fjs.PropertyFormatter("id"),
|
||||
new fjs.PropertyFormatter("name"),
|
||||
new fjs.PropertyFormatter("dropdown"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.MultiCommentFormatter("Add up to 5 option IDs from (config/options.jsonc)."),
|
||||
new fjs.ArrayFormatter("options",false,new fjs.PropertyFormatter(null)),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("text"),
|
||||
new fjs.PropertyFormatter("text",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.ObjectFormatter("embed",true,[
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.PropertyFormatter("title"),
|
||||
new fjs.PropertyFormatter("description"),
|
||||
new fjs.PropertyFormatter("title",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("description",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("customColor"),
|
||||
new fjs.PropertyFormatter("url"),
|
||||
new fjs.PropertyFormatter("customColor",new fjs.SingleCommentFormatter("Leave empty to use default color")),
|
||||
new fjs.PropertyFormatter("url",new fjs.SingleCommentFormatter("URL. Leave empty to disable")),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("image"),
|
||||
new fjs.PropertyFormatter("thumbnail"),
|
||||
new fjs.PropertyFormatter("image",new fjs.SingleCommentFormatter("Image URL. Leave empty to disable")),
|
||||
new fjs.PropertyFormatter("thumbnail",new fjs.SingleCommentFormatter("Image URL. Leave empty to disable")),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("footer"),
|
||||
new fjs.PropertyFormatter("footer",new fjs.SingleCommentFormatter("Leave empty to disable")),
|
||||
new fjs.MultiCommentFormatter("Embed fields. Set to empty list [] to disable."),
|
||||
new fjs.ArrayFormatter("fields",true,new fjs.ObjectFormatter(null,false,[
|
||||
new fjs.PropertyFormatter("name"),
|
||||
new fjs.PropertyFormatter("value"),
|
||||
@@ -348,53 +499,70 @@ export const defaultPanelsFormatter = new fjs.ArrayFormatter(null,true,new fjs.O
|
||||
new fjs.PropertyFormatter("timestamp"),
|
||||
]),
|
||||
new fjs.ObjectFormatter("settings",true,[
|
||||
new fjs.PropertyFormatter("dropdownPlaceholder"),
|
||||
new fjs.PropertyFormatter("dropdownPlaceholder",new fjs.SingleCommentFormatter("Leave empty to use default.")),
|
||||
new fjs.PropertyFormatter("maximumButtonsPerRow"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.MultiCommentFormatter("Display the maximum amount of tickets per user."),
|
||||
new fjs.PropertyFormatter("enableMaxTicketsWarningInText"),
|
||||
new fjs.PropertyFormatter("enableMaxTicketsWarningInEmbed"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("describeOptionsLayout"),
|
||||
new fjs.MultiCommentFormatter("Automatically generate option descriptions from (config/options.jsonc)."),
|
||||
new fjs.PropertyFormatter("describeOptionsLayout",new fjs.SingleCommentFormatter("Choices: simple, normal, detailed")),
|
||||
new fjs.PropertyFormatter("describeOptionsCustomTitle"),
|
||||
new fjs.PropertyFormatter("describeOptionsInText"),
|
||||
new fjs.PropertyFormatter("describeOptionsInEmbedFields"),
|
||||
new fjs.PropertyFormatter("describeOptionsInEmbedDescription"),
|
||||
]),
|
||||
]))
|
||||
])))
|
||||
|
||||
export const defaultTranscriptsFormatter = new fjs.ObjectFormatter(null,true,[
|
||||
export const defaultTranscriptsFormatter = new fjs.TopLevelCommentFormatter(new fjs.MultiCommentFormatter([
|
||||
"OPEN TICKET TRANSCRIPTS",
|
||||
"----------------------------------------------",
|
||||
"Enable transcript creation when tickets are deleted. There are 2 available transcript types: HTML & Text",
|
||||
"",
|
||||
"HTML Transcripts (recommended):",
|
||||
"Generate transcripts as HTML files to view in the browser. No server or domain required. HTML Transcripts use an external service to process and host the transcripts.",
|
||||
"",
|
||||
"Text Transcripts:",
|
||||
"Generate transcripts as simple .txt files with limited details. Processing happens fully local.",
|
||||
].join("\n")),new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.ObjectFormatter("general",true,[
|
||||
new fjs.PropertyFormatter("enabled"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.MultiCommentFormatter("Choose which users and channel get the generated transcript."),
|
||||
new fjs.PropertyFormatter("enableChannel"),
|
||||
new fjs.PropertyFormatter("enableCreatorDM"),
|
||||
new fjs.PropertyFormatter("enableParticipantDM"),
|
||||
new fjs.PropertyFormatter("enableActiveAdminDM"),
|
||||
new fjs.PropertyFormatter("enableEveryAdminDM"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("channel"),
|
||||
new fjs.PropertyFormatter("mode"),
|
||||
new fjs.PropertyFormatter("channel",new fjs.SingleCommentFormatter("Where to send transcripts. Leave empty when disabled.")),
|
||||
new fjs.PropertyFormatter("mode",new fjs.SingleCommentFormatter("The type of transcript to use. Choices: html, text")),
|
||||
]),
|
||||
new fjs.ObjectFormatter("embedSettings",true,[
|
||||
new fjs.PropertyFormatter("customColor"),
|
||||
new fjs.MultiCommentFormatter("Customise the embed which contains the generated transcript file or URL."),
|
||||
new fjs.PropertyFormatter("customColor",new fjs.SingleCommentFormatter("Leave empty to use default color")),
|
||||
new fjs.PropertyFormatter("listAllParticipants"),
|
||||
new fjs.PropertyFormatter("includeTicketStats"),
|
||||
]),
|
||||
new fjs.ObjectFormatter("textTranscriptStyle",true,[
|
||||
new fjs.PropertyFormatter("layout"),
|
||||
new fjs.MultiCommentFormatter("Customise layout of the text transcripts."),
|
||||
new fjs.PropertyFormatter("layout",new fjs.SingleCommentFormatter("Choices: simple, normal, detailed")),
|
||||
new fjs.PropertyFormatter("includeStats"),
|
||||
new fjs.PropertyFormatter("includeIds"),
|
||||
new fjs.PropertyFormatter("includeEmbeds"),
|
||||
new fjs.PropertyFormatter("includeFiles"),
|
||||
new fjs.PropertyFormatter("includeBotMessages"),
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("fileMode"),
|
||||
new fjs.PropertyFormatter("customFileName"),
|
||||
new fjs.PropertyFormatter("fileMode",new fjs.SingleCommentFormatter("How to name the transcript file? Choices: custom, channel-name, channel-id, user-name, user-id")),
|
||||
new fjs.PropertyFormatter("customFileName",new fjs.SingleCommentFormatter("Custom filename without extension")),
|
||||
]),
|
||||
new fjs.ObjectFormatter("htmlTranscriptStyle",true,[
|
||||
new fjs.MultiCommentFormatter("Customise layout of the HTML transcripts."),
|
||||
new fjs.ObjectFormatter("background",true,[
|
||||
new fjs.PropertyFormatter("enableCustomBackground"),
|
||||
new fjs.PropertyFormatter("backgroundColor"),
|
||||
new fjs.PropertyFormatter("backgroundImage"),
|
||||
new fjs.PropertyFormatter("backgroundColor",new fjs.SingleCommentFormatter("Leave empty to use Open Ticket color (#f8ba00)")),
|
||||
new fjs.PropertyFormatter("backgroundImage",new fjs.SingleCommentFormatter("Image URL to fill entire background. Leave empty to disable")),
|
||||
]),
|
||||
new fjs.ObjectFormatter("header",true,[
|
||||
new fjs.PropertyFormatter("enableCustomHeader"),
|
||||
@@ -415,4 +583,4 @@ export const defaultTranscriptsFormatter = new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.PropertyFormatter("imageUrl"),
|
||||
]),
|
||||
]),
|
||||
])
|
||||
]))
|
||||
@@ -1,6 +1,6 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllCooldowns = async () => {
|
||||
export async function loadAllCooldowns(){
|
||||
await opendiscord.options.loopAll((option) => {
|
||||
if (!(option instanceof api.ODTicketOption)) return
|
||||
loadTicketOptionCooldown(option)
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
import * as fjs from "formatted-json-stringify"
|
||||
|
||||
const devdatabaseFlag = opendiscord.flags.get("opendiscord:dev-database")
|
||||
const isDevdatabase = devdatabaseFlag ? devdatabaseFlag.value : false
|
||||
|
||||
export const loadAllDatabases = async () => {
|
||||
export async function loadAllDatabases(){
|
||||
opendiscord.databases.add(defaultGlobalDatabase)
|
||||
opendiscord.databases.add(defaultStatsDatabase)
|
||||
opendiscord.databases.add(defaultTicketsDatabase)
|
||||
opendiscord.databases.add(defaultUsersDatabase)
|
||||
opendiscord.databases.add(defaultOptionsDatabase)
|
||||
opendiscord.databases.add(defaultMessageStatesDatabase)
|
||||
}
|
||||
|
||||
const defaultInlineFormatter = new fjs.ArrayFormatter(null,true,new fjs.ObjectFormatter(null,false,[
|
||||
@@ -46,8 +47,9 @@ const defaultOptionFormatter = new fjs.ArrayFormatter(null,true,new fjs.ObjectFo
|
||||
])
|
||||
]))
|
||||
|
||||
export const defaultGlobalDatabase = new api.ODFormattedJsonDatabase("opendiscord:global","global.json",defaultInlineFormatter,(isDevdatabase) ? "./devdatabase/" : "./database/")
|
||||
export const defaultStatsDatabase = new api.ODFormattedJsonDatabase("opendiscord:stats","stats.json",defaultInlineFormatter,(isDevdatabase) ? "./devdatabase/" : "./database/")
|
||||
export const defaultTicketsDatabase = new api.ODFormattedJsonDatabase("opendiscord:tickets","tickets.json",defaultTicketFormatter,(isDevdatabase) ? "./devdatabase/" : "./database/")
|
||||
export const defaultUsersDatabase = new api.ODFormattedJsonDatabase("opendiscord:users","users.json",defaultInlineFormatter,(isDevdatabase) ? "./devdatabase/" : "./database/")
|
||||
export const defaultOptionsDatabase = new api.ODFormattedJsonDatabase("opendiscord:options","options.json",defaultOptionFormatter,(isDevdatabase) ? "./devdatabase/" : "./database/")
|
||||
export const defaultGlobalDatabase = new api.ODGlobalDatabase("opendiscord:global","global.json",defaultInlineFormatter,(isDevdatabase) ? "./devdatabase/" : "./database/")
|
||||
export const defaultStatsDatabase = new api.ODStatsDatabase("opendiscord:stats","stats.json",defaultInlineFormatter,(isDevdatabase) ? "./devdatabase/" : "./database/")
|
||||
export const defaultTicketsDatabase = new api.ODTicketsDatabase("opendiscord:tickets","tickets.json",defaultTicketFormatter,(isDevdatabase) ? "./devdatabase/" : "./database/")
|
||||
export const defaultUsersDatabase = new api.ODUsersDatabase("opendiscord:users","users.json",defaultInlineFormatter,(isDevdatabase) ? "./devdatabase/" : "./database/")
|
||||
export const defaultOptionsDatabase = new api.ODOptionsDatabase("opendiscord:options","options.json",defaultOptionFormatter,(isDevdatabase) ? "./devdatabase/" : "./database/")
|
||||
export const defaultMessageStatesDatabase = new api.ODMessageStatesDatabase("opendiscord:message-states","states.json",defaultInlineFormatter,(isDevdatabase) ? "./devdatabase/" : "./database/")
|
||||
@@ -1,7 +1,7 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllEvents = () => {
|
||||
const eventList: (keyof api.ODEventIds_Default)[] = [
|
||||
const eventList: (keyof api.ODNoGeneric<api.ODEventManagerIdMappings>)[] = [
|
||||
//error handling
|
||||
"onErrorHandling",
|
||||
"afterErrorHandling",
|
||||
@@ -96,6 +96,12 @@ export const loadAllEvents = () => {
|
||||
"onTextCommandLoad",
|
||||
"afterTextCommandsLoaded",
|
||||
|
||||
//states
|
||||
"onStateLoad",
|
||||
"afterStatesLoaded",
|
||||
"onStateInit",
|
||||
"afterStatesInitiated",
|
||||
|
||||
//plugin loading before managers
|
||||
"onPluginBeforeManagerLoad",
|
||||
"afterPluginBeforeManagerLoaded",
|
||||
@@ -206,6 +212,16 @@ export const loadAllEvents = () => {
|
||||
"onModalBuilderLoad",
|
||||
"afterModalBuildersLoaded",
|
||||
|
||||
//components
|
||||
"onSharedComponentLoad",
|
||||
"afterSharedComponentsLoaded",
|
||||
"onMessageComponentLoad",
|
||||
"afterMessageComponentsLoaded",
|
||||
"onModalComponentLoad",
|
||||
"afterModalComponentsLoaded",
|
||||
"onComponentModifierLoad",
|
||||
"afterComponentModifiersLoaded",
|
||||
|
||||
//plugin loading before responders
|
||||
"onPluginBeforeResponderLoad",
|
||||
"afterPluginBeforeResponderLoaded",
|
||||
@@ -258,13 +274,13 @@ export const loadAllEvents = () => {
|
||||
"onHelpMenuComponentLoad",
|
||||
"afterHelpMenuComponentsLoaded",
|
||||
|
||||
//stats
|
||||
"onStatScopeLoad",
|
||||
"afterStatScopesLoaded",
|
||||
"onStatLoad",
|
||||
"afterStatsLoaded",
|
||||
"onStatInit",
|
||||
"afterStatsInitiated",
|
||||
//statistics
|
||||
"onStatisticScopeLoad",
|
||||
"afterStatisticScopesLoaded",
|
||||
"onStatisticLoad",
|
||||
"afterStatisticsLoaded",
|
||||
"onStatisticInit",
|
||||
"afterStatisticsInitiated",
|
||||
|
||||
//plugin loading before code
|
||||
"onPluginBeforeCodeLoad",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllFlags = async () => {
|
||||
export async function loadAllFlags(){
|
||||
opendiscord.flags.add(new api.ODFlag("opendiscord:no-migration","No Migration","Disable Open Ticket data migration on update!","--no-migration",["-nm"]))
|
||||
opendiscord.flags.add(new api.ODFlag("opendiscord:dev-config","Developer Config","Use the configs in /devconfig/ instead of /config/!","--dev-config",["-dc"]))
|
||||
opendiscord.flags.add(new api.ODFlag("opendiscord:dev-database","Developer Database","Use the databases in /devdatabase/ instead of /database/!","--dev-database",["-dd"]))
|
||||
|
||||
@@ -1,18 +1,8 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
const lang = opendiscord.languages
|
||||
|
||||
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW COMMANDS?
|
||||
* - Register the command in loadAllSlashCommands() & loadAllTextCommands() in (./src/data/framework/commandLoader.ts)
|
||||
* - Add autocomplete for the command in OD(Slash/Text)CommandManagerIds_Default in (./src/core/api/defaults/client.ts)
|
||||
* - Add the command to the help menu in (./src/data/framework/helpMenuLoader.ts)
|
||||
* - If required, new config variables should be added (incl. logs, dm-logs & permissions).
|
||||
* - Update the Open Ticket Documentation.
|
||||
* - If the command contains complex logic or can be executed from a button/dropdown, it should be placed inside an `ODAction`.
|
||||
* - Check all files, test the bot carefully & try a lot of different scenario's with different settings.
|
||||
*/
|
||||
|
||||
export const loadAllHelpMenuCategories = async () => {
|
||||
export async function loadAllHelpMenuCategories(){
|
||||
const helpmenu = opendiscord.helpmenu
|
||||
|
||||
helpmenu.add(new api.ODHelpMenuCategory("opendiscord:general",5,utilities.emojiTitle("📎",lang.getTranslation("helpMenu.categories.general"))))
|
||||
@@ -24,17 +14,17 @@ export const loadAllHelpMenuCategories = async () => {
|
||||
helpmenu.add(new api.ODHelpMenuCategory("opendiscord:extra",0,utilities.emojiTitle("✨",lang.getTranslation("helpMenu.categories.extra"))))
|
||||
}
|
||||
|
||||
export const loadAllHelpMenuComponents = async () => {
|
||||
export async function loadAllHelpMenuComponents(){
|
||||
const helpmenu = opendiscord.helpmenu
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
if (!generalConfig) return
|
||||
|
||||
const prefix = generalConfig.data.prefix
|
||||
const enableDeleteWithoutTranscript = generalConfig.data.system.enableDeleteWithoutTranscript
|
||||
const enableDeleteWithoutTranscript = generalConfig.data.ticketSystem.enableDeleteWithoutTranscript
|
||||
|
||||
const allowedCommands: string[] = []
|
||||
for (const key in generalConfig.data.system.permissions){
|
||||
if (generalConfig.data.system.permissions[key] != "none") allowedCommands.push(key)
|
||||
for (const key in generalConfig.data.permissions){
|
||||
if (generalConfig.data.permissions[key] != "none") allowedCommands.push(key)
|
||||
}
|
||||
|
||||
const general = helpmenu.get("opendiscord:general")
|
||||
|
||||
@@ -1,131 +1,44 @@
|
||||
import { opendiscord, api, utilities } from "../../index";
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW LANGUAGES?
|
||||
* - Add the file to (./languages/) and make sure the metadata is valid.
|
||||
* - Register the language in loadAllLanguages() in (./src/data/framework/languageLoader.ts).
|
||||
* - Add autocomplete for the language in ODLanguageManagerIds_Default in (./src/core/api/defaults/language.ts).
|
||||
* - Update the language list in the README.md translator list.
|
||||
* - Update the 2 language counters in the README.md features list.
|
||||
* - Update the Open Ticket Documentation.
|
||||
*/
|
||||
|
||||
export const loadAllLanguages = async () => {
|
||||
//register languages
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:custom", "custom.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:english", "english.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:dutch", "dutch.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:portuguese", "portuguese.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:czech", "czech.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:german", "german.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:catalan", "catalan.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:hungarian", "hungarian.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:spanish", "spanish.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:romanian", "romanian.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:ukrainian", "ukrainian.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:indonesian", "indonesian.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:italian", "italian.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:estonian", "estonian.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:finnish", "finnish.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:danish", "danish.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:thai", "thai.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:turkish", "turkish.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:french", "french.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:arabic", "arabic.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:hindi", "hindi.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:lithuanian", "lithuanian.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:polish", "polish.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:latvian", "latvian.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:norwegian", "norwegian.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:russian", "russian.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:swedish", "swedish.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:vietnamese", "vietnamese.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:persian", "persian.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:bengali", "bengali.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:greek", "greek.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:japanese", "japanese.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:khmer", "khmer.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:korean", "korean.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:kurdish", "kurdish.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage(
|
||||
"opendiscord:simplified-chinese",
|
||||
"simplified-chinese.json",
|
||||
),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:slovenian", "slovenian.json"),
|
||||
);
|
||||
opendiscord.languages.add(
|
||||
new api.ODJsonLanguage("opendiscord:tamil", "tamil.json"),
|
||||
);
|
||||
};
|
||||
export async function loadAllLanguages(){
|
||||
//register languages
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:custom","custom.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:english","english.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:dutch","dutch.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:portuguese","portuguese.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:czech","czech.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:german","german.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:catalan","catalan.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:hungarian","hungarian.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:spanish","spanish.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:romanian","romanian.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:ukrainian","ukrainian.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:indonesian","indonesian.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:italian","italian.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:estonian","estonian.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:finnish","finnish.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:danish","danish.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:thai","thai.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:turkish","turkish.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:french","french.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:arabic","arabic.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:hindi","hindi.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:lithuanian","lithuanian.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:polish","polish.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:latvian","latvian.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:norwegian","norwegian.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:russian","russian.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:swedish","swedish.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:vietnamese","vietnamese.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:persian","persian.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:bengali","bengali.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:greek","greek.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:japanese","japanese.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:korean","korean.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:kurdish","kurdish.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:simplified-chinese","simplified-chinese.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:traditional-chinese","traditional-chinese.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:slovenian","slovenian.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:tamil","tamil.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:khmer","khmer.json"))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllLiveStatusSources = async () => {
|
||||
export async function loadAllLiveStatusSources(){
|
||||
//DEFAULT DJDJ DEV
|
||||
opendiscord.livestatus.add(new api.ODLiveStatusUrlSource("opendiscord:default-djdj-dev","https://raw.githubusercontent.com/open-discord-bots/open-ticket/refs/heads/dev/src/livestatus.json"))
|
||||
opendiscord.livestatus.add(new api.ODLiveStatusUrlSource(opendiscord,"opendiscord:default-djdj-dev","https://raw.githubusercontent.com/open-discord-bots/open-ticket/refs/heads/dev/src/livestatus.json"))
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
export const loadAllPermissions = async () => {
|
||||
export async function loadAllPermissions(){
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
if (!generalConfig) return
|
||||
const mainServer = opendiscord.client.mainServer
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllPosts = async () => {
|
||||
export async function loadAllPosts(){
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
if (!generalConfig) return
|
||||
const transcriptConfig = opendiscord.configs.get("opendiscord:transcripts")
|
||||
if (!transcriptConfig) return
|
||||
|
||||
//LOGS CHANNEL
|
||||
if (generalConfig.data.system.logs.enabled) opendiscord.posts.add(new api.ODPost("opendiscord:logs",generalConfig.data.system.logs.channel))
|
||||
if (generalConfig.data.logs.enabled) opendiscord.posts.add(new api.ODPost("opendiscord:logs",generalConfig.data.logs.channel))
|
||||
|
||||
//TRANSCRIPTS CHANNEL
|
||||
if (transcriptConfig.data.general.enabled && transcriptConfig.data.general.enableChannel) opendiscord.posts.add(new api.ODPost("opendiscord:transcripts",transcriptConfig.data.general.channel))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllProgressBarRenderers = async () => {
|
||||
const defaultSettings: api.ODProgressBarRenderer_DefaultSettings = {
|
||||
export async function loadAllProgressBarRenderers(){
|
||||
const defaultSettings: api.ODDefaultProgressBarRendererSettings = {
|
||||
borderColor:"gray",
|
||||
filledBarColor:"openticket",
|
||||
emptyBarColor:"gray",
|
||||
@@ -23,37 +23,37 @@ export const loadAllProgressBarRenderers = async () => {
|
||||
}
|
||||
|
||||
//VALUE RENDERER
|
||||
const valueRendererSettings: api.ODProgressBarRenderer_DefaultSettings = {...defaultSettings}
|
||||
const valueRendererSettings: api.ODDefaultProgressBarRendererSettings = {...defaultSettings}
|
||||
valueRendererSettings.labelType = "value"
|
||||
opendiscord.progressbars.renderers.add(new api.ODProgressBarRenderer_Default("opendiscord:value-renderer",valueRendererSettings))
|
||||
opendiscord.progressbars.renderers.add(new api.ODDefaultProgressBarRenderer("opendiscord:value-renderer",valueRendererSettings))
|
||||
|
||||
//FRACTION RENDERER
|
||||
const fractionRendererSettings: api.ODProgressBarRenderer_DefaultSettings = {...defaultSettings}
|
||||
const fractionRendererSettings: api.ODDefaultProgressBarRendererSettings = {...defaultSettings}
|
||||
fractionRendererSettings.labelType = "fraction"
|
||||
opendiscord.progressbars.renderers.add(new api.ODProgressBarRenderer_Default("opendiscord:fraction-renderer",fractionRendererSettings))
|
||||
opendiscord.progressbars.renderers.add(new api.ODDefaultProgressBarRenderer("opendiscord:fraction-renderer",fractionRendererSettings))
|
||||
|
||||
//PERCENTAGE RENDERER
|
||||
const percentageRendererSettings: api.ODProgressBarRenderer_DefaultSettings = {...defaultSettings}
|
||||
const percentageRendererSettings: api.ODDefaultProgressBarRendererSettings = {...defaultSettings}
|
||||
percentageRendererSettings.labelType = "percentage"
|
||||
opendiscord.progressbars.renderers.add(new api.ODProgressBarRenderer_Default("opendiscord:percentage-renderer",percentageRendererSettings))
|
||||
opendiscord.progressbars.renderers.add(new api.ODDefaultProgressBarRenderer("opendiscord:percentage-renderer",percentageRendererSettings))
|
||||
|
||||
//TIME MS RENDERER
|
||||
const timeMsRendererSettings: api.ODProgressBarRenderer_DefaultSettings = {...defaultSettings}
|
||||
const timeMsRendererSettings: api.ODDefaultProgressBarRendererSettings = {...defaultSettings}
|
||||
timeMsRendererSettings.labelType = "time-ms"
|
||||
opendiscord.progressbars.renderers.add(new api.ODProgressBarRenderer_Default("opendiscord:time-ms-renderer",timeMsRendererSettings))
|
||||
opendiscord.progressbars.renderers.add(new api.ODDefaultProgressBarRenderer("opendiscord:time-ms-renderer",timeMsRendererSettings))
|
||||
|
||||
//TIME SEC RENDERER
|
||||
const timeSecRendererSettings: api.ODProgressBarRenderer_DefaultSettings = {...defaultSettings}
|
||||
const timeSecRendererSettings: api.ODDefaultProgressBarRendererSettings = {...defaultSettings}
|
||||
timeSecRendererSettings.labelType = "time-sec"
|
||||
opendiscord.progressbars.renderers.add(new api.ODProgressBarRenderer_Default("opendiscord:time-sec-renderer",timeSecRendererSettings))
|
||||
opendiscord.progressbars.renderers.add(new api.ODDefaultProgressBarRenderer("opendiscord:time-sec-renderer",timeSecRendererSettings))
|
||||
|
||||
//TIME MIN RENDERER
|
||||
const timeMinRendererSettings: api.ODProgressBarRenderer_DefaultSettings = {...defaultSettings}
|
||||
const timeMinRendererSettings: api.ODDefaultProgressBarRendererSettings = {...defaultSettings}
|
||||
timeMinRendererSettings.labelType = "time-min"
|
||||
opendiscord.progressbars.renderers.add(new api.ODProgressBarRenderer_Default("opendiscord:time-min-renderer",timeMinRendererSettings))
|
||||
opendiscord.progressbars.renderers.add(new api.ODDefaultProgressBarRenderer("opendiscord:time-min-renderer",timeMinRendererSettings))
|
||||
}
|
||||
|
||||
export const loadAllProgressBars = async () => {
|
||||
export async function loadAllProgressBars(){
|
||||
const fractRenderer = opendiscord.progressbars.renderers.get("opendiscord:fraction-renderer")
|
||||
|
||||
//SLASH COMMAND REMOVE (doesn't have correct amount yet)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
import ansis from "ansis"
|
||||
|
||||
export const loadAllStartScreenComponents = async () => {
|
||||
export async function loadAllStartScreenComponents(){
|
||||
//LOGO
|
||||
opendiscord.startscreen.add(new api.ODStartScreenLogoComponent("opendiscord:logo",1000,[
|
||||
" ██████╗ ██████╗ ███████╗███╗ ██╗ ████████╗██╗ ██████╗██╗ ██╗███████╗████████╗ ",
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export async function loadAllStates(){
|
||||
const stateDatabase = opendiscord.databases.get("opendiscord:message-states")
|
||||
|
||||
opendiscord.states.add(new api.ODInteractiveMessageState("opendiscord:interactive-message",opendiscord.client,stateDatabase))
|
||||
opendiscord.states.add(new api.ODClearMessageState("opendiscord:clear-message",opendiscord.client,stateDatabase))
|
||||
}
|
||||
@@ -1,41 +1,41 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const stats = opendiscord.stats
|
||||
const stats = opendiscord.statistics
|
||||
const lang = opendiscord.languages
|
||||
|
||||
export const loadAllStatScopes = async () => {
|
||||
stats.add(new api.ODStatGlobalScope("opendiscord:global",utilities.emojiTitle("📊",lang.getTranslation("stats.scopes.global"))))
|
||||
stats.add(new api.ODStatGlobalScope("opendiscord:system",utilities.emojiTitle("⚙️",lang.getTranslation("stats.scopes.system"))))
|
||||
stats.add(new api.ODStatScope("opendiscord:user",utilities.emojiTitle("📊",lang.getTranslation("stats.scopes.user"))))
|
||||
stats.add(new api.ODStatScope("opendiscord:ticket",utilities.emojiTitle("📊",lang.getTranslation("stats.scopes.ticket"))))
|
||||
stats.add(new api.ODStatScope("opendiscord:participants",utilities.emojiTitle("👥",lang.getTranslation("stats.scopes.participants"))))
|
||||
stats.add(new api.ODStatScope("opendiscord:messages",utilities.emojiTitle("💬",lang.getTranslation("stats.scopes.messages"))))
|
||||
export async function loadAllStatisticScopes(){
|
||||
stats.add(new api.ODStatisticGlobalScope("opendiscord:global",utilities.emojiTitle("📊",lang.getTranslation("stats.scopes.global"))))
|
||||
stats.add(new api.ODStatisticGlobalScope("opendiscord:system",utilities.emojiTitle("⚙️",lang.getTranslation("stats.scopes.system"))))
|
||||
stats.add(new api.ODStatisticScope("opendiscord:user",utilities.emojiTitle("📊",lang.getTranslation("stats.scopes.user"))))
|
||||
stats.add(new api.ODStatisticScope("opendiscord:ticket",utilities.emojiTitle("📊",lang.getTranslation("stats.scopes.ticket"))))
|
||||
stats.add(new api.ODStatisticScope("opendiscord:participants",utilities.emojiTitle("👥",lang.getTranslation("stats.scopes.participants"))))
|
||||
stats.add(new api.ODStatisticScope("opendiscord:messages",utilities.emojiTitle("💬",lang.getTranslation("stats.scopes.messages"))))
|
||||
}
|
||||
|
||||
export const loadAllStats = async () => {
|
||||
export async function loadAllStatistics(){
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
if (!generalConfig) return
|
||||
|
||||
const global = stats.get("opendiscord:global")
|
||||
if (global){
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-created",13,lang.getTranslation("stats.properties.ticketsCreated"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-closed",12,lang.getTranslation("stats.properties.ticketsClosed"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-deleted",11,lang.getTranslation("stats.properties.ticketsDeleted"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-reopened",10,lang.getTranslation("stats.properties.ticketsReopened"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-autoclosed",9,lang.getTranslation("stats.properties.ticketsAutoclosed"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-autodeleted",8,lang.getTranslation("stats.properties.ticketsAutodeleted"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-claimed",7,lang.getTranslation("stats.properties.ticketsClaimed"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-pinned",6,lang.getTranslation("stats.properties.ticketsPinned"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-moved",5,lang.getTranslation("stats.properties.ticketsMoved"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-transferred",4,lang.getTranslation("stats.properties.ticketsTransferred"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:users-blacklisted",3,lang.getTranslation("stats.properties.usersBlacklisted"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:transcripts-created",2,lang.getTranslation("stats.properties.transcriptsCreated"),0))
|
||||
global.add(new api.ODDynamicStat("opendiscord:ticket-volume",1,() => {
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-created",13,lang.getTranslation("stats.properties.ticketsCreated"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-closed",12,lang.getTranslation("stats.properties.ticketsClosed"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-deleted",11,lang.getTranslation("stats.properties.ticketsDeleted"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-reopened",10,lang.getTranslation("stats.properties.ticketsReopened"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-autoclosed",9,lang.getTranslation("stats.properties.ticketsAutoclosed"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-autodeleted",8,lang.getTranslation("stats.properties.ticketsAutodeleted"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-claimed",7,lang.getTranslation("stats.properties.ticketsClaimed"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-pinned",6,lang.getTranslation("stats.properties.ticketsPinned"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-moved",5,lang.getTranslation("stats.properties.ticketsMoved"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-transferred",4,lang.getTranslation("stats.properties.ticketsTransferred"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:users-blacklisted",3,lang.getTranslation("stats.properties.usersBlacklisted"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:transcripts-created",2,lang.getTranslation("stats.properties.transcriptsCreated"),0))
|
||||
global.add(new api.ODDynamicStatistic("opendiscord:ticket-volume",1,() => {
|
||||
return lang.getTranslation("stats.properties.ticketVolume")+": `"+opendiscord.tickets.getLength()+"`"
|
||||
}))
|
||||
global.add(new api.ODDynamicStat("opendiscord:average-tickets",0,async () => {
|
||||
const userTicketsCreated = await opendiscord.stats.get("opendiscord:user").getAllStats("opendiscord:tickets-created")
|
||||
global.add(new api.ODDynamicStatistic("opendiscord:average-tickets",0,async () => {
|
||||
const userTicketsCreated = await opendiscord.statistics.get("opendiscord:user").getAllStats("opendiscord:tickets-created")
|
||||
const average = userTicketsCreated.map((s) => s.value as number).filter((t) => t > 0).reduce((prev,curr) => prev+curr,0)/userTicketsCreated.length
|
||||
const roundedAverage = Math.round(average*1000)/1000
|
||||
return lang.getTranslation("stats.properties.averageTickets")+": `"+roundedAverage+"`"
|
||||
@@ -44,23 +44,23 @@ export const loadAllStats = async () => {
|
||||
|
||||
const system = stats.get("opendiscord:system")
|
||||
if (system){
|
||||
system.add(new api.ODDynamicStat("opendiscord:startup-date",2,() => {
|
||||
system.add(new api.ODDynamicStatistic("opendiscord:startup-date",2,() => {
|
||||
return lang.getTranslation("params.uppercase.startupDate")+": "+discord.time(opendiscord.processStartupDate,"f")
|
||||
}))
|
||||
system.add(new api.ODDynamicStat("opendiscord:system-uptime",1,() => {
|
||||
system.add(new api.ODDynamicStatistic("opendiscord:system-uptime",1,() => {
|
||||
return lang.getTranslation("params.uppercase.uptime")+": "+discord.time(opendiscord.processStartupDate,"R")
|
||||
}))
|
||||
system.add(new api.ODDynamicStat("opendiscord:version",0,() => {
|
||||
system.add(new api.ODDynamicStatistic("opendiscord:version",0,() => {
|
||||
return lang.getTranslation("params.uppercase.version")+": `"+opendiscord.versions.get("opendiscord:version").toString()+"`"
|
||||
}))
|
||||
}
|
||||
|
||||
const user = stats.get("opendiscord:user")
|
||||
if (user){
|
||||
user.add(new api.ODDynamicStat("opendiscord:name",11,async (scopeId,guild,channel,user) => {
|
||||
user.add(new api.ODDynamicStatistic("opendiscord:name",11,async (scopeId,guild,channel,user) => {
|
||||
return lang.getTranslation("params.uppercase.name")+": "+discord.userMention(scopeId)
|
||||
}))
|
||||
user.add(new api.ODDynamicStat("opendiscord:role",10,async (scopeId,guild,channel,user) => {
|
||||
user.add(new api.ODDynamicStatistic("opendiscord:role",10,async (scopeId,guild,channel,user) => {
|
||||
const scopeMember = await opendiscord.client.fetchGuildMember(guild,scopeId)
|
||||
if (!scopeMember) return ""
|
||||
|
||||
@@ -72,27 +72,27 @@ export const loadAllStats = async () => {
|
||||
if (permissions.type == "support") return lang.getTranslation("params.uppercase.role")+": 💬 `"+lang.getTranslation("stats.roles.support")+"`"
|
||||
else return lang.getTranslation("params.uppercase.role")+": 👤 `"+lang.getTranslation("stats.roles.member")+"`"
|
||||
}))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-created",10,lang.getTranslation("stats.properties.ticketsCreated"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-closed",9,lang.getTranslation("stats.properties.ticketsClosed"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-deleted",8,lang.getTranslation("stats.properties.ticketsDeleted"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-reopened",7,lang.getTranslation("stats.properties.ticketsReopened"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-claimed",6,lang.getTranslation("stats.properties.ticketsClaimed"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-pinned",5,lang.getTranslation("stats.properties.ticketsPinned"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-moved",4,lang.getTranslation("stats.properties.ticketsMoved"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-transferred",3,lang.getTranslation("stats.properties.ticketsTransferred"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:users-blacklisted",2,lang.getTranslation("stats.properties.usersBlacklisted"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:transcripts-created",1,lang.getTranslation("stats.properties.transcriptsCreated"),0))
|
||||
user.add(new api.ODDynamicStat("opendiscord:current-tickets",0,async (scopeId,guild,channel,user) => {
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-created",10,lang.getTranslation("stats.properties.ticketsCreated"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-closed",9,lang.getTranslation("stats.properties.ticketsClosed"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-deleted",8,lang.getTranslation("stats.properties.ticketsDeleted"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-reopened",7,lang.getTranslation("stats.properties.ticketsReopened"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-claimed",6,lang.getTranslation("stats.properties.ticketsClaimed"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-pinned",5,lang.getTranslation("stats.properties.ticketsPinned"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-moved",4,lang.getTranslation("stats.properties.ticketsMoved"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-transferred",3,lang.getTranslation("stats.properties.ticketsTransferred"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:users-blacklisted",2,lang.getTranslation("stats.properties.usersBlacklisted"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:transcripts-created",1,lang.getTranslation("stats.properties.transcriptsCreated"),0))
|
||||
user.add(new api.ODDynamicStatistic("opendiscord:current-tickets",0,async (scopeId,guild,channel,user) => {
|
||||
return lang.getTranslation("stats.properties.currentTickets")+": `"+opendiscord.tickets.getFiltered((t) => t.get("opendiscord:opened-by").value === scopeId).length+"`"
|
||||
}))
|
||||
}
|
||||
|
||||
const ticket = stats.get("opendiscord:ticket")
|
||||
if (ticket){
|
||||
ticket.add(new api.ODDynamicStat("opendiscord:name",5,async (scopeId,guild,channel,user) => {
|
||||
ticket.add(new api.ODDynamicStatistic("opendiscord:name",5,async (scopeId,guild,channel,user) => {
|
||||
return lang.getTranslation("params.uppercase.ticket")+": "+discord.channelMention(scopeId)
|
||||
}))
|
||||
ticket.add(new api.ODDynamicStat("opendiscord:status",4,async (scopeId,guild,channel,user) => {
|
||||
ticket.add(new api.ODDynamicStatistic("opendiscord:status",4,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
@@ -100,35 +100,35 @@ export const loadAllStats = async () => {
|
||||
|
||||
return closed ? lang.getTranslation("params.uppercase.status")+": 🔒 `"+lang.getTranslation("params.uppercase.closed")+"`" : lang.getTranslation("params.uppercase.status")+": 🔓 `"+lang.getTranslation("params.uppercase.open")+"`"
|
||||
}))
|
||||
ticket.add(new api.ODDynamicStat("opendiscord:claimed",3,async (scopeId,guild,channel,user) => {
|
||||
ticket.add(new api.ODDynamicStatistic("opendiscord:claimed",3,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
const claimed = ticket.exists("opendiscord:claimed") ? ticket.get("opendiscord:claimed").value : false
|
||||
return claimed ? lang.getTranslation("params.uppercase.claimed")+": 🟢 `"+lang.getTranslation("params.uppercase.yes")+"`" : lang.getTranslation("params.uppercase.claimed")+": 🔴 `"+lang.getTranslation("params.uppercase.no")+"`"
|
||||
}))
|
||||
ticket.add(new api.ODDynamicStat("opendiscord:pinned",2,async (scopeId,guild,channel,user) => {
|
||||
ticket.add(new api.ODDynamicStatistic("opendiscord:pinned",2,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
const pinned = ticket.exists("opendiscord:pinned") ? ticket.get("opendiscord:pinned").value : false
|
||||
return pinned ? lang.getTranslation("params.uppercase.pinned")+": 🟢 `"+lang.getTranslation("params.uppercase.yes")+"`" : lang.getTranslation("params.uppercase.pinned")+": 🔴 `"+lang.getTranslation("params.uppercase.no")+"`"
|
||||
}))
|
||||
ticket.add(new api.ODDynamicStat("opendiscord:creation-date",1,async (scopeId,guild,channel,user) => {
|
||||
ticket.add(new api.ODDynamicStatistic("opendiscord:creation-date",1,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
const rawDate = ticket.get("opendiscord:opened-on").value ?? new Date().getTime()
|
||||
return lang.getTranslation("params.uppercase.creationDate")+": "+discord.time(new Date(rawDate),"f")
|
||||
}))
|
||||
ticket.add(new api.ODDynamicStat("opendiscord:creator",0,async (scopeId,guild,channel,user) => {
|
||||
ticket.add(new api.ODDynamicStatistic("opendiscord:creator",0,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
const creator = ticket.get("opendiscord:opened-by").value
|
||||
return lang.getTranslation("params.uppercase.creator")+": "+ (creator ? discord.userMention(creator) : "`unknown`")
|
||||
}))
|
||||
ticket.add(new api.ODDynamicStat("opendiscord:ticket-age",-1,async (scopeId,guild,channel,user) => {
|
||||
ticket.add(new api.ODDynamicStatistic("opendiscord:ticket-age",-1,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
@@ -142,7 +142,7 @@ export const loadAllStats = async () => {
|
||||
|
||||
const participants = stats.get("opendiscord:participants")
|
||||
if (participants){
|
||||
participants.add(new api.ODDynamicStat("opendiscord:participants",0,async (scopeId,guild,channel,user) => {
|
||||
participants.add(new api.ODDynamicStatistic("opendiscord:participants",0,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
@@ -157,7 +157,7 @@ export const loadAllStats = async () => {
|
||||
|
||||
const messages = stats.get("opendiscord:messages")
|
||||
if (messages){
|
||||
messages.add(new api.ODDynamicStat("opendiscord:count",0,async (scopeId,guild,channel,user) => {
|
||||
messages.add(new api.ODDynamicStatistic("opendiscord:count",0,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllBlacklistedUsers = async () => {
|
||||
export async function loadAllBlacklistedUsers(){
|
||||
const userDatabase = opendiscord.databases.get("opendiscord:users")
|
||||
if (!userDatabase) return
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllOptions = async () => {
|
||||
export async function loadAllOptions(){
|
||||
const optionConfig = opendiscord.configs.get("opendiscord:options")
|
||||
if (!optionConfig) return
|
||||
|
||||
@@ -54,7 +54,7 @@ export const loadAllOptions = async () => {
|
||||
})
|
||||
}
|
||||
|
||||
export const loadTicketOption = (option:api.ODJsonConfig_DefaultOptionTicketType): api.ODTicketOption => {
|
||||
export const loadTicketOption = (option:api.ODOptionsJsonConfig_TicketOption): api.ODTicketOption => {
|
||||
return new api.ODTicketOption(option.id,[
|
||||
new api.ODOptionData("opendiscord:name",option.name),
|
||||
new api.ODOptionData("opendiscord:description",option.description),
|
||||
@@ -71,9 +71,6 @@ export const loadTicketOption = (option:api.ODJsonConfig_DefaultOptionTicketType
|
||||
new api.ODOptionData("opendiscord:channel-prefix",option.channel.prefix),
|
||||
new api.ODOptionData("opendiscord:channel-suffix",option.channel.suffix),
|
||||
new api.ODOptionData("opendiscord:channel-category",option.channel.category),
|
||||
new api.ODOptionData("opendiscord:channel-category-closed",option.channel.closedCategory),
|
||||
new api.ODOptionData("opendiscord:channel-category-backup",option.channel.backupCategory),
|
||||
new api.ODOptionData("opendiscord:channel-categories-claimed",option.channel.claimedCategory),
|
||||
new api.ODOptionData("opendiscord:channel-topic",option.channel.topic),
|
||||
|
||||
new api.ODOptionData("opendiscord:dm-message-enabled",option.dmMessage.enabled),
|
||||
@@ -107,7 +104,7 @@ export const loadTicketOption = (option:api.ODJsonConfig_DefaultOptionTicketType
|
||||
])
|
||||
}
|
||||
|
||||
export const loadWebsiteOption = (opt:api.ODJsonConfig_DefaultOptionWebsiteType): api.ODWebsiteOption => {
|
||||
export const loadWebsiteOption = (opt:api.ODOptionsJsonConfig_WebsiteOption): api.ODWebsiteOption => {
|
||||
return new api.ODWebsiteOption(opt.id,[
|
||||
new api.ODOptionData("opendiscord:name",opt.name),
|
||||
new api.ODOptionData("opendiscord:description",opt.description),
|
||||
@@ -119,7 +116,7 @@ export const loadWebsiteOption = (opt:api.ODJsonConfig_DefaultOptionWebsiteType)
|
||||
])
|
||||
}
|
||||
|
||||
export const loadRoleOption = (opt:api.ODJsonConfig_DefaultOptionRoleType): api.ODRoleOption => {
|
||||
export const loadRoleOption = (opt:api.ODOptionsJsonConfig_RoleOption): api.ODRoleOption => {
|
||||
return new api.ODRoleOption(opt.id,[
|
||||
new api.ODOptionData("opendiscord:name",opt.name),
|
||||
new api.ODOptionData("opendiscord:description",opt.description),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const lang = opendiscord.languages
|
||||
|
||||
export const loadAllPanels = async () => {
|
||||
export async function loadAllPanels(){
|
||||
const panelConfig = opendiscord.configs.get("opendiscord:panels")
|
||||
if (!panelConfig) return
|
||||
|
||||
@@ -23,7 +23,7 @@ export const loadAllPanels = async () => {
|
||||
})
|
||||
}
|
||||
|
||||
export const loadPanel = (panel:api.ODJsonConfig_DefaultPanelType) => {
|
||||
export const loadPanel = (panel:api.ODPanelsJsonConfig_Panel) => {
|
||||
return new api.ODPanel(panel.id,[
|
||||
new api.ODPanelData("opendiscord:name",panel.name),
|
||||
new api.ODPanelData("opendiscord:options",panel.options),
|
||||
@@ -93,7 +93,7 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
|
||||
}
|
||||
if (layout == "detailed"){
|
||||
const optionAdmins = [...opt.get("opendiscord:admins").value]
|
||||
if (generalConfig.data.system.showGlobalAdminsInPanelRoles){
|
||||
if (generalConfig.data.ticketSystem.showGlobalAdminsInPanelRoles){
|
||||
for (const admin of generalConfig.data.globalAdmins){
|
||||
if (!optionAdmins.includes(admin)) optionAdmins.push(admin)
|
||||
}
|
||||
@@ -147,7 +147,7 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
|
||||
}
|
||||
if (layout == "detailed"){
|
||||
const optionAdmins = [...opt.get("opendiscord:admins").value]
|
||||
if (generalConfig.data.system.showGlobalAdminsInPanelRoles){
|
||||
if (generalConfig.data.ticketSystem.showGlobalAdminsInPanelRoles){
|
||||
for (const admin of generalConfig.data.globalAdmins){
|
||||
if (!optionAdmins.includes(admin)) optionAdmins.push(admin)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
const lang = opendiscord.languages
|
||||
|
||||
export const loadAllPriorityLevels = async () => {
|
||||
export async function loadAllPriorityLevels(){
|
||||
opendiscord.priorities.add(new api.ODPriorityLevel("opendiscord:urgent",5,"urgent",lang.getTranslation("priorities.urgent"),"🔴","🔴"))
|
||||
opendiscord.priorities.add(new api.ODPriorityLevel("opendiscord:very-high",4,"very-high",lang.getTranslation("priorities.veryHigh"),"🟠","🟠"))
|
||||
opendiscord.priorities.add(new api.ODPriorityLevel("opendiscord:high",3,"high",lang.getTranslation("priorities.high"),"🟡","🟡"))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllQuestions = async () => {
|
||||
export async function loadAllQuestions(){
|
||||
const questionConfig = opendiscord.configs.get("opendiscord:questions")
|
||||
if (!questionConfig) return
|
||||
|
||||
@@ -28,7 +28,7 @@ export const loadAllQuestions = async () => {
|
||||
})
|
||||
}
|
||||
|
||||
export const loadShortQuestion = (option:api.ODJsonConfig_DefaultShortQuestionType) => {
|
||||
export const loadShortQuestion = (option:api.ODQuestionsJsonConfig_ShortQuestion) => {
|
||||
return new api.ODShortQuestion(option.id,[
|
||||
new api.ODQuestionData("opendiscord:name",option.name),
|
||||
new api.ODQuestionData("opendiscord:required",option.required),
|
||||
@@ -40,7 +40,7 @@ export const loadShortQuestion = (option:api.ODJsonConfig_DefaultShortQuestionTy
|
||||
])
|
||||
}
|
||||
|
||||
export const loadParagraphQuestion = (option:api.ODJsonConfig_DefaultParagraphQuestionType) => {
|
||||
export const loadParagraphQuestion = (option:api.ODQuestionsJsonConfig_ParagraphQuestion) => {
|
||||
return new api.ODParagraphQuestion(option.id,[
|
||||
new api.ODQuestionData("opendiscord:name",option.name),
|
||||
new api.ODQuestionData("opendiscord:required",option.required),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllRoles = async () => {
|
||||
export async function loadAllRoles(){
|
||||
await opendiscord.options.loopAll((opt) => {
|
||||
if (opt instanceof api.ODRoleOption){
|
||||
opendiscord.roles.add(loadRole(opt))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
const optionDatabase = opendiscord.databases.get("opendiscord:options")
|
||||
|
||||
export const loadAllTickets = async () => {
|
||||
export async function loadAllTickets(){
|
||||
const ticketDatabase = opendiscord.databases.get("opendiscord:tickets")
|
||||
if (!ticketDatabase) return
|
||||
|
||||
@@ -11,7 +11,7 @@ export const loadAllTickets = async () => {
|
||||
for (const ticket of tickets){
|
||||
try {
|
||||
opendiscord.tickets.add(await loadTicket(ticket.value))
|
||||
}catch (err){
|
||||
}catch (err:any){
|
||||
process.emit("uncaughtException",err)
|
||||
process.emit("uncaughtException",new api.ODSystemError("Failed to load ticket from database! => id: "+ticket.key+"\n ===> "+err))
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const collector = opendiscord.transcripts.collector
|
||||
@@ -46,10 +46,10 @@ function transcriptAuth(_A:{salt:number,secret:string}){
|
||||
const _B = Buffer.from(_A.secret,"hex");const _C = Math["floor"](new Date().getTime()/(30*1000)).toString();const _D = Buffer.from(_C);const _E = Buffer.alloc(_D["length"]);_D.forEach((v,i) => {_E[i] = v ^ _B[i % _B["length"]];});return btoa(JSON.stringify({salt:_A.salt,secret:_A.secret,token:_E.toString("hex")}))
|
||||
}
|
||||
|
||||
export const loadAllTranscriptCompilers = async () => {
|
||||
export async function loadAllTranscriptCompilers(){
|
||||
class ODHTTPHtmlPostRequest extends api.ODHTTPPostRequest {
|
||||
constructor(transcriptAuth:string,htmlFinal:api.ODTranscriptHtmlV2Data){
|
||||
super("https://"+htmlDomain+"/api/v2/upload?auth="+htmlVersion+"&token="+transcriptAuth,true,{
|
||||
super(opendiscord,"https://"+htmlDomain+"/api/v2/upload?auth="+htmlVersion+"&token="+transcriptAuth,true,{
|
||||
body:JSON.stringify(htmlFinal),
|
||||
headers:{
|
||||
"Content-Type":"application/json"
|
||||
@@ -178,7 +178,7 @@ export const loadAllTranscriptCompilers = async () => {
|
||||
//HTML COMPILER
|
||||
opendiscord.transcripts.add(new api.ODTranscriptCompiler<{url:string,availableUntil:Date},{auth:string}|null>("opendiscord:html-compiler",async (ticket,channel,user) => {
|
||||
//INIT
|
||||
const req = new api.ODHTTPGetRequest(atob("aHR0cHM6Ly90LmRqLWRqLmJlL2FwaS92Mi9pbml0"),false)
|
||||
const req = new api.ODHTTPGetRequest(opendiscord,atob("aHR0cHM6Ly90LmRqLWRqLmJlL2FwaS92Mi9pbml0"),false)
|
||||
const res = await req.run()
|
||||
//PENDING MESSAGE (not required anymore) => await messages.getSafe("opendiscord:transcript-html-progress").build("channel",{guild:channel.guild,channel,user,ticket,compiler:opendiscord.transcripts.get("opendiscord:html-compiler"),remaining:16000})
|
||||
if (res.status == 200 && res.body){
|
||||
@@ -552,6 +552,6 @@ export const loadAllTranscriptCompilers = async () => {
|
||||
}))
|
||||
}
|
||||
|
||||
export const loadTranscriptHistory = async () => {
|
||||
export async function loadTranscriptHistory(){
|
||||
//UNIMPLEMENTED (made for html transcripts v3 update)
|
||||
}
|
||||
Reference in New Issue
Block a user