From 8cab4cc6861a67f375dd204a8a7bf838e96b53ce Mon Sep 17 00:00:00 2001 From: DJj123dj <80536295+DJj123dj@users.noreply.github.com> Date: Thu, 31 Mar 2022 18:38:49 +0200 Subject: [PATCH] v1.3.1 Bug fixes --- README.md | 18 +++-- commands/database.js | 2 +- commands/ticket.js | 83 ++++++++++++++++++---- commands/ticketExtra.js | 4 +- commands/ticketSystem.js | 16 ++--- CHANGELOG.md => documentation/CHANGELOG.md | 13 ++++ CONFIG.md => documentation/CONFIG.md | 4 +- documentation/Q&A.md | 26 +++++++ 8 files changed, 133 insertions(+), 33 deletions(-) rename CHANGELOG.md => documentation/CHANGELOG.md (81%) rename CONFIG.md => documentation/CONFIG.md (96%) create mode 100644 documentation/Q&A.md diff --git a/README.md b/README.md index 836b336..5ac3d88 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ # 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-1.3.0%20stable-brightgreen.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/releases/tag/v1.3.0) +[![version](https://img.shields.io/badge/version-1.3.1%20stable-brightgreen.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/releases/tag/v1.3.1) [![npm](https://img.shields.io/badge/npm-external%20libraries%20needed-CB3837.svg?style=flat-square&logo=npm)](#packages) [![license](https://img.shields.io/badge/license-GPL%203.0-important.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE) This is an open-source discord ticket bot, you can configure it and it comes with cool features like transcripts & custom options! -Open Ticket logo +Open Ticket logo + +[![announcement](https://img.shields.io/badge/new%20announcement!-open--ticket%20v1.4.0-red.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/discussions/3) + +[![q&a](https://img.shields.io/badge/Q&A-click%20here-blue.svg?style=flat-square)](./documentation/Q&A.md) ## features - discord interaction buttons @@ -41,7 +45,7 @@ if there are any errors, you can open an **issue on github** or **contact me in ### config Our config documentation is moved to another file: -[click here to view](CONFIG.md) +[click here to view](./documentation/CONFIG.md) ### intents & permissions In the discord developer portal in the "bot" panel you will find 3 switches under the title "Gateaway Intents". The following switches should always be turned on @@ -51,10 +55,14 @@ In the discord developer portal in the "bot" panel you will find 3 switches unde To work the best, the bot needs `ADMINISTRATOR` permissions. You can also configure your own permissions +## v1.4.0 announcement +Hello everyone, soon open-ticket v1.4.0 will be launched, it contains a lot of new features. You can view them below. +[click here to view the announcement](https://github.com/DJj123dj/open-ticket/discussions/3) + ## information -_v1.3.0_ +_v1.3.1_ -changelog: [click here](CHANGELOG.md) +changelog: [click here](./documentation/CHANGELOG.md) © 2022 - DJdj Development | [website](https://www.dj-dj.be) | [discord](https://discord.com/invite/26vT9wt3n3) \ No newline at end of file diff --git a/commands/database.js b/commands/database.js index 0aa8927..82e27f5 100644 --- a/commands/database.js +++ b/commands/database.js @@ -13,7 +13,7 @@ module.exports = () => { .setColor(config.main_color) .setTitle("How to reset the database:") .setDescription("1: Go to the folder `./storage` in your bot's directory.\n\n2: If posible remove the folders\n`./tickets`, `./transcripts` & `./userTickets`\nfrom the folder `./storage`\n\n3: Restart the bot") - .setFooter("if it doesn't work, create an issue on github or DM me on discord!") + .setFooter({text:"if it doesn't work, create an issue on github or DM me on discord!"}) msg.channel.send({embeds:[databaseEmbed]}) } diff --git a/commands/ticket.js b/commands/ticket.js index 73edd33..63a0480 100644 --- a/commands/ticket.js +++ b/commands/ticket.js @@ -12,7 +12,9 @@ module.exports = () => { return } + var currentTicketButtons = 0 var ticketButton = new discord.MessageActionRow() + var ticketButton2 = new discord.MessageActionRow() const getColor = (color) => { if (color.toLowerCase() == "red"){ @@ -31,8 +33,16 @@ module.exports = () => { } if (config.options.ticket1.enabled){ + if (currentTicketButtons < 4){ + var localTicketButton = ticketButton + }else{ + var localTicketButton = ticketButton2 + } + + currentTicketButtons = currentTicketButtons + 1 + if (config.options.ticket1.isURL == false){ - ticketButton.addComponents( + localTicketButton.addComponents( new discord.MessageButton() .setCustomId("newTicket1") .setDisabled(false) @@ -40,7 +50,7 @@ module.exports = () => { .setEmoji(config.options.ticket1.icon) ) }else{ - ticketButton.addComponents( + localTicketButton.addComponents( new discord.MessageButton() .setDisabled(false) .setStyle("LINK") @@ -51,8 +61,16 @@ module.exports = () => { } if (config.options.ticket2.enabled){ + if (currentTicketButtons < 4){ + var localTicketButton = ticketButton + }else{ + var localTicketButton = ticketButton2 + } + + currentTicketButtons = currentTicketButtons + 1 + if (config.options.ticket2.isURL == false){ - ticketButton.addComponents( + localTicketButton.addComponents( new discord.MessageButton() .setCustomId("newTicket2") .setDisabled(false) @@ -60,7 +78,7 @@ module.exports = () => { .setEmoji(config.options.ticket2.icon) ) }else{ - ticketButton.addComponents( + localTicketButton.addComponents( new discord.MessageButton() .setDisabled(false) .setStyle("LINK") @@ -71,8 +89,16 @@ module.exports = () => { } if (config.options.ticket3.enabled){ + if (currentTicketButtons < 4){ + var localTicketButton = ticketButton + }else{ + var localTicketButton = ticketButton2 + } + + currentTicketButtons = currentTicketButtons + 1 + if (config.options.ticket3.isURL == false){ - ticketButton.addComponents( + localTicketButton.addComponents( new discord.MessageButton() .setCustomId("newTicket3") .setDisabled(false) @@ -80,7 +106,7 @@ module.exports = () => { .setEmoji(config.options.ticket3.icon) ) }else{ - ticketButton.addComponents( + localTicketButton.addComponents( new discord.MessageButton() .setDisabled(false) .setStyle("LINK") @@ -91,8 +117,16 @@ module.exports = () => { } if (config.options.ticket4.enabled){ + if (currentTicketButtons < 4){ + var localTicketButton = ticketButton + }else{ + var localTicketButton = ticketButton2 + } + + currentTicketButtons = currentTicketButtons + 1 + if (config.options.ticket4.isURL == false){ - ticketButton.addComponents( + localTicketButton.addComponents( new discord.MessageButton() .setCustomId("newTicket4") .setDisabled(false) @@ -100,7 +134,7 @@ module.exports = () => { .setEmoji(config.options.ticket4.icon) ) }else{ - ticketButton.addComponents( + localTicketButton.addComponents( new discord.MessageButton() .setDisabled(false) .setStyle("LINK") @@ -111,8 +145,16 @@ module.exports = () => { } if (config.options.ticket5.enabled){ + if (currentTicketButtons < 4){ + var localTicketButton = ticketButton + }else{ + var localTicketButton = ticketButton2 + } + + currentTicketButtons = currentTicketButtons + 1 + if (config.options.ticket5.isURL == false){ - ticketButton.addComponents( + localTicketButton.addComponents( new discord.MessageButton() .setCustomId("newTicket5") .setDisabled(false) @@ -120,7 +162,7 @@ module.exports = () => { .setEmoji(config.options.ticket5.icon) ) }else{ - ticketButton.addComponents( + localTicketButton.addComponents( new discord.MessageButton() .setDisabled(false) .setStyle("LINK") @@ -131,8 +173,16 @@ module.exports = () => { } if (config.options.ticket6.enabled){ + if (currentTicketButtons < 4){ + var localTicketButton = ticketButton + }else{ + var localTicketButton = ticketButton2 + } + + currentTicketButtons = currentTicketButtons + 1 + if (config.options.ticket6.isURL == false){ - ticketButton.addComponents( + localTicketButton.addComponents( new discord.MessageButton() .setCustomId("newTicket6") .setDisabled(false) @@ -140,7 +190,7 @@ module.exports = () => { .setEmoji(config.options.ticket6.icon) ) }else{ - ticketButton.addComponents( + localTicketButton.addComponents( new discord.MessageButton() .setDisabled(false) .setStyle("LINK") @@ -171,7 +221,7 @@ module.exports = () => { }else{ticketEmbed.setColor(config.main_color)} if (config.layout.ticketMsg.footerEnabled){ - ticketEmbed.setFooter(config.layout.ticketMsg.footer) + ticketEmbed.setFooter({text:config.layout.ticketMsg.footer}) } if (config.layout.ticketMsg.thumbnailEnabled){ ticketEmbed.setThumbnail(config.layout.ticketMsg.thumbnailURL) @@ -180,8 +230,11 @@ module.exports = () => { ticketEmbed.setDescription("**Create a ticket:**\nClick one of the buttons below to create a ticket.\n\n__choose a category:__"+categorylist+"\n\n**watch out:**_You can only create "+config.system.max_allowed_tickets+" ticket(s) at a time!_") - - msg.channel.send({embeds:[ticketEmbed],components:[ticketButton]}) + if (currentTicketButtons <= 4){ + var embedComponents = [ticketButton] + }else{var embedComponents = [ticketButton,ticketButton2]} + + msg.channel.send({embeds:[ticketEmbed],components:embedComponents}) } diff --git a/commands/ticketExtra.js b/commands/ticketExtra.js index 63d764b..774056e 100644 --- a/commands/ticketExtra.js +++ b/commands/ticketExtra.js @@ -17,7 +17,7 @@ module.exports = () => { TicketHelpMsg.setDescription("**Go to <#"+config.system.ticket_channel+"> to create a ticket!**\n\n`"+prefix+"ticket msg` ➜ _Admin command._\n`"+prefix+"ticket rename` ➜ _Rename a ticket (no spaces)._\n`"+prefix+"ticket close` ➜ _Close a ticket._\n`"+prefix+"ticket add ` ➜ _Add a user to the ticket._\n`"+prefix+"ticket remove ` ➜ _Remove a user from the ticket._\n`"+prefix+"resetdatabase` ➜ _Steps to reset the database._") if (config.credits){ - TicketHelpMsg.setFooter("Open-Ticket by DJdj Development | view on github for source code") + TicketHelpMsg.setFooter({text:"Open-Ticket by DJdj Development | view on github for source code"}) } msg.channel.send({embeds:[TicketHelpMsg]}) @@ -67,7 +67,7 @@ module.exports = () => { var name = args[2] msg.channel.messages.fetchPinned().then(msglist => { if (msglist.last().author.id == client.user.id){ - msg.channel.send({content:"De naam is veranderd!"}).then(rmsg => { + msg.channel.send({content:"The name from the ticket is changed!"}).then(rmsg => { rmsg.channel.setName(name) }) }else{ diff --git a/commands/ticketSystem.js b/commands/ticketSystem.js index a79f084..c19bd56 100644 --- a/commands/ticketSystem.js +++ b/commands/ticketSystem.js @@ -110,7 +110,7 @@ module.exports = () => { }else{ticketEmbed.setColor(config.main_color)} if (config.layout.ticketEmbed.footerEnabled){ - ticketEmbed.setFooter(config.layout.ticketEmbed.footer) + ticketEmbed.setFooter({text:"config.layout.ticketEmbed.footer"}) } if (config.layout.ticketEmbed.thumbnailEnabled){ ticketEmbed.setThumbnail(config.layout.ticketEmbed.thumbnailURL) @@ -227,16 +227,16 @@ module.exports = () => { } var transcriptEmbed = new discord.MessageEmbed() .setColor(transcriptColor) - .setAuthor(interaction.channel.name + " - ticket created by "+getuserNAME) + .setAuthor({text:interaction.channel.name + " - ticket created by "+getuserNAME}) .setTitle("There is a new transcript!") .setDescription(splittedTranscript[0]) - .setFooter("ticket closed by "+interaction.member.user.username) + .setFooter({text:"ticket closed by "+interaction.member.user.username}) .setThumbnail(transcriptThumbnail) if (transcript.length > 4000){ var transcriptEmbed2 = new discord.MessageEmbed() .setColor(transcriptColor) - .setAuthor(interaction.channel.name + " - ticket created by "+getuserNAME) + .setAuthor({text:interaction.channel.name + " - ticket created by "+getuserNAME}) .setTitle("transcript #2") .setDescription(splittedTranscript[1]) .setFooter("ticket closed by "+interaction.member.user.username) @@ -244,10 +244,10 @@ module.exports = () => { var transcriptEmbed3 = new discord.MessageEmbed() .setColor(transcriptColor) - .setAuthor(interaction.channel.name + " - ticket created by "+getuserNAME) + .setAuthor({text:interaction.channel.name + " - ticket created by "+getuserNAME}) .setTitle("transcript #3") .setDescription(splittedTranscript[1]) - .setFooter("ticket closed by "+interaction.member.user.username) + .setFooter({text:"ticket closed by "+interaction.member.user.username}) .setThumbnail(transcriptThumbnail) client.channels.cache.find(ch => ch.id == config.system.transcript_channel).send({embeds:[transcriptEmbed,transcriptEmbed2,transcriptEmbed3]}) @@ -255,10 +255,10 @@ module.exports = () => { }else if (transcript.length > 2000){ var transcriptEmbed2 = new discord.MessageEmbed() .setColor(transcriptColor) - .setAuthor(interaction.channel.name + " - ticket created by "+getuserNAME) + .setAuthor({text:interaction.channel.name + " - ticket created by "+getuserNAME}) .setTitle("transcript #2") .setDescription(splittedTranscript[1]) - .setFooter("ticket closed by "+interaction.member.user.username) + .setFooter({text:"ticket closed by "+interaction.member.user.username}) .setThumbnail(transcriptThumbnail) client.channels.cache.find(ch => ch.id == config.system.transcript_channel).send({embeds:[transcriptEmbed,transcriptEmbed2]}) diff --git a/CHANGELOG.md b/documentation/CHANGELOG.md similarity index 81% rename from CHANGELOG.md rename to documentation/CHANGELOG.md index 2ea6b80..f7223e9 100644 --- a/CHANGELOG.md +++ b/documentation/CHANGELOG.md @@ -1,5 +1,18 @@ # changelog +## v1.3.1 +### added: +- Q&A in the README.md +- v1.4.0 announcement +### fixed +- a bug that happend when you created too much tickets +- deprecation warnings (setAuthor & setFooter) +- the logo in README.md is smaller now +- markdown files relocated +- fixed a bug that some messages appeared in Dutch +### removed +- nothing + ## v1.3.0 ### added: - now its possible to create 6 tickets instead of 4 diff --git a/CONFIG.md b/documentation/CONFIG.md similarity index 96% rename from CONFIG.md rename to documentation/CONFIG.md index e05551a..edd7243 100644 --- a/CONFIG.md +++ b/documentation/CONFIG.md @@ -1,6 +1,6 @@ # config file [![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-1.3.0%20stable-brightgreen.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/releases/tag/v1.3.0) +[![version](https://img.shields.io/badge/version-1.3.1%20stable-brightgreen.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/releases/tag/v1.3.1) [![npm](https://img.shields.io/badge/npm-external%20libraries%20needed-CB3837.svg?style=flat-square&logo=npm)](#packages) [![license](https://img.shields.io/badge/license-GPL%203.0-important.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE) @@ -64,4 +64,4 @@ I didn't know that open-tickets was going to be so much used. I will be creating If you have an idea for new updates you can always say it in my discord server! -open-tickets v1.3.0 \ No newline at end of file +open-tickets v1.3.1 \ No newline at end of file diff --git a/documentation/Q&A.md b/documentation/Q&A.md new file mode 100644 index 0000000..9f221a2 --- /dev/null +++ b/documentation/Q&A.md @@ -0,0 +1,26 @@ +# Question & Answer +## How to install node.js 16? +You can install the latest version of node.js on their [website](https://nodejs.org/en/download/). You also need `npm`! + +## How to install all the npm packages? +If you installed node.js successful, you can run `npm install` in the command prompt and all the required modules will be installed. + +## Where is the config file documentation? +You can find it [here](...) + +**How to start the bot?** +If you successfully installed all the npm modules (see above), you can run `npm start` + +## Do I need to know discord.js? +Technically not, but it is useful to know if there is an error. + +## Why do I get this error? +**Invalid token:** + +_Your discord token is not correct, try to look in the config.json file if it's the correct token._ + +**Privileged intent provided is not enabled or whitelisted:** + +_You must enable all the **Gateaway Intents** in the developer panel in the "bot" tab_ + +### Report other errors to the discord server! \ No newline at end of file