From 5f19adf5617463905e74d585c5947a83ae38ab79 Mon Sep 17 00:00:00 2001
From: DJj123dj <80536295+DJj123dj@users.noreply.github.com>
Date: Wed, 30 Aug 2023 17:22:26 +0200
Subject: [PATCH] v3.4.3
---
.github/SECURITY.md | 7 +++---
README.md | 11 +++++++--
commands/change.js | 51 +++++++++++++++++++++++++---------------
commands/claim.js | 23 +++++++++++-------
commands/help.js | 2 +-
config.json | 2 +-
core/errorLogSystem.js | 5 ++++
core/utils/hiddendata.js | 2 +-
core/utils/liveStatus.js | 2 +-
index.js | 2 +-
language/arabic.json | 2 +-
language/custom.json | 2 +-
language/czech.json | 2 +-
language/danish.json | 2 +-
language/dutch.json | 2 +-
language/english.json | 2 +-
language/french.json | 2 +-
language/german.json | 2 +-
language/greek.json | 2 +-
language/hungarian.json | 2 +-
language/italian.json | 2 +-
language/norwegian.json | 2 +-
language/polish.json | 2 +-
language/portuguese.json | 2 +-
language/romanian.json | 2 +-
language/russian.json | 2 +-
language/slovenian.json | 2 +-
language/spanish.json | 2 +-
language/thai.json | 2 +-
language/turkish.json | 2 +-
language/ukrainian.json | 2 +-
package.json | 2 +-
32 files changed, 91 insertions(+), 60 deletions(-)
diff --git a/.github/SECURITY.md b/.github/SECURITY.md
index ec03cb6..d7ebbcf 100644
--- a/.github/SECURITY.md
+++ b/.github/SECURITY.md
@@ -10,10 +10,11 @@ Support for Open Ticket is only available for the versions specified below!
| Version | Supported |
|-----------|-------------------|
+| 3.4.3 | ✅ |
| 3.4.2 | ✅ |
-| 3.4.0 | ✅ |
-| 3.3.3 | 🟧 |
-| < 3.3.3 | ❌ |
+| 3.4.1 | ✅ |
+| 3.4.0 | 🟧 |
+| < 3.4.0 | ❌ |
## Reporting a Vulnerability
diff --git a/README.md b/README.md
index 6bbfbf0..97bb416 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,13 @@
+# Coming Soon: OPEN TICKET v4.0 🎉
+Open Ticket v4 is open ticket, but writting from the ground up! For the first time ever!
+There will be a massive improvement with the API that allows for plugins 30 times more advanced than the current ones! It will also be more stable and faster!
+
+It is expected to have a public beta release somewhere around 30 September!
+
+
-[](https://discord.com/invite/26vT9wt3n3) [](https://github.com/DJj123dj/open-ticket/releases/tag/v3.4.2) []() [](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE) [](https://docs.openticket.dj-dj.be)
+[](https://discord.com/invite/26vT9wt3n3) [](https://github.com/DJj123dj/open-ticket/releases/tag/v3.4.3) []() [](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE) [](https://docs.openticket.dj-dj.be)
### Open Ticket
Open Ticket is the most customisable discord ticket bot that you will ever find! There are more than 150 options to customise in the config! This includes html transcripts, unlimited amount of tickets, custom embeds & more! Did you know that even the html transcripts are highly customisable? Don't wait and check it out! If you're having trouble setting the bot up, feel free to join our support server and we will help you further!
@@ -64,7 +71,7 @@ Translators
|Ukrainian |anderskiy |
## links
-current version: _v3.4.2_
+current version: _v3.4.3_
changelog: [click here](https://docs.openticket.dj-dj.be/other/changelog)
documentation: [click here](https://docs.openticket.dj-dj.be/quick-start)
diff --git a/commands/change.js b/commands/change.js
index e85f586..b3e1b94 100644
--- a/commands/change.js
+++ b/commands/change.js
@@ -14,6 +14,7 @@ module.exports = () => {
if (!DISABLE.commands.text.change) client.on("messageCreate", async msg => {
if (!msg.content.startsWith(config.prefix+"change")) return
+ if (!msg.channel.isTextBased()) return
if (!msg.guild) return
if (!permsChecker.command(msg.author.id,msg.guild.id)){
@@ -26,26 +27,42 @@ module.exports = () => {
const ticketId = hiddendata.find(d => d.key == "type").value
const list = []
- config.options.forEach((o) => list.push(o.id))
+ config.options.forEach((o) => {
+ if (o.type == "ticket") list.push(o.id)
+ })
var newtype = msg.content.split(config.prefix+"change")[1].substring(1)
if (!newtype) return msg.channel.send({embeds:[bot.errorLog.invalidIdChooseFromList(list,l.errors.missingArgsDescription+" ``:\n`"+config.prefix+"change `")]})
- const newTicket = require("../core/utils/configParser").getTicketById(newtype)
+ const newTicket = require("../core/utils/configParser").getTicketById(newtype,true)
if (!newTicket) return msg.channel.send({embeds:[bot.errorLog.invalidIdChooseFromList(list,l.errors.missingArgsDescription+" ``:\n`"+config.prefix+"change `")]})
+ /**@type {discord.PermissionOverwriteManager} */
+ const prePermsManager = msg.channel.permissionOverwrites
+ const prePerms = prePermsManager.cache
+
/**@type {String} */
var chName = msg.channel.name
const splitted = chName.split("-")
const prefix = splitted.shift()
const name = (splitted.length > 0) ? splitted.join("-") : prefix
-
+
if (newTicket.category){
const parent = await msg.guild.channels.fetch(newTicket.category,{cache:true})
if (parent && parent.type == discord.ChannelType.GuildCategory) msg.channel.setParent(parent)
}
-
- msg.channel.setName(newTicket.channelprefix+name)
+
+ prePermsManager.set(prePerms)
+ msg.channel.setName(newTicket.channelprefix+name).catch(() => {
+ msg.channel.send({embeds:[bot.errorLog.failedRenameChannel]})
+ })
+
+ hiddendata.find((value,index) => {
+ if (value.key == "type"){
+ hiddendata[index] = {key:"type",value:newtype}
+ }
+ })
+
msg.channel.send({embeds:[bot.embeds.commands.changeEmbed(msg.author,newtype)]})
log("command","someone used the 'change' command",[{key:"user",value:msg.author.username}])
@@ -56,6 +73,7 @@ module.exports = () => {
if (!DISABLE.commands.slash.change) client.on("interactionCreate",async (interaction) => {
if (!interaction.isChatInputCommand()) return
if (interaction.commandName != "change") return
+ if (!interaction.channel.isTextBased()) return
if (!interaction.guild) return
if (!permsChecker.command(interaction.user.id,interaction.guild.id)){
@@ -69,7 +87,9 @@ module.exports = () => {
const ticketId = hiddendata.find(d => d.key == "type").value
const list = []
- config.options.forEach((o) => list.push(o.id))
+ config.options.forEach((o) => {
+ if (o.type == "ticket") list.push(o.id)
+ })
var newtype = interaction.options.getString("type",true)
const newTicket = require("../core/utils/configParser").getTicketById(newtype,true)
@@ -91,24 +111,17 @@ module.exports = () => {
if (parent && parent.type == discord.ChannelType.GuildCategory) interaction.channel.setParent(parent)
}
- await prePermsManager.set(prePerms)
- interaction.channel.setName(newTicket.channelprefix+name)
+ prePermsManager.set(prePerms)
+ interaction.channel.setName(newTicket.channelprefix+name).catch(() => {
+ interaction.channel.send({embeds:[bot.errorLog.failedRenameChannel]})
+ })
- var newHiddendata = hiddendata.data
- newHiddendata.find((value,index) => {
+ hiddendata.find((value,index) => {
if (value.key == "type"){
- newHiddendata[index] = {key:"type",value:newtype}
+ hiddendata[index] = {key:"type",value:newtype}
}
})
- const prevDescription = bot.hiddenData.removeHiddenData(firstmsg.embeds[0].description).description
- const newData = bot.hiddenData.writeHiddenData("ticketdata",newHiddendata)
- const newDescription = prevDescription+newData
- const newEmbed = new discord.EmbedBuilder(firstmsg.embeds[0].data)
- .setDescription(newDescription)
-
- firstmsg.edit({embeds:[newEmbed]})
-
interaction.editReply({embeds:[bot.embeds.commands.changeEmbed(interaction.user,newtype)]})
log("command","someone used the 'change' command",[{key:"user",value:interaction.user.username}])
diff --git a/commands/claim.js b/commands/claim.js
index 21c35dd..82dee24 100644
--- a/commands/claim.js
+++ b/commands/claim.js
@@ -14,7 +14,7 @@ const DISABLE = require("../core/api/api.json").disable
module.exports = () => {
bot.errorLog.log("debug","COMMANDS: loaded claim.js")
- if (!DISABLE.commands.text.claim) client.on("messageCreate",msg => {
+ if (!DISABLE.commands.text.claim) client.on("messageCreate", async msg => {
if (!msg.content.startsWith(config.prefix+"claim")) return
var user = msg.mentions.users.first()
@@ -34,14 +34,19 @@ module.exports = () => {
bot.hiddenData.writeHiddenData(msg.channel.id,hiddendata)
storage.set("claimData",msg.channel.id,claimingUser.id)
- const newEmbed = new embed(firstmsg.embeds[0].data)
- .setFooter({text:"claimed by: "+msg.author.username,iconURL:msg.author.displayAvatarURL()})
+ await msg.channel.messages.fetchPinned().then(msglist => {
+ var firstmsg = msglist.last()
+ if (firstmsg == undefined || firstmsg.author.id != client.user.id) return msg.channel.send({embeds:[bot.errorLog.notInATicket]})
+
+ const newEmbed = new embed(firstmsg.embeds[0].data)
+ .setFooter({text:"claimed by: "+msg.author.username,iconURL:msg.author.displayAvatarURL()})
- if (firstmsg.components[0].components[1] && firstmsg.components[0].components[1].disabled){
- firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowDisabledNoClaim],embeds:[newEmbed]})
- }else{
- firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormalNoClaim],embeds:[newEmbed]})
- }
+ if (firstmsg.components[0].components[1] && firstmsg.components[0].components[1].disabled){
+ firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowDisabledNoClaim],embeds:[newEmbed]})
+ }else{
+ firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormalNoClaim],embeds:[newEmbed]})
+ }
+ })
msg.channel.send({embeds:[bot.embeds.commands.claimEmbed(claimingUser,msg.author)]})
@@ -74,7 +79,7 @@ module.exports = () => {
bot.hiddenData.writeHiddenData(interaction.channel.id,hiddendata)
storage.set("claimData",interaction.channel.id,user.id)
- interaction.channel.messages.fetchPinned().then(msglist => {
+ await interaction.channel.messages.fetchPinned().then(msglist => {
var firstmsg = msglist.last()
if (firstmsg == undefined || firstmsg.author.id != client.user.id) return msg.channel.send({embeds:[bot.errorLog.notInATicket]})
diff --git a/commands/help.js b/commands/help.js
index e0ac3b8..9038382 100644
--- a/commands/help.js
+++ b/commands/help.js
@@ -38,7 +38,7 @@ module.exports = () => {
}
if (args[1]){
- if (!args[1].startsWith("close") && !args[1].startsWith("delete") && !args[1].startsWith("remove") && !args[1].startsWith("add") && !args[1].startsWith("msg") && !args[1].startsWith("remove") && !args[1].startsWith("rename") && !args[1].startsWith("reopen")){
+ if (!args[1].startsWith("close") && !args[1].startsWith("delete") && !args[1].startsWith("remove") && !args[1].startsWith("add") && !args[1].startsWith("msg") && !args[1].startsWith("remove") && !args[1].startsWith("rename") && !args[1].startsWith("reopen") && !args[1].startsWith("change") && !args[1].startsWith("claim") && !args[1].startsWith("unclaim")){
msg.channel.send({embeds:[helpEmbed]})
log("command","someone used the 'help' command",[{key:"user",value:msg.author.username}])
APIEvents.onCommand("help",true,msg.author,msg.channel,msg.guild,new Date())
diff --git a/config.json b/config.json
index bb8aaf2..c6382b8 100644
--- a/config.json
+++ b/config.json
@@ -111,7 +111,7 @@
"dropdown":false,
"enableFooter":false,
- "footer":"Open Ticket v3.4.2 - I'm a footer!",
+ "footer":"Open Ticket v3.4.3 - I'm a footer!",
"enableFooterImage":false,
"footerImage":"https://www.example.com/catmemes/cat.png",
diff --git a/core/errorLogSystem.js b/core/errorLogSystem.js
index f36b159..20593b8 100644
--- a/core/errorLogSystem.js
+++ b/core/errorLogSystem.js
@@ -58,6 +58,11 @@ exports.invalidIdChooseFromList = (list,message) => {
return x
}
+exports.failedRenameChannel = new embed()
+ .setColor(c.Red)
+ .setTitle(":x: Failed to rename channel")
+ .setDescription("Discord channels can only be renamed twice every 10 minutes! Open Ticket can't do anything about this error!")
+
exports.notInATicket = new embed()
.setColor(c.Red)
.setTitle(":x: "+l.errors.notInTicketTitle)
diff --git a/core/utils/hiddendata.js b/core/utils/hiddendata.js
index e5c3955..c3de1f4 100644
--- a/core/utils/hiddendata.js
+++ b/core/utils/hiddendata.js
@@ -10,7 +10,7 @@ const storage = require("../../index").storage
exports.readHiddenData = (channelid) => {
const content = storage.get("HIDDENDATA",channelid)
- if (!content) return {type:"",data:[],status:false}
+ if (!content) return []
try {
return JSON.parse(content)
diff --git a/core/utils/liveStatus.js b/core/utils/liveStatus.js
index 6e641d9..31df402 100644
--- a/core/utils/liveStatus.js
+++ b/core/utils/liveStatus.js
@@ -189,7 +189,7 @@ exports.liveStatusUploadManager = async (err) => {
//system:config.system
},
language:config.languageFile,
- version:"3.4.2",
+ version:"3.4.3",
slashcmds:slashMode,
transcripts:transcriptMode,
plugins:fs.readdirSync("./plugins"),
diff --git a/index.js b/index.js
index b79f3c0..f9e887a 100644
--- a/index.js
+++ b/index.js
@@ -28,7 +28,7 @@
INFORMATION:
============
- Open Ticket v3.4.2 - © DJdj Development
+ Open Ticket v3.4.3 - © DJdj Development
discord: https://discord.dj-dj.be
website: https://www.dj-dj.be
diff --git a/language/arabic.json b/language/arabic.json
index bac59d9..1efc50f 100644
--- a/language/arabic.json
+++ b/language/arabic.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"ChilledBroke#9986 & M4#5882",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors": {
"missingArgsTitle": "قيمة غير صالحة!",
diff --git a/language/custom.json b/language/custom.json
index 03d52f1..b48ab3a 100644
--- a/language/custom.json
+++ b/language/custom.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"DJdj Development",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Invalid Arguments!",
diff --git a/language/czech.json b/language/czech.json
index b47356a..b430990 100644
--- a/language/czech.json
+++ b/language/czech.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"t0miiis#3022",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Neplatny Argument!",
diff --git a/language/danish.json b/language/danish.json
index 1585ada..6a61677 100644
--- a/language/danish.json
+++ b/language/danish.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"the_gamer#5095",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors": {
"missingArgsTitle": "Ugyldigt Argument!",
diff --git a/language/dutch.json b/language/dutch.json
index e35a0f5..8103a4f 100644
--- a/language/dutch.json
+++ b/language/dutch.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"DJj123dj#1706",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Onjuiste parameters!",
diff --git a/language/english.json b/language/english.json
index 92f9599..262c311 100644
--- a/language/english.json
+++ b/language/english.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"DJdj Development",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Invalid Arguments!",
diff --git a/language/french.json b/language/french.json
index d0315f0..7713b58 100644
--- a/language/french.json
+++ b/language/french.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"Sanke#6086",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Arguments invalides!",
diff --git a/language/german.json b/language/german.json
index 4e0d0f6..74ebe50 100644
--- a/language/german.json
+++ b/language/german.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"david.#8276 ",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Ungültiges Argument!",
diff --git a/language/greek.json b/language/greek.json
index 66f071e..3de8980 100644
--- a/language/greek.json
+++ b/language/greek.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"ꙅoᴎɒᎸɘƚꙅ#3744",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Invalid Arguments!",
diff --git a/language/hungarian.json b/language/hungarian.json
index 23e2703..da7f98d 100644
--- a/language/hungarian.json
+++ b/language/hungarian.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"Snowy",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Hibás paraméterek!",
diff --git a/language/italian.json b/language/italian.json
index ec39801..407ad21 100644
--- a/language/italian.json
+++ b/language/italian.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"Maurizio#0268",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Argomenti non validi!",
diff --git a/language/norwegian.json b/language/norwegian.json
index 3dec00d..f95b75c 100644
--- a/language/norwegian.json
+++ b/language/norwegian.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"NoOneNook#0266",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Ugyldige argumenter!",
diff --git a/language/polish.json b/language/polish.json
index c838e7b..1de84da 100644
--- a/language/polish.json
+++ b/language/polish.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"MKevas#8311",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Nieprawidłowe argumenty!",
diff --git a/language/portuguese.json b/language/portuguese.json
index 073ee17..1c08fe6 100644
--- a/language/portuguese.json
+++ b/language/portuguese.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"QuirAddon#9778",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Argumentos inválidos!",
diff --git a/language/romanian.json b/language/romanian.json
index a353aea..bfead56 100644
--- a/language/romanian.json
+++ b/language/romanian.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"Sanke#6086",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Argumente Invalide",
diff --git a/language/russian.json b/language/russian.json
index 9ff9f74..deb573a 100644
--- a/language/russian.json
+++ b/language/russian.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"Apexo#0723",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Неверные аргументы!",
diff --git a/language/slovenian.json b/language/slovenian.json
index 43128be..98d2b8c 100644
--- a/language/slovenian.json
+++ b/language/slovenian.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"n1kkec#5341",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Napačen argument!",
diff --git a/language/spanish.json b/language/spanish.json
index 0d6e210..b26aad6 100644
--- a/language/spanish.json
+++ b/language/spanish.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"Redactado#1673 & josuens14#5267",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"¡Argumentos inválidos!",
diff --git a/language/thai.json b/language/thai.json
index 206e6b7..c5cdf69 100644
--- a/language/thai.json
+++ b/language/thai.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"Mods HD#0661",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"อาร์กิวเมนต์ไม่ถูกต้อง!",
diff --git a/language/turkish.json b/language/turkish.json
index 77e5222..e951208 100644
--- a/language/turkish.json
+++ b/language/turkish.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"Hydrâelčhâvø#1575",
- "_INFO":"This file is a translation for open ticket 3.4.2",
+ "_INFO":"This file is a translation for open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Geçersiz argümanlar!",
diff --git a/language/ukrainian.json b/language/ukrainian.json
index e8f5e26..df6a00d 100644
--- a/language/ukrainian.json
+++ b/language/ukrainian.json
@@ -1,6 +1,6 @@
{
"_CREDITS":"Anderskiy#4093",
- "_INFO":"Цей файл є перекладом для open ticket 3.4.2",
+ "_INFO":"Цей файл є перекладом для open ticket 3.4.3",
"errors":{
"missingArgsTitle":"Невірні аргументи!",
diff --git a/package.json b/package.json
index c2d6201..1a7ef42 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "open-ticket",
- "version": "3.4.2",
+ "version": "3.4.3",
"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": {