Bug fixes
This commit is contained in:
DJj123dj
2022-03-31 18:38:49 +02:00
parent 21e3a88b87
commit 8cab4cc686
8 changed files with 133 additions and 33 deletions
+13 -5
View File
@@ -1,12 +1,16 @@
# open-ticket # open-ticket
[![discord](https://img.shields.io/badge/discord-join%20our%20server-5865F2.svg?style=flat-square&logo=discord)](https://discord.com/invite/26vT9wt3n3) [![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) [![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) [![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! This is an open-source discord ticket bot, you can configure it and it comes with cool features like transcripts & custom options!
<img src="logo.png" alt="Open Ticket logo" style="height: 300px; width:300px;"/> <img src="logo.png" alt="Open Ticket logo" style="height: 200px; width:200px;"/>
[![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 ## features
- discord interaction buttons - discord interaction buttons
@@ -41,7 +45,7 @@ if there are any errors, you can open an **issue on github** or **contact me in
### config ### config
Our config documentation is moved to another file: Our config documentation is moved to another file:
[click here to view](CONFIG.md) [click here to view](./documentation/CONFIG.md)
### intents & permissions ### 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 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. To work the best, the bot needs `ADMINISTRATOR` permissions.
You can also configure your own 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 ## 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) © 2022 - DJdj Development | [website](https://www.dj-dj.be) | [discord](https://discord.com/invite/26vT9wt3n3)
+1 -1
View File
@@ -13,7 +13,7 @@ module.exports = () => {
.setColor(config.main_color) .setColor(config.main_color)
.setTitle("How to reset the database:") .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") .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]}) msg.channel.send({embeds:[databaseEmbed]})
} }
+68 -15
View File
@@ -12,7 +12,9 @@ module.exports = () => {
return return
} }
var currentTicketButtons = 0
var ticketButton = new discord.MessageActionRow() var ticketButton = new discord.MessageActionRow()
var ticketButton2 = new discord.MessageActionRow()
const getColor = (color) => { const getColor = (color) => {
if (color.toLowerCase() == "red"){ if (color.toLowerCase() == "red"){
@@ -31,8 +33,16 @@ module.exports = () => {
} }
if (config.options.ticket1.enabled){ if (config.options.ticket1.enabled){
if (currentTicketButtons < 4){
var localTicketButton = ticketButton
}else{
var localTicketButton = ticketButton2
}
currentTicketButtons = currentTicketButtons + 1
if (config.options.ticket1.isURL == false){ if (config.options.ticket1.isURL == false){
ticketButton.addComponents( localTicketButton.addComponents(
new discord.MessageButton() new discord.MessageButton()
.setCustomId("newTicket1") .setCustomId("newTicket1")
.setDisabled(false) .setDisabled(false)
@@ -40,7 +50,7 @@ module.exports = () => {
.setEmoji(config.options.ticket1.icon) .setEmoji(config.options.ticket1.icon)
) )
}else{ }else{
ticketButton.addComponents( localTicketButton.addComponents(
new discord.MessageButton() new discord.MessageButton()
.setDisabled(false) .setDisabled(false)
.setStyle("LINK") .setStyle("LINK")
@@ -51,8 +61,16 @@ module.exports = () => {
} }
if (config.options.ticket2.enabled){ if (config.options.ticket2.enabled){
if (currentTicketButtons < 4){
var localTicketButton = ticketButton
}else{
var localTicketButton = ticketButton2
}
currentTicketButtons = currentTicketButtons + 1
if (config.options.ticket2.isURL == false){ if (config.options.ticket2.isURL == false){
ticketButton.addComponents( localTicketButton.addComponents(
new discord.MessageButton() new discord.MessageButton()
.setCustomId("newTicket2") .setCustomId("newTicket2")
.setDisabled(false) .setDisabled(false)
@@ -60,7 +78,7 @@ module.exports = () => {
.setEmoji(config.options.ticket2.icon) .setEmoji(config.options.ticket2.icon)
) )
}else{ }else{
ticketButton.addComponents( localTicketButton.addComponents(
new discord.MessageButton() new discord.MessageButton()
.setDisabled(false) .setDisabled(false)
.setStyle("LINK") .setStyle("LINK")
@@ -71,8 +89,16 @@ module.exports = () => {
} }
if (config.options.ticket3.enabled){ if (config.options.ticket3.enabled){
if (currentTicketButtons < 4){
var localTicketButton = ticketButton
}else{
var localTicketButton = ticketButton2
}
currentTicketButtons = currentTicketButtons + 1
if (config.options.ticket3.isURL == false){ if (config.options.ticket3.isURL == false){
ticketButton.addComponents( localTicketButton.addComponents(
new discord.MessageButton() new discord.MessageButton()
.setCustomId("newTicket3") .setCustomId("newTicket3")
.setDisabled(false) .setDisabled(false)
@@ -80,7 +106,7 @@ module.exports = () => {
.setEmoji(config.options.ticket3.icon) .setEmoji(config.options.ticket3.icon)
) )
}else{ }else{
ticketButton.addComponents( localTicketButton.addComponents(
new discord.MessageButton() new discord.MessageButton()
.setDisabled(false) .setDisabled(false)
.setStyle("LINK") .setStyle("LINK")
@@ -91,8 +117,16 @@ module.exports = () => {
} }
if (config.options.ticket4.enabled){ if (config.options.ticket4.enabled){
if (currentTicketButtons < 4){
var localTicketButton = ticketButton
}else{
var localTicketButton = ticketButton2
}
currentTicketButtons = currentTicketButtons + 1
if (config.options.ticket4.isURL == false){ if (config.options.ticket4.isURL == false){
ticketButton.addComponents( localTicketButton.addComponents(
new discord.MessageButton() new discord.MessageButton()
.setCustomId("newTicket4") .setCustomId("newTicket4")
.setDisabled(false) .setDisabled(false)
@@ -100,7 +134,7 @@ module.exports = () => {
.setEmoji(config.options.ticket4.icon) .setEmoji(config.options.ticket4.icon)
) )
}else{ }else{
ticketButton.addComponents( localTicketButton.addComponents(
new discord.MessageButton() new discord.MessageButton()
.setDisabled(false) .setDisabled(false)
.setStyle("LINK") .setStyle("LINK")
@@ -111,8 +145,16 @@ module.exports = () => {
} }
if (config.options.ticket5.enabled){ if (config.options.ticket5.enabled){
if (currentTicketButtons < 4){
var localTicketButton = ticketButton
}else{
var localTicketButton = ticketButton2
}
currentTicketButtons = currentTicketButtons + 1
if (config.options.ticket5.isURL == false){ if (config.options.ticket5.isURL == false){
ticketButton.addComponents( localTicketButton.addComponents(
new discord.MessageButton() new discord.MessageButton()
.setCustomId("newTicket5") .setCustomId("newTicket5")
.setDisabled(false) .setDisabled(false)
@@ -120,7 +162,7 @@ module.exports = () => {
.setEmoji(config.options.ticket5.icon) .setEmoji(config.options.ticket5.icon)
) )
}else{ }else{
ticketButton.addComponents( localTicketButton.addComponents(
new discord.MessageButton() new discord.MessageButton()
.setDisabled(false) .setDisabled(false)
.setStyle("LINK") .setStyle("LINK")
@@ -131,8 +173,16 @@ module.exports = () => {
} }
if (config.options.ticket6.enabled){ if (config.options.ticket6.enabled){
if (currentTicketButtons < 4){
var localTicketButton = ticketButton
}else{
var localTicketButton = ticketButton2
}
currentTicketButtons = currentTicketButtons + 1
if (config.options.ticket6.isURL == false){ if (config.options.ticket6.isURL == false){
ticketButton.addComponents( localTicketButton.addComponents(
new discord.MessageButton() new discord.MessageButton()
.setCustomId("newTicket6") .setCustomId("newTicket6")
.setDisabled(false) .setDisabled(false)
@@ -140,7 +190,7 @@ module.exports = () => {
.setEmoji(config.options.ticket6.icon) .setEmoji(config.options.ticket6.icon)
) )
}else{ }else{
ticketButton.addComponents( localTicketButton.addComponents(
new discord.MessageButton() new discord.MessageButton()
.setDisabled(false) .setDisabled(false)
.setStyle("LINK") .setStyle("LINK")
@@ -171,7 +221,7 @@ module.exports = () => {
}else{ticketEmbed.setColor(config.main_color)} }else{ticketEmbed.setColor(config.main_color)}
if (config.layout.ticketMsg.footerEnabled){ if (config.layout.ticketMsg.footerEnabled){
ticketEmbed.setFooter(config.layout.ticketMsg.footer) ticketEmbed.setFooter({text:config.layout.ticketMsg.footer})
} }
if (config.layout.ticketMsg.thumbnailEnabled){ if (config.layout.ticketMsg.thumbnailEnabled){
ticketEmbed.setThumbnail(config.layout.ticketMsg.thumbnailURL) 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!_") 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!_")
if (currentTicketButtons <= 4){
msg.channel.send({embeds:[ticketEmbed],components:[ticketButton]}) var embedComponents = [ticketButton]
}else{var embedComponents = [ticketButton,ticketButton2]}
msg.channel.send({embeds:[ticketEmbed],components:embedComponents})
} }
+2 -2
View File
@@ -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 <user>` ➜ _Add a user to the ticket._\n`"+prefix+"ticket remove <user>` ➜ _Remove a user from the ticket._\n`"+prefix+"resetdatabase` ➜ _Steps to reset the database._") 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 <user>` ➜ _Add a user to the ticket._\n`"+prefix+"ticket remove <user>` ➜ _Remove a user from the ticket._\n`"+prefix+"resetdatabase` ➜ _Steps to reset the database._")
if (config.credits){ 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]}) msg.channel.send({embeds:[TicketHelpMsg]})
@@ -67,7 +67,7 @@ module.exports = () => {
var name = args[2] var name = args[2]
msg.channel.messages.fetchPinned().then(msglist => { msg.channel.messages.fetchPinned().then(msglist => {
if (msglist.last().author.id == client.user.id){ 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) rmsg.channel.setName(name)
}) })
}else{ }else{
+8 -8
View File
@@ -110,7 +110,7 @@ module.exports = () => {
}else{ticketEmbed.setColor(config.main_color)} }else{ticketEmbed.setColor(config.main_color)}
if (config.layout.ticketEmbed.footerEnabled){ if (config.layout.ticketEmbed.footerEnabled){
ticketEmbed.setFooter(config.layout.ticketEmbed.footer) ticketEmbed.setFooter({text:"config.layout.ticketEmbed.footer"})
} }
if (config.layout.ticketEmbed.thumbnailEnabled){ if (config.layout.ticketEmbed.thumbnailEnabled){
ticketEmbed.setThumbnail(config.layout.ticketEmbed.thumbnailURL) ticketEmbed.setThumbnail(config.layout.ticketEmbed.thumbnailURL)
@@ -227,16 +227,16 @@ module.exports = () => {
} }
var transcriptEmbed = new discord.MessageEmbed() var transcriptEmbed = new discord.MessageEmbed()
.setColor(transcriptColor) .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!") .setTitle("There is a new transcript!")
.setDescription(splittedTranscript[0]) .setDescription(splittedTranscript[0])
.setFooter("ticket closed by "+interaction.member.user.username) .setFooter({text:"ticket closed by "+interaction.member.user.username})
.setThumbnail(transcriptThumbnail) .setThumbnail(transcriptThumbnail)
if (transcript.length > 4000){ if (transcript.length > 4000){
var transcriptEmbed2 = new discord.MessageEmbed() var transcriptEmbed2 = new discord.MessageEmbed()
.setColor(transcriptColor) .setColor(transcriptColor)
.setAuthor(interaction.channel.name + " - ticket created by "+getuserNAME) .setAuthor({text:interaction.channel.name + " - ticket created by "+getuserNAME})
.setTitle("transcript #2") .setTitle("transcript #2")
.setDescription(splittedTranscript[1]) .setDescription(splittedTranscript[1])
.setFooter("ticket closed by "+interaction.member.user.username) .setFooter("ticket closed by "+interaction.member.user.username)
@@ -244,10 +244,10 @@ module.exports = () => {
var transcriptEmbed3 = new discord.MessageEmbed() var transcriptEmbed3 = new discord.MessageEmbed()
.setColor(transcriptColor) .setColor(transcriptColor)
.setAuthor(interaction.channel.name + " - ticket created by "+getuserNAME) .setAuthor({text:interaction.channel.name + " - ticket created by "+getuserNAME})
.setTitle("transcript #3") .setTitle("transcript #3")
.setDescription(splittedTranscript[1]) .setDescription(splittedTranscript[1])
.setFooter("ticket closed by "+interaction.member.user.username) .setFooter({text:"ticket closed by "+interaction.member.user.username})
.setThumbnail(transcriptThumbnail) .setThumbnail(transcriptThumbnail)
client.channels.cache.find(ch => ch.id == config.system.transcript_channel).send({embeds:[transcriptEmbed,transcriptEmbed2,transcriptEmbed3]}) 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){ }else if (transcript.length > 2000){
var transcriptEmbed2 = new discord.MessageEmbed() var transcriptEmbed2 = new discord.MessageEmbed()
.setColor(transcriptColor) .setColor(transcriptColor)
.setAuthor(interaction.channel.name + " - ticket created by "+getuserNAME) .setAuthor({text:interaction.channel.name + " - ticket created by "+getuserNAME})
.setTitle("transcript #2") .setTitle("transcript #2")
.setDescription(splittedTranscript[1]) .setDescription(splittedTranscript[1])
.setFooter("ticket closed by "+interaction.member.user.username) .setFooter({text:"ticket closed by "+interaction.member.user.username})
.setThumbnail(transcriptThumbnail) .setThumbnail(transcriptThumbnail)
client.channels.cache.find(ch => ch.id == config.system.transcript_channel).send({embeds:[transcriptEmbed,transcriptEmbed2]}) client.channels.cache.find(ch => ch.id == config.system.transcript_channel).send({embeds:[transcriptEmbed,transcriptEmbed2]})
@@ -1,5 +1,18 @@
# changelog # 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 ## v1.3.0
### added: ### added:
- now its possible to create 6 tickets instead of 4 - now its possible to create 6 tickets instead of 4
+2 -2
View File
@@ -1,6 +1,6 @@
# config file # config file
[![discord](https://img.shields.io/badge/discord-join%20our%20server-5865F2.svg?style=flat-square&logo=discord)](https://discord.com/invite/26vT9wt3n3) [![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) [![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) [![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! If you have an idea for new updates you can always say it in my discord server!
open-tickets v1.3.0 open-tickets v1.3.1
+26
View File
@@ -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!