diff --git a/README.md b/README.md index 930c163..aada3ed 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Open Ticket -[![discord](https://img.shields.io/badge/discord-join%20our%20server-5865F2.svg?style=flat-square&logo=discord)](https://discord.com/invite/26vT9wt3n3) [![version](https://img.shields.io/badge/version-3.0.0-brightgreen.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/releases/tag/v3.0.0) [![discord.js](https://img.shields.io/badge/discord.js-v14-CB3837.svg?style=flat-square&logo=npm)]() [![license](https://img.shields.io/badge/license-GPL%203.0-important.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE) [![documentation](https://img.shields.io/badge/documentation-Click%20Here-yellow.svg?style=flat-square)](https://docs.openticket.dj-dj.be) +[![discord](https://img.shields.io/badge/discord-join%20our%20server-5865F2.svg?style=flat-square&logo=discord)](https://discord.com/invite/26vT9wt3n3) [![version](https://img.shields.io/badge/version-3.0.1-brightgreen.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/releases/tag/v3.0.1) [![discord.js](https://img.shields.io/badge/discord.js-v14-CB3837.svg?style=flat-square&logo=npm)]() [![license](https://img.shields.io/badge/license-GPL%203.0-important.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE) [![documentation](https://img.shields.io/badge/documentation-Click%20Here-yellow.svg?style=flat-square)](https://docs.openticket.dj-dj.be) Open ticket is the most configurable open-source ticket bot for discord! Made with the newest technologies. Like: Slash commands, transcripts, multiple ticket types, buttons & dropdowns! Start using it now, you can do anything! @@ -52,7 +52,7 @@ Start using it now, you can do anything! ## information -_v3.0.0_ +_v3.0.1_ changelog: [click here](https://docs.openticket.dj-dj.be/other/changelog) diff --git a/config.json b/config.json index 729f66c..e449367 100644 --- a/config.json +++ b/config.json @@ -92,7 +92,7 @@ "dropdown":false, "enableFooter":false, - "footer":"Open Ticket v3.0.0 - I'm a footer!", + "footer":"Open Ticket v3.0.1 - I'm a footer!", "enableThumbnail":false, "thumbnail":"https://www.example.com/catmemes/cat.png", diff --git a/core/checker.js b/core/checker.js index db98bca..6269018 100644 --- a/core/checker.js +++ b/core/checker.js @@ -85,6 +85,9 @@ exports.checker = async () => { /**@param {"userid"|"roleid"|"channelid"|"serverid"} mode @param {String[]} arrayValue @param {String} path */ const checkDiscordArray = (mode,arrayValue,path) => { + if (!Array.isArray(arrayValue)){ + return createError("'"+path+"' | this needs to be an Array!") + } if (mode == "userid"){ arrayValue.forEach((value,index) => { if (value.length < 16 || value.length > 20 || !/^\d+$/.test(value)){ @@ -438,6 +441,9 @@ exports.checker = async () => { const splitw = w.split("'") if (splitw.length > 1){ var splitstring = chalk.yellow(splitw[0])+chalk.blue("'"+splitw[1]+"'")+chalk.yellow(splitw[2]) + if (splitw[3]){splitstring = splitstring+chalk.yellow(splitw[3])} + if (splitw[4]){splitstring = splitstring+chalk.yellow(splitw[4])} + if (splitw[5]){splitstring = splitstring+chalk.yellow(splitw[5])} }else {var splitstring = chalk.yellow(splitw[0])} console.log(splitstring) }) diff --git a/core/errorLogSystem.js b/core/errorLogSystem.js index 8c03515..71755ae 100644 --- a/core/errorLogSystem.js +++ b/core/errorLogSystem.js @@ -93,10 +93,24 @@ exports.custom = (title,message,emoji,color) => { return x } +exports.clearDebugFile = () => { + const fs = require("fs") + if (!fs.existsSync("./openticketdebug.txt")) return + const content = fs.readFileSync("./openticketdebug.txt").toString().split("\n") + if (content.length < 5000) return + for (let i = 0; i < 4000; i++) { + content.shift() + } + + const newContent = "==========================\n\n=========================="+content.join("\n") + fs.writeFileSync("./openticketdebug.txt",newContent) +} + const normalLog = (debugString) => { const fs = require("fs") const content = fs.existsSync("./openticketdebug.txt") ? fs.readFileSync("./openticketdebug.txt").toString() : "==========================\n\n==========================" fs.writeFileSync("./openticketdebug.txt",content+"\nSYSTEM: "+debugString) + this.clearDebugFile() } /** diff --git a/core/ticketActions/ticketOpener.js b/core/ticketActions/ticketOpener.js index 9aefa3a..1221ad2 100755 --- a/core/ticketActions/ticketOpener.js +++ b/core/ticketActions/ticketOpener.js @@ -26,7 +26,7 @@ module.exports = () => { var customId = "OTnewT"+interaction.options.getString("type") }else if (interaction.isButton()){ var customId = interaction.customId - }else if (interaction.isSelectMenu() && (interaction.customId == "OTdropdownMenu")){ + }else if (interaction.isStringSelectMenu() && (interaction.customId == "OTdropdownMenu")){ var customId = interaction.values[0] }else return @@ -53,7 +53,7 @@ module.exports = () => { interaction.deferUpdate() }else if (interaction.isChatInputCommand()){ interaction.reply({embeds:[bot.errorLog.success(l.messages.createdTitle,l.messages.createdDescription)]}) - }else if (interaction.isSelectMenu()){ + }else if (interaction.isStringSelectMenu()){ await interaction.deferUpdate() } diff --git a/core/utils/getDropdown.js b/core/utils/getDropdown.js index 52174d4..2801c68 100644 --- a/core/utils/getDropdown.js +++ b/core/utils/getDropdown.js @@ -7,10 +7,10 @@ const configParser = require("./configParser") /** * * @param {String[]} ids - * @returns {discord.SelectMenuBuilder|false} + * @returns {discord.StringSelectMenuBuilder|false} */ exports.getDropdown = (ids) => { - const dropdown = new discord.SelectMenuBuilder() + const dropdown = new discord.StringSelectMenuBuilder() .setCustomId("OTdropdownMenu") .setDisabled(false) .setMaxValues(1) diff --git a/index.js b/index.js index e98d1a0..e529ec6 100644 --- a/index.js +++ b/index.js @@ -218,12 +218,14 @@ const debugLog = (debugString) => { const content = fs.existsSync("./openticketdebug.txt") ? fs.readFileSync("./openticketdebug.txt").toString() : "==========================\n\n==========================" fs.writeFileSync("./openticketdebug.txt",content+"\nDEBUG: "+debugString) } + this.errorLog.clearDebugFile() } const errorLog = (errorString,stack) => { if (!APIConfig.disable.debug.all){ const content = fs.existsSync("./openticketdebug.txt") ? fs.readFileSync("./openticketdebug.txt").toString() : "==========================\n\n==========================" fs.writeFileSync("./openticketdebug.txt",content+"\nERROR: "+errorString+" STACK: "+stack) } + this.errorLog.clearDebugFile() } this.errorLog.log("debug","OT error system loaded successfully") diff --git a/package.json b/package.json index d4299e8..fd25aa9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "open-ticket", - "version": "3.0.0", + "version": "3.0.1", "description": "This is an open-source discord ticket bot, you can configure it and it comes with cool features like a transcript.", "main": "index.js", "scripts": {