diff --git a/README.md b/README.md index d0974a9..b3a38e2 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Need help or want to get involved? Feel free to join our ❤️ Love Open Ticket? Sponsorships help fuel our HTML transcript servers and future features! ❤️

--- -> **[-> Navigate to (⏱️ Quick Setup)](#️-quick-start-using-cli)** +> **[-> Navigate to (⏱️ Quick Setup)](#️-quick-start-using-interactive-cli-tool)** > **[-> Navigate to (📚 Documentation)](https://otdocs.dj-dj.be)** > **[-> Navigate to (📞 Support Server)](https://discord.dj-dj.be)** diff --git a/package.json b/package.json index cb0e027..75330b8 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "license": "GPL-3.0-only", "dependencies": { "@discordjs/rest": "^2.6.1", - "@open-discord-bots/framework": "^0.3.17", + "@open-discord-bots/framework": "^0.4.0", "@types/node": "^22.5.0", "@types/terminal-kit": "^2.5.7", "ansis": "^4.2.0", diff --git a/src/builders/embeds.ts b/src/builders/embeds.ts index 5ce7699..39d5442 100644 --- a/src/builders/embeds.ts +++ b/src/builders/embeds.ts @@ -628,7 +628,7 @@ const ticketEmbeds = () => { const answers = ticket.get("opendiscord:answers").value answers.forEach((answer) => { if (!answer.value || answer.value.length == 0) return - if (generalConfig.data.system.questionFieldsInCodeBlock) instance.addFields({name:answer.name,value:"```"+answer.value+"```",inline:false}) + if (generalConfig.data.system.questionFieldsInCodeBlock) instance.addFields({name:answer.name,value:"```"+answer.value.slice(0,1024-6)+"```",inline:false}) else instance.addFields({name:answer.name,value:answer.value,inline:false}) }) }else if (embedOptions.fields){ diff --git a/src/builders/modals.ts b/src/builders/modals.ts index b1c1e56..281e93f 100644 --- a/src/builders/modals.ts +++ b/src/builders/modals.ts @@ -30,7 +30,7 @@ const ticketModals = () => { required:question.get("opendiscord:required").value, placeholder:(question.get("opendiscord:placeholder").value) ? question.get("opendiscord:placeholder").value : undefined, minLength:(question.get("opendiscord:length-enabled").value) ? question.get("opendiscord:length-min").value : undefined, - maxLength:(question.get("opendiscord:length-enabled").value) ? question.get("opendiscord:length-max").value : undefined + maxLength:Math.min(1024-6,(question.get("opendiscord:length-enabled").value) ? question.get("opendiscord:length-max").value : (1024-6)) //embed field limit - 6x` characters }) else if (question instanceof api.ODParagraphQuestion) instance.addQuestion({ customId:question.id.value, @@ -39,7 +39,7 @@ const ticketModals = () => { required:question.get("opendiscord:required").value, placeholder:(question.get("opendiscord:placeholder").value) ? question.get("opendiscord:placeholder").value : undefined, minLength:(question.get("opendiscord:length-enabled").value) ? question.get("opendiscord:length-min").value : undefined, - maxLength:(question.get("opendiscord:length-enabled").value) ? question.get("opendiscord:length-max").value : undefined + maxLength:Math.min(1024-6,(question.get("opendiscord:length-enabled").value) ? question.get("opendiscord:length-max").value : (1024-6)) //embed field limit - 6x` characters }) }) }) diff --git a/src/core/mappings/client.ts b/src/core/mappings/client.ts index a325342..4d37d8a 100644 --- a/src/core/mappings/client.ts +++ b/src/core/mappings/client.ts @@ -3,16 +3,6 @@ /////////////////////////////////////// import * as api from "@open-discord-bots/framework/api" -/** (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. - */ - /**## ODSlashCommandManagerIdMappings `interface` * A list of all available IDs in the default `ODSlashCommandManager` class in `opendiscord`. * It's used to generate typescript declarations for this class. diff --git a/src/core/mappings/config.ts b/src/core/mappings/config.ts index 5e7718f..8e6c726 100644 --- a/src/core/mappings/config.ts +++ b/src/core/mappings/config.ts @@ -5,26 +5,6 @@ import * as api from "@open-discord-bots/framework/api" import * as discord from "discord.js" import { ODRoleUpdateMode } from "../api/role.js" -/** (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. - */ - /**## ODConfigManagerIdMappings `interface` * A list of all available IDs in the default `ODConfigManager` class in `opendiscord`. * It's used to generate typescript declarations for this class. diff --git a/src/core/mappings/helpmenu.ts b/src/core/mappings/helpmenu.ts index 631128b..1b8ddfc 100644 --- a/src/core/mappings/helpmenu.ts +++ b/src/core/mappings/helpmenu.ts @@ -3,16 +3,6 @@ /////////////////////////////////////// import * as api from "@open-discord-bots/framework/api" -/** (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. - */ - /**## ODHelpMenuManagerIdMappings `interface` * A list of all available IDs in the default `ODHelpMenuManager` class in `opendiscord`. * It's used to generate typescript declarations for this class. diff --git a/src/core/mappings/language.ts b/src/core/mappings/language.ts index e425a6c..7870a81 100644 --- a/src/core/mappings/language.ts +++ b/src/core/mappings/language.ts @@ -3,15 +3,6 @@ /////////////////////////////////////// import * as api from "@open-discord-bots/framework/api" -/** (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. - */ - /**## ODLanguageManagerIdMappings `interface` * A list of all available IDs in the default `ODLanguageManager` class in `opendiscord`. * It's used to generate typescript declarations for this class. diff --git a/src/data/framework/checkerLoader.ts b/src/data/framework/checkerLoader.ts index 4f00adb..2a26a05 100644 --- a/src/data/framework/checkerLoader.ts +++ b/src/data/framework/checkerLoader.ts @@ -2,26 +2,6 @@ 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 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."})) diff --git a/src/data/framework/commandLoader.ts b/src/data/framework/commandLoader.ts index 3776e8d..d6df28d 100644 --- a/src/data/framework/commandLoader.ts +++ b/src/data/framework/commandLoader.ts @@ -3,16 +3,6 @@ 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 async function loadAllSlashCommands(){ const commands = opendiscord.client.slashCommands const generalConfig = opendiscord.configs.get("opendiscord:general") diff --git a/src/data/framework/configLoader.ts b/src/data/framework/configLoader.ts index f056df8..a977e24 100644 --- a/src/data/framework/configLoader.ts +++ b/src/data/framework/configLoader.ts @@ -1,26 +1,6 @@ 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 async function loadAllConfigs(){ const devconfigFlag = opendiscord.flags.get("opendiscord:dev-config") const isDevconfig = devconfigFlag ? devconfigFlag.value : false diff --git a/src/data/framework/helpMenuLoader.ts b/src/data/framework/helpMenuLoader.ts index c0bec37..27dbf4e 100644 --- a/src/data/framework/helpMenuLoader.ts +++ b/src/data/framework/helpMenuLoader.ts @@ -2,16 +2,6 @@ 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 async function loadAllHelpMenuCategories(){ const helpmenu = opendiscord.helpmenu diff --git a/src/data/framework/languageLoader.ts b/src/data/framework/languageLoader.ts index d4bea53..104261f 100644 --- a/src/data/framework/languageLoader.ts +++ b/src/data/framework/languageLoader.ts @@ -1,14 +1,5 @@ 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 async function loadAllLanguages(){ //register languages opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:custom","custom.json")) diff --git a/src/index.ts b/src/index.ts index 25bb2fb..f279efb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -380,7 +380,7 @@ const main = async () => { //throw if bot doesn't have permissions in main server if (!client.checkGuildPerms(mainServer)){ console.log("\n") - opendiscord.log("The bot doesn't have the correct permissions in the server provided in the config!","error") + opendiscord.log("The bot doesn’t have the required permissions for the server specified in the configuration.","error") opendiscord.log("Please give the bot \"Administrator\" permissions or visit the documentation!","info") console.log("\n") process.exit(1) @@ -388,12 +388,13 @@ const main = async () => { if (opendiscord.sharedFuses.getFuse("clientMultiGuildWarning")){ //warn if bot is in multiple servers if (botServers.length > 1){ - opendiscord.log("This bot is part of multiple servers, but Open Ticket doesn't provide support for this!","warning") - opendiscord.log("As a result, the bot may crash & glitch when used in the additional servers!","info") + opendiscord.log("This bot is part of multiple servers, but Open Ticket does not support this.","warning") + opendiscord.log("The bot may have weird behaviour when used in external servers!","info") + await utilities.timer(2000) } botServers.forEach((server) => { //warn if bot doesn't have permissions in multiple servers - if (!client.checkGuildPerms(server)) opendiscord.log(`The bot doesn't have the correct permissions in the server "${server.name}"!`,"warning") + if (!client.checkGuildPerms(server)) opendiscord.log(`The bot doesn’t have the required permissions for the server "${server.name}".`,"warning") }) }