Compare commits

..
19 Commits
Author SHA1 Message Date
Jasper 56a6540663 v3.3.2 extra
v3.3.2 extra
2023-04-19 18:45:55 +02:00
DJj123dj 5f8812d261 v3.3.2 push 2 2023-04-19 18:45:12 +02:00
Jasper 7a3dcf4c42 Open Ticket v3.3.2
Open Ticket v3.3.2
2023-04-19 18:43:38 +02:00
DJj123dj 7cebd4dd6a Merge branch 'dev' of https://github.com/DJj123dj/open-ticket into dev 2023-04-19 18:39:23 +02:00
DJj123dj 27912a0c37 v3.3.2 2023-04-19 18:39:21 +02:00
Jasper 67871d885a Update dev
update dev branch
2023-03-23 14:22:29 +01:00
Jasper 1bd0d013ed Update config.json 2023-03-23 14:21:39 +01:00
Jasper a074a17519 Update issue templates 2023-03-23 14:15:25 +01:00
Jasper 67af96ef5c Update SECURITY.md 2023-03-23 14:10:38 +01:00
Jasper a041f28cf7 Update CONTRIBUTING.md 2023-03-23 14:10:03 +01:00
Jasper a8c9c2ea8d Create SECURITY.md 2023-03-23 13:35:08 +01:00
Jasper 8748301b04 Open Ticket v3.3.1
Open Ticket v3.3.1
2023-03-23 12:51:58 +01:00
DJj123dj 2d7a7b5728 v3.3.1 push 4 2023-03-23 12:46:53 +01:00
DJj123dj 0807ca884c Update ticketAutoclose.js 2023-03-21 20:10:06 +01:00
DJj123dj 0ead037fa8 v3.3.1 push 3 (autoclose spam fix) 2023-03-21 19:49:12 +01:00
DJj123dj 4287c11bf1 v3.3.1 push 2 (fixed dropdown crash) 2023-03-21 17:38:15 +01:00
DJj123dj 69fdc7ccf0 v3.3.1 BUG FIXES! (+ added Slovenian) 2023-03-20 20:01:09 +01:00
Jasper 6c213306b6 Add Slovenian language
add slovenian language
2023-03-19 12:51:12 +01:00
n1kkec 4096e8196d feat(language): add slovenian language 2023-03-19 12:47:24 +01:00
29 changed files with 383 additions and 129 deletions
+42 -3
View File
@@ -1,3 +1,42 @@
# comming soon
For now on, you can create a ticket in our server:
https://discord.dj-dj.be
# Contributing
## Translation
### Step 1: checking
1. [Check if the language isn't already in open ticket!](/language/)
2. Check if the current translation is up-to-date!
3. Can you edit/write JSON?
If there is translation missing & you can write json, then go to the next step!
### Step 2: translating
**RULES:**
- Always upload to the [__`dev` branch!__](https://github.com/DJj123dj/open-ticket/tree/dev)
- Don't change anything else, except the translation you are adding!
- Translations are checked before uploading, so don't write things that aren't specified in the json file
- Always start translating from `english.json` or `custom.json`! Never from another language.
If you translate, you need to change 2 files! The first one is required, the other one is optional & will be added by us if you don't do it!
1. add `yourlanguage.json` to the `/language/` directory
2. (OPTIONAL) add your discord name & tag in the translator table in `README.md`
### Step 3: waiting
Translations will always be added in the **next version** of Open Ticket! They will never be added to the `main` branch directly without anything else! This means that it can take some time before your translation is in the official version!
## Writing plugins
We are going to create an official repository for plugins soon!
But don't worry! You can already write some plugins!
**RULES:**
- Always specify the versions that the plugin is compatible with!
- If extra npm dependencies are needed, then they also need to be specified!
- If there are errors while you write a plugin/edit the code in some way. Then we can't help you with fixing the bug. We only fix bugs that are part of an unedited version of Open Ticket!
## Other versions of contributing
If you want to contribute in another way, feel free to join [our discord server](https://discord.dj-dj.be) & talk about how you are going to do it. We will always help you!
<br>
CONTRIBUTING GUIDELINES - Last updated: 23/3/2023<br>
© DJdj Development<br><br>
Website: https://www.dj-dj.be <br>
Discord: https://discord.dj-dj.be <br>
Email: support@dj-dj.be <br>
Open Ticket website: https://openticket.dj-dj.be
+2 -2
View File
@@ -1,9 +1,9 @@
---
name: Bug report
about: Create a report to help us improve Open Ticket
about: Report bugs to help us improve open ticket!
title: "[BUG] your bug"
labels: bug
assignees: ''
assignees: DJj123dj
---
+2 -2
View File
@@ -1,9 +1,9 @@
---
name: Plugin
about: Show your open ticket plugins here!
about: Show your plugin to the developers from open ticket!
title: "[PLUGIN] your plugin"
labels: plugin
assignees: ''
assignees: DJj123dj
---
+41
View File
@@ -0,0 +1,41 @@
# Security Policy
## Supported Versions
Support for Open Ticket is only available for the versions specified below!
✅ Supported
🟧 Partially Supported
❌ Not Supported
| Version | Supported |
| ------- | ------------------ |
| 3.3.2 | :white_check_mark: |
| 3.3.0 | 🟧 |
| 3.2.2 | 🟧 |
| < 3.2.2 | :x: |
## Reporting a Vulnerability
You can report Vulnerabilities, errors & bugs in the following ways:
- Creating an issue on github
- Creating a ticket in our discord server
- Reporting the bug in DM on discord (DJj123dj#1706)
- Emailing support@dj-dj.be
If your report an error, be clear about what is going on.
Specify the version & language of the bot together with when the error happend. (for example: when I click the close button)
Send screenshots from the error if possible, and send openticketdebug.txt (or a screenshot of it) to us.
Don't just report the error and never reply again! It can be possible that we need you for more information!
## Contributing
Visit [Contributing.md](/.github/CONTRIBUTING.md) for rules about translating & adding features!
<br>
SECURITY POLICY - Last updated: 23/3/2023<br>
© DJdj Development<br><br>
Website: https://www.dj-dj.be <br>
Discord: https://discord.dj-dj.be <br>
Email: support@dj-dj.be <br>
Open Ticket website: https://openticket.dj-dj.be
+3 -2
View File
@@ -1,6 +1,6 @@
<img src="https://www.dj-dj.be/wp-content/uploads/2023/02/open-ticket-cropped.png" alt="Open Ticket" width="600px">
[![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.3.0-brightgreen.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/releases/tag/v3.3.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) [![stars](https://img.shields.io/github/stars/djj123dj/open-ticket?color=yellow&label=stars&logo=github&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.3.2-brightgreen.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/releases/tag/v3.3.2) [![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) [![stars](https://img.shields.io/github/stars/djj123dj/open-ticket?color=yellow&label=stars&logo=github&style=flat-square)](https://docs.openticket.dj-dj.be)
### Open Ticket
Open Ticket is of the most customisable discord ticket bots of all time!
@@ -59,9 +59,10 @@ Translators
|Russian |Apexo#0723 |
|Turkish |Hydrâelčhâvø#1575 |
|Polish |MKevas#8311 |
|Slovenian |n1kkec#5341 |
## links
current version: _v3.3.0_
current version: _v3.3.2_
</br>changelog: [click here](https://docs.openticket.dj-dj.be/other/changelog)
</br>documentation: [click here](https://docs.openticket.dj-dj.be/quick-start)
+12 -14
View File
@@ -34,18 +34,17 @@ module.exports = () => {
const hiddendata = hdraw.hiddenData
const ticketId = hiddendata.data.find(d => d.key == "type").value
hiddendata.data.push({key:"claimedby",value:interaction.user.id})
storage.set("claimData",interaction.channel.id,interaction.user.id)
hiddendata.data.push({key:"claimedby",value:claimingUser.id})
storage.set("claimData",msg.channel.id,claimingUser.id)
const newEmbed = new embed(firstmsg.embeds[0].data)
.setFooter({text:"claimed by: "+interaction.user.tag,iconURL:interaction.user.displayAvatarURL()})
.setFooter({text:"claimed by: "+msg.author.tag,iconURL:msg.author.displayAvatarURL()})
.setDescription(hdraw.description+bot.hiddenData.writeHiddenData(hiddendata.type,hiddendata.data))
if (!firstmsg.components[0].components[1].disabled){
firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormalNoClaim],embeds:[newEmbed]})
}else if (firstmsg.components[0].components[1].disabled){
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)]})
@@ -67,7 +66,7 @@ module.exports = () => {
if (!interaction.guild) return
if (!permsChecker.command(interaction.user.id,interaction.guild.id)){
permsChecker.sendUserNoPerms(interaction.user)
return
return interaction.reply({content:":x: "+l.errors.noPermsTitle,ephemeral:true})
}
await interaction.deferReply()
@@ -80,18 +79,17 @@ module.exports = () => {
const hiddendata = hdraw.hiddenData
const ticketId = hiddendata.data.find(d => d.key == "type").value
hiddendata.data.push({key:"claimedby",value:interaction.user.id})
storage.set("claimData",interaction.channel.id,interaction.user.id)
hiddendata.data.push({key:"claimedby",value:user.id})
storage.set("claimData",interaction.channel.id,user.id)
const newEmbed = new embed(firstmsg.embeds[0].data)
.setFooter({text:"claimed by: "+user.tag,iconURL:user.displayAvatarURL()})
.setDescription(hdraw.description+bot.hiddenData.writeHiddenData(hiddendata.type,hiddendata.data))
if (!firstmsg.components[0].components[1].disabled){
firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormalNoClaim],embeds:[newEmbed]})
}else if (firstmsg.components[0].components[1].disabled){
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]})
}
interaction.editReply({embeds:[bot.embeds.commands.claimEmbed(user,interaction.user)]})
+8 -9
View File
@@ -35,7 +35,7 @@ module.exports = () => {
const ticketId = hiddendata.data.find(d => d.key == "type").value
hiddendata.data.push({key:"claimedby",value:"false"})
storage.set("claimData",interaction.channel.id,"false")
storage.set("claimData",msg.channel.id,"false")
const newEmbed = new embed(firstmsg.embeds[0].data)
.setDescription(hdraw.description+bot.hiddenData.writeHiddenData(hiddendata.type,hiddendata.data))
@@ -48,11 +48,10 @@ module.exports = () => {
newEmbed.setFooter(null)
}
if (!firstmsg.components[0].components[1].disabled){
firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormal],embeds:[newEmbed]})
}else if (firstmsg.components[0].components[1].disabled){
if (firstmsg.components[0].components[1] && firstmsg.components[0].components[1].disabled){
firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowDisabled],embeds:[newEmbed]})
}else{
firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormal],embeds:[newEmbed]})
}
msg.channel.send({embeds:[bot.embeds.commands.unclaimEmbed(msg.author)]})
@@ -73,6 +72,7 @@ module.exports = () => {
if (!interaction.guild) return
if (!permsChecker.command(interaction.user.id,interaction.guild.id)){
permsChecker.sendUserNoPerms(interaction.user)
interaction.reply({content:":x: "+l.errors.noPermsTitle,ephemeral:true})
return
}
@@ -104,11 +104,10 @@ module.exports = () => {
newEmbed.setFooter(null)
}
if (!firstmsg.components[0].components[1].disabled){
firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormal],embeds:[newEmbed]})
}else if (firstmsg.components[0].components[1].disabled){
if (firstmsg.components[0].components[1] && firstmsg.components[0].components[1].disabled){
firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowDisabled],embeds:[newEmbed]})
}else{
firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormal],embeds:[newEmbed]})
}
interaction.editReply({embeds:[bot.embeds.commands.unclaimEmbed(interaction.user)]})
+9 -2
View File
@@ -40,8 +40,9 @@
"color":"gray",
"adminroles":["role id"],
"readonlyAdminroles":["role id"],
"channelprefix":"question-",
"category":"category id",
"category":"category id (or leave empty)",
"message":"You created a ticket!",
"enableDmOnOpen":true,
"ticketmessage":"The staff will help you soon!\n\n*Click on the button below to close the ticket!*",
@@ -101,11 +102,17 @@
"dropdown":false,
"enableFooter":false,
"footer":"Open Ticket v3.3.0 - I'm a footer!",
"footer":"Open Ticket v3.3.2 - I'm a footer!",
"enableFooterImage":false,
"footerImage":"https://www.example.com/catmemes/cat.png",
"enableThumbnail":false,
"thumbnail":"https://www.example.com/catmemes/cat.png",
"enableImage":false,
"image":"https://www.example.com/catmemes/cat.png",
"enableCustomColor":false,
"color":"#ffffff",
+1 -1
View File
@@ -427,7 +427,7 @@ exports.checker = async () => {
checkType(config.languageFile,"string","languagefile")
const lf = config.languageFile
if (!lf.startsWith("custom") && !lf.startsWith("english") && !lf.startsWith("dutch") && !lf.startsWith("romanian") && !lf.startsWith("german") && !lf.startsWith("arabic") && !lf.startsWith("spanish") && !lf.startsWith("portuguese") && !lf.startsWith("french") && !lf.startsWith("italian") && !lf.startsWith("czech") && !lf.startsWith("danish") && !lf.startsWith("russian") && !lf.startsWith("turkish") && !lf.startsWith("polish")){
if (!lf.startsWith("custom") && !lf.startsWith("english") && !lf.startsWith("dutch") && !lf.startsWith("romanian") && !lf.startsWith("german") && !lf.startsWith("arabic") && !lf.startsWith("spanish") && !lf.startsWith("portuguese") && !lf.startsWith("french") && !lf.startsWith("italian") && !lf.startsWith("czech") && !lf.startsWith("danish") && !lf.startsWith("russian") && !lf.startsWith("turkish") && !lf.startsWith("polish") && !lf.startsWith("slovenian")){
createError("'languagefile' | invalid language, more info in the wiki")
}
@@ -10,6 +10,7 @@ const storage = bot.storage
const hiddendata = bot.hiddenData
const embed = discord.EmbedBuilder
const mc = config.color
const permsChecker = require("../../../utils/permisssionChecker")
const button = discord.ButtonBuilder
const arb = discord.ActionRowBuilder
@@ -22,9 +23,15 @@ module.exports = () => {
if (interaction.customId != "OTclaimTicket") return
try {
interaction.deferUpdate()
await interaction.deferUpdate()
}catch{}
if (!interaction.guild) return
if (!permsChecker.command(interaction.user.id,interaction.guild.id)){
permsChecker.sendUserNoPerms(interaction.user)
return
}
interaction.channel.messages.fetchPinned().then(msglist => {
/**@type {discord.Message} */
var firstmsg = msglist.last()
@@ -40,12 +47,13 @@ module.exports = () => {
.setFooter({text:"claimed by: "+interaction.user.tag,iconURL:interaction.user.displayAvatarURL()})
.setDescription(hdraw.description+bot.hiddenData.writeHiddenData(hiddendata.type,hiddendata.data))
if (!firstmsg.components[0].components[1].disabled){
firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormalNoClaim],embeds:[newEmbed]})
}else if (firstmsg.components[0].components[1].disabled){
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]})
}
interaction.channel.send({embeds:[bot.embeds.commands.claimEmbed(interaction.user,interaction.user)]})
})
})
}
@@ -23,7 +23,7 @@ module.exports = () => {
if (interaction.customId != "OTcloseTicketTrue") return
try {
interaction.deferUpdate()
await interaction.deferUpdate()
} catch{}
if (closeTicketButtonChecker == true) return
@@ -22,7 +22,7 @@ module.exports = () => {
if (!interaction.isButton()) return
if (interaction.customId != "OTdeleteTicketTrue") return
interaction.deferUpdate()
await interaction.deferUpdate()
if (deleteTicketButtonChecker == true) return
deleteTicketButtonChecker = true
@@ -62,7 +62,7 @@ module.exports = () => {
if (!interaction.isButton()) return
if (interaction.customId != "OTdeleteTicketTrue1") return
interaction.deferUpdate()
await interaction.deferUpdate()
if (deleteTicketButtonChecker1 == true) return
deleteTicketButtonChecker1 = true
@@ -17,11 +17,11 @@ const bs = discord.ButtonStyle
module.exports = () => {
//REOPEN
client.on("interactionCreate",(interaction) => {
client.on("interactionCreate",async (interaction) => {
if (!interaction.isButton()) return
if (interaction.customId != "OTreopenTicket") return
interaction.deferUpdate()
await interaction.deferUpdate()
interaction.message.edit({embeds:[bot.embeds.commands.reopenEmbed(interaction.user)],components:[bot.buttons.close.openRowNormal]})
require("../../../ticketActions/ticketReopener").reopenTicket(interaction.guild,interaction.channel,interaction.user)
})
+12 -12
View File
@@ -16,22 +16,22 @@ const bs = discord.ButtonStyle
module.exports = () => {
//CLOSE
client.on("interactionCreate",interaction => {
client.on("interactionCreate",async interaction => {
if (!interaction.isButton()) return
if (interaction.customId != "OTcloseTicket") return
try {
interaction.deferUpdate()
await interaction.deferUpdate()
} catch{}
interaction.message.edit({components:[bot.buttons.verifybars.closeVerifyBar]})
})
client.on("interactionCreate",interaction => {
client.on("interactionCreate",async interaction => {
if (!interaction.isButton()) return
if (interaction.customId != "OTcloseTicketFalse") return
try {
interaction.deferUpdate()
await interaction.deferUpdate()
} catch{}
if (interaction.message.pinned && interaction.message.author.id == client.user.id){
@@ -47,22 +47,22 @@ module.exports = () => {
})
//DELETE
client.on("interactionCreate",interaction => {
client.on("interactionCreate",async interaction => {
if (!interaction.isButton()) return
if (interaction.customId != "OTdeleteTicket") return
try {
interaction.deferUpdate()
await interaction.deferUpdate()
} catch{}
interaction.message.edit({components:[bot.buttons.verifybars.deleteVerifyBar]})
})
client.on("interactionCreate",interaction => {
client.on("interactionCreate",async interaction => {
if (!interaction.isButton()) return
if (interaction.customId != "OTdeleteTicketFalse") return
try {
interaction.deferUpdate()
await interaction.deferUpdate()
} catch{}
if (interaction.message.pinned && interaction.message.author.id == client.user.id){
@@ -78,22 +78,22 @@ module.exports = () => {
})
//DELETE NO TRANSCRIPT
client.on("interactionCreate",interaction => {
client.on("interactionCreate",async interaction => {
if (!interaction.isButton()) return
if (interaction.customId != "OTdeleteTicket1") return
try {
interaction.deferUpdate()
await interaction.deferUpdate()
} catch{}
interaction.message.edit({components:[bot.buttons.verifybars.delete1VerifyBar]})
})
client.on("interactionCreate",interaction => {
client.on("interactionCreate",async interaction => {
if (!interaction.isButton()) return
if (interaction.customId != "OTdeleteTicketFalse1") return
try {
interaction.deferUpdate()
await interaction.deferUpdate()
} catch{}
interaction.message.edit({components:[bot.buttons.close.closeCommandRow]})
})
+2 -2
View File
@@ -11,7 +11,7 @@ const APIEvents = require("./api/modules/events")
module.exports = async () => {
const chalk = await (await import("chalk")).default
client.on("interactionCreate",(interaction) => {
client.on("interactionCreate",async (interaction) => {
if (!interaction.isButton() && !interaction.isStringSelectMenu()) return
if (interaction.isButton() && !interaction.customId.startsWith("newR")) return
if (interaction.isStringSelectMenu() && !(interaction.customId == "OTdropdownMenu")) return
@@ -32,7 +32,7 @@ module.exports = async () => {
return
}else{
try {
interaction.deferUpdate()
await interaction.deferUpdate()
} catch{}
}
+38 -30
View File
@@ -8,41 +8,49 @@ const storage = bot.storage
module.exports = () => {
setInterval(async () => {
const tickets = storage.getCategory("autocloseTickets")
if (!tickets) return
tickets.forEach(async (t) => {
if (t.value == "false" || t.value == 0 || typeof t.value != "number") return
const channel = await client.channels.fetch(t.key,{cache:true})
if (!channel || !channel.isTextBased()) return
try{
const tickets = storage.getCategory("autocloseTickets")
if (!tickets) return
tickets.forEach(async (t) => {
if (t.value == "false" || t.value == 0 || typeof t.value != "number") return
try{
const message = (await channel.messages.fetch({limit:10})).first()
if (!message) return
const channel = await client.channels.fetch(t.key,{cache:true})
if (!channel || !channel.isTextBased()) return
const secondsSLM = Math.round((new Date().getTime() - message.createdTimestamp)/1000)
const hoursSLM = secondsSLM/3600
const message = (await channel.messages.fetch({limit:10})).first()
if (!message) return
if (hoursSLM > t.value){
/**@type {discord.Guild|false} */
const guild = client.guilds.cache.find((g) => g.id == channel.guild.id)
if (!guild) return
const clientMember = guild.members.cache.find((m) => m.id == client.user.id)
if (!clientMember) return
const secondsSLM = Math.round((new Date().getTime() - message.createdTimestamp)/1000)
const hoursSLM = secondsSLM/3600
var name = channel.name
var prefix = ""
const tickets = config.options
tickets.forEach((ticket) => {
if (name.startsWith(ticket.channelprefix)){
prefix = ticket.channelprefix
}
})
if (hoursSLM > t.value){
/**@type {discord.Guild|false} */
const guild = client.guilds.cache.find((g) => g.id == channel.guild.id)
if (!guild) return
const clientMember = guild.members.cache.find((m) => m.id == client.user.id)
if (!clientMember) return
require("./ticketCloser").closeManager(clientMember,channel,prefix,"close","OTautoclose",true)
storage.delete("autocloseTickets",channel.id)
var name = channel.name
var prefix = ""
const tickets = config.options
tickets.forEach((ticket) => {
if (name.startsWith(ticket.channelprefix)){
prefix = ticket.channelprefix
}
})
channel.send({embeds:[bot.embeds.commands.autocloseSignalEmbed(client.user,t.value)],components:[bot.buttons.close.closeCommandRow]})
require("./ticketCloser").closeManager(clientMember,channel,prefix,"close","OTautoclose",true)
storage.delete("autocloseTickets",channel.id)
channel.send({embeds:[bot.embeds.commands.autocloseSignalEmbed(client.user,t.value)],components:[bot.buttons.close.closeCommandRow]})
}
}catch{
log("system","can't find autoclose channel with ID: "+t.key)
storage.delete("autocloseTickets",t.key)
}
})
},2000)
})
}catch{}
},120000)
}
+4 -3
View File
@@ -131,7 +131,8 @@ exports.closeManager = async (member,channel,prefix,mode,reason,nomessage) => {
permissionArray.push({
id:adminrole,
type:"role",
allow:[pfb.AddReactions,pfb.AttachFiles,pfb.EmbedLinks,pfb.SendMessages,pfb.ViewChannel]
allow:[pfb.AddReactions,pfb.AttachFiles,pfb.EmbedLinks,pfb.SendMessages,pfb.ViewChannel],
deny:[]
})
}catch{
log("system","invalid role! At 'config.json => main_adminroles:"+index)
@@ -182,8 +183,8 @@ exports.closeManager = async (member,channel,prefix,mode,reason,nomessage) => {
permissionArray.push({
id:adminrole,
type:"role",
allow:[pfb.AddReactions,pfb.ViewChannel],
deny:[pfb.AttachFiles,pfb.EmbedLinks,pfb.SendMessages]
allow:[pfb.AddReactions,pfb.ViewChannel,pfb.AttachFiles,pfb.EmbedLinks,pfb.SendMessages],
deny:[]
})
}catch{
log("system","invalid role! At 'config.json => options/ticket/...:"+index)
+28 -14
View File
@@ -10,13 +10,12 @@ const storage = bot.storage
module.exports = () => {
//dropdown placeholder
client.on("interactionCreate",(interaction) => {
client.on("interactionCreate",async (interaction) => {
if (!interaction.isStringSelectMenu()) return
if (interaction.customId != "OTdropdownMenu") return
if (interaction.values.includes("OTChooseTicket")){
interaction.deferUpdate()
await interaction.deferUpdate()
}
})
@@ -37,7 +36,7 @@ module.exports = () => {
if (interaction.customId.startsWith("OTnewT")){
const optionid = interaction.customId.split("OTnewT")[1]
if (!optionid){
interaction.reply({embeds:[bot.errorLog.serverError(l.errors.ticketDoesntExist)]})
await interaction.reply({embeds:[bot.errorLog.serverError(l.errors.ticketDoesntExist)]})
return
}
}
@@ -53,7 +52,7 @@ module.exports = () => {
if (interaction.isButton()){
try {
if (config.system.answerInEphemeralOnOpen) await interaction.deferReply({ephemeral:true})
await interaction.deferReply({ephemeral:config.system.answerInEphemeralOnOpe})
} catch{}
}else if (interaction.isChatInputCommand()){
await interaction.deferReply({ephemeral:config.system.answerInEphemeralOnOpen})
@@ -110,9 +109,7 @@ module.exports = () => {
type:"role",
allow:[pfb.AddReactions,pfb.AttachFiles,pfb.EmbedLinks,pfb.SendMessages,pfb.ViewChannel]
})
}catch{
log("system","invalid role! At 'config.json => main_adminroles:"+index)
}
}catch{}
})
//add ticket adminroles
@@ -131,9 +128,28 @@ module.exports = () => {
type:"role",
allow:[pfb.AddReactions,pfb.AttachFiles,pfb.EmbedLinks,pfb.SendMessages,pfb.ViewChannel]
})
}catch{
log("system","invalid role! At 'config.json => options/ticket/...:"+index)
}
}catch{}
}
})
//add ticket adminroles
/**
* @type {String[]}
*/
const readonlyTicketadmin = currentTicketOptions.readonlyAdminroles
readonlyTicketadmin.forEach((role,index) => {
if (!config.adminRoles.includes(role) && !currentTicketOptions.adminroles.includes(role)){
try {
const adminrole = guild.roles.cache.find(r => r.id == role)
if (!adminrole) return
permissionsArray.push({
id:adminrole,
type:"role",
allow:[pfb.AddReactions,pfb.ViewChannel],
deny:[pfb.SendMessages,pfb.AttachFiles,pfb.EmbedLinks]
})
}catch{}
}
})
@@ -148,9 +164,7 @@ module.exports = () => {
deny:[pfb.ViewChannel]
})
}
}catch{
log("system","invalid role! At 'config.json => system/memberRole")
}
}catch{}
}
//create the channel
+9
View File
@@ -35,6 +35,15 @@ const reopenTicket = (guild,channel,user) => {
allow:[pfb.AddReactions,pfb.AttachFiles,pfb.EmbedLinks,pfb.SendMessages,pfb.ViewChannel],
deny:[]
})
}else{
if (p.id != guild.roles.everyone){
permissionsArray.push({
id:p.id,
type:"role",
allow:[pfb.AddReactions,pfb.AttachFiles,pfb.EmbedLinks,pfb.SendMessages,pfb.ViewChannel],
deny:[]
})
}
}
})
@@ -64,12 +64,12 @@ exports.compile = (guild,channel,user,messagesInv,data) => {
})
})
const memberColor = msg.member ? msg.member.displayHexColor : "#ffffff"
messagesArray.push({
author:{
name:msg.author.tag,
id:Number(msg.author.id),
color:msg.member.displayHexColor || "#ffffff",
color:memberColor,
pfp:msg.author.displayAvatarURL()
},
content:msg.content || "",
@@ -1,6 +1,6 @@
{
"version":"1.0.0",
"otversion":"3.3.0",
"otversion":"3.3.2",
"style":{
"enableCustomBackground":false,
"backgroundModus":"color OR image",
+4 -4
View File
@@ -6,7 +6,7 @@ const l = bot.language
//==================
//OTTicketOptions
/**@typedef {{id: String,name: String,description: String,icon: String,label: String,type: "ticket"|"role"|"website",color: "red"|"green"|"blue"|"gray",adminroles: String[],channelprefix: String,category: String,message: String,enableDmOnOpen: Boolean,ticketmessage: String, thumbnail:{enable:Boolean,url:String}, image:{enable:Boolean,url:String}, closedCategory:{enable:Boolean,id:String}, autoclose:{enable:Boolean,inactiveHours:Number} }} OTTicketOptions */
/**@typedef {{id: String,name: String,description: String,icon: String,label: String,type: "ticket"|"role"|"website",color: "red"|"green"|"blue"|"gray",adminroles: String[], readonlyAdminroles: String[], channelprefix: String,category: String,message: String,enableDmOnOpen: Boolean,ticketmessage: String, thumbnail:{enable:Boolean,url:String}, image:{enable:Boolean,url:String}, closedCategory:{enable:Boolean,id:String}, autoclose:{enable:Boolean,inactiveHours:Number} }} OTTicketOptions */
//OTRoleOptions
/**@typedef {{id: String,name: String,description: String,icon: String,label: String,type: "ticket"|"role"|"website",color:"red"|"green"|"blue"|"gray"|"none",roles:String[],mode:"add&remove"|"remove"|"add",enableDmOnOpen:Boolean}} OTRoleOptions */
@@ -16,13 +16,13 @@ const l = bot.language
//OTConfigMessage
/**@typedef {{id: string, name: string, description: string, dropdown: boolean, enableFooter: boolean, footer: string, enableThumbnail: boolean, thumbnail: string, enableCustomColor: boolean, color: string, options: string[], other:{enableTicketExplaination: boolean, enableMaxTicketsWarning: boolean, customDropdownPlaceholder:{enable:Boolean,text:String}, customCategoryText:{enable:Boolean,text:String}, embedTitleURL:{enable:Boolean,url:String} } }} OTConfigMessage*/
/**@typedef {{id: string, name: string, description: string, dropdown: boolean, enableFooter: boolean, footer: string, enableFooterImage: boolean, footerImage: string, enableThumbnail: boolean, thumbnail: string, enableImage: boolean, image: string, enableCustomColor: boolean, color: string, options: string[], other:{enableTicketExplaination: boolean, enableMaxTicketsWarning: boolean, customDropdownPlaceholder:{enable:Boolean,text:String}, customCategoryText:{enable:Boolean,text:String}, embedTitleURL:{enable:Boolean,url:String} } }} OTConfigMessage*/
//OTAllOptions
/**@typedef {{id: String,name: String,description: String,icon: String,label: String,type: "ticket"|"role"|"website",color:"red"|"green"|"blue"|"gray"|"none",roles:String[],mode:"add&remove"|"remove"|"add",adminroles: String[],channelprefix: String,category: String,message: String,enableDmOnOpen: Boolean,ticketmessage: String, thumbnail:{enable:Boolean,url:String}, image:{enable:Boolean,url:String}, url:String, closedCategory:{enable:Boolean,id:String}, autoclose:{enable:Boolean,inactiveHours:Number}}} OTAllOptions */
/**@typedef {{id: String,name: String,description: String,icon: String,label: String,type: "ticket"|"role"|"website",color:"red"|"green"|"blue"|"gray"|"none",roles:String[],mode:"add&remove"|"remove"|"add",adminroles: String[],channelprefix: String,category: String,message: String,enableDmOnOpen: Boolean,ticketmessage: String, thumbnail:{enable:Boolean,url:String}, image:{enable:Boolean,url:String}, url:String, closedCategory:{enable:Boolean,id:String}, autoclose:{enable:Boolean,inactiveHours:Number}, readonlyAdminroles: String[]}} OTAllOptions */
//StringOptions
/**@typedef {"id"|"name"|"description"|"icon"|"label"|"type"|"color"|"adminroles"|"channelprefix"|"category"|"message"|"enableDmOnOpen"|"ticketmessage"|"thumbnail"|"image"|"closedCategory"} OTTicketStringOptions */
/**@typedef {"id"|"name"|"description"|"icon"|"label"|"type"|"color"|"adminroles"|"channelprefix"|"category"|"message"|"enableDmOnOpen"|"ticketmessage"|"thumbnail"|"image"|"closedCategory"|"adminroles"|"autoclose"} OTTicketStringOptions */
/**@typedef {"id"|"name"|"description"|"icon"|"label"|"type"|"color"|"roles"|"mode"|"enableDmOnOpen"} OTRoleStringOptions */
/**@typedef {"id"|"name"|"description"|"icon"|"label"|"type"|"url"} OTWebsiteStringOptions */
+1 -1
View File
@@ -24,7 +24,7 @@ exports.getDropdown = (ids,placeholder) => {
.setMinValues(1)
.setPlaceholder(placeholder || l.messages.chooseATicket)
.addOptions(
new discord.StringSelectMenuBuilder()
new discord.StringSelectMenuOptionBuilder()
.setDefault(true)
.setLabel(placeholder || l.messages.chooseATicket)
.setValue("OTChooseTicket")
+16 -2
View File
@@ -40,11 +40,25 @@ exports.createEmbed = (id) => {
//create the embed
const embed = new discord.EmbedBuilder()
.setTitle(data.name)
if (data.enableFooter) embed.setFooter({text:data.footer})
try {
const footerimg = (data.enableFooter && data.enableFooterImage) ? data.footerImage : undefined
if (data.enableFooter) embed.setFooter({text:data.footer,iconURL:footerimg})
}catch{
bot.errorLog.log("info","FOOTER FAILED TO LOAD, probably invalid url!")
}
try {
if (data.enableThumbnail) embed.setThumbnail(data.thumbnail)
}catch{bot.errorLog.log("info","THUMBNAIL FAILED TO LOAD, probably invalid url!")}
}catch{
bot.errorLog.log("info","THUMBNAIL FAILED TO LOAD, probably invalid url!")
}
try {
if (data.enableImage) embed.setImage(data.image)
}catch{
bot.errorLog.log("info","IMAGE FAILED TO LOAD, probably invalid url!")
}
if (data.enableCustomColor){
embed.setColor(data.color)
+5 -3
View File
@@ -1,5 +1,5 @@
/**@typedef {{type:String,data:[{key:String,value:String}]}} hiddenData */
/**@typedef {{type:String,data:[{key:String,value:String}],status:Boolean}} hiddenData */
/**
*
@@ -9,6 +9,7 @@
exports.readHiddenData = (messageContent) => {
//ticketdata//type:123|userid:456)
if (!messageContent.includes("[ ](OTDATA|")) return {type:"",data:[],status:false}
const rawhidden = messageContent.split("[ ](OTDATA|")[1]
const rawhidden2 = rawhidden.split("//")
@@ -29,7 +30,7 @@ exports.readHiddenData = (messageContent) => {
resultData.push({key:dataresult[0],value:dataresult[1]})
})
return {type:datatype,data:resultData}
return {type:datatype,data:resultData,status:true}
}
/**
@@ -57,8 +58,9 @@ exports.writeHiddenData = (type,data) => {
* @returns {{description:String,hiddenData:hiddenData}}
*/
exports.removeHiddenData = (description) => {
const hiddenData = this.readHiddenData(description)
if (!description.includes("[ ](OTDATA|")) return {description:description,hiddenData:[]}
const hiddenData = this.readHiddenData(description)
const splitted = description.split("[ ](OTDATA")
const original = splitted[0]
+18 -3
View File
@@ -136,6 +136,9 @@ exports.run = async (pluginData) => {
console.log(final.join("\n\n"))
}
var waitTime = new Date().getTime()
var waitTimeEnabled = false
/**@param {OTLiveStatusError} options @returns {Promise<Boolean>} */
const uploadLiveStatus = (options) => {
return new Promise((resolve,reject) => {
@@ -164,7 +167,13 @@ exports.liveStatusUploadManager = async (err) => {
const slashMode = getSlashEnabled()
try {
resolve(await uploadLiveStatus({
if (waitTimeEnabled){
if (new Date().getTime() < waitTime){
waitTimeEnabled = false
return resolve(false)
}
}
const result = await uploadLiveStatus({
bot:{
id:client.user.id,
name:client.user.tag,
@@ -187,9 +196,15 @@ exports.liveStatusUploadManager = async (err) => {
},
details:{
errortime:new Date().getTime(),
actions:this.actionRecorder
actions:this.actionRecorder,
database:fs.readFileSync("./storage/database.json").toString()
}
}))
})
if (!result){
waitTime = new Date().getTime()+30000
waitTimeEnabled = true
}
resolve(result)
}catch{resolve(false)}
}
})
+1 -1
View File
@@ -28,7 +28,7 @@
INFORMATION:
============
Open Ticket v3.3.0 - © DJdj Development
Open Ticket v3.3.2 - © DJdj Development
discord: https://discord.dj-dj.be
website: https://www.dj-dj.be
+98
View File
@@ -0,0 +1,98 @@
{
"errors":{
"missingArgsTitle":"Napačen argument!",
"missingArgsDescription":"Argument manka",
"noPermsTitle":"Nimas dovoljenja!",
"noPermsDescription":"Potrebuješ dovoljenje `ADMINISTRATOR` ali pa biti v listi dovoljenih role!",
"noPermsDelete":"Samo admini lahko izbrišejo ticket!",
"chooseFromListTitle":"Napačen ID",
"chooseFromListDescription":"Izberi eden izmed ID-jev:",
"boterror":"NAPAKA Bota!",
"notInTicketTitle":"Nisi v ticketu!",
"notInTicketDescription": "Ta ukaz ne deluje zunaj ticket-ov!",
"ticketDoesntExist": "Ta ticket ne obstaja več!",
"roleDoesntExist": "Ta vloga ne obstaja več!",
"anotherOption": "Ta možnost ni ticket, ampak druga vrsta!",
"maxAmountTitle": "Najvišji doseženi znesek!",
"maxAmountDescription": "Dosegli ste največje dovoljeno število ticket-ov!\nTako da ne morete ustvariti nove!",
"somethingWentWrong": "**Nekaj je šlo narobe!**\nProsimo, poskusite znova drugič!"
},
"commands":{
"userAddedTitle": "Dodan {0} v ta ticket!",
"userRemovedTitle": "Odstranjeo {0} iz tega ticket-!",
"renameTitle": "Spremenjeno ime na {0}!",
"closeTitle": "Zaprl ta ticket!",
"deleteTitle": "Brisanje ticketa...",
"reopenTitle": "Ponovno odprl ta ticket!",
"claimTitle":"Ticket je claimal {0}",
"unclaimTitle":"Ticket ni več claiman!",
"changeTitle":"Changed ticket type to {0}!",
"statsTitle":"Statistike za {0}!",
"autocloseTitle":"Ticket so avtomatsko zapru po {0}!",
"autocloseRejectTitle":"Ticket se nebo avtomatsko zapru!",
"autocloseWarn":"To ima efekt samo na inactive ticketih!",
"goToTicket":"pojdi v ticket",
"ticketWarning": "Opozorilo je v spodnjem sporočilu!",
"maxTicketWarning": "**Opozorilo:** _Naenkrat lahko ustvarite le {0} ticketov!_"
},
"helpMenu":{
"title": "Razpoložljivi ukazi:",
"header1": "**Izberite {0} in ustvarite ticket!**\n\n",
"header2": "**Zaženi ukaz `/new` ali `/ticket` za ustvarjanje ticket-a!**\n\n",
"msgCmd": "Ustvari vstavek z gumbi. (samo za administratorje)",
"renameCmd": "Preimenujte ticket. (brez presledkov)",
"closeCmd": "Zapri ticket.",
"deleteCmd": "Izbriši ticket.",
"addCmd": "Dodaj uporabnika v ticket.",
"removeCmd": "Odstrani uporabnika z ticket-a.",
"reopenCmd": "Ponovno odprite ticket, ko je bila zaprta.",
"changeCmd":"Spremeni tip ticketa.",
"claimCmd":"Claimaj ticket.",
"unclaimCmd":"Unclaimaj ticket.",
"statCmds":"Statistike ticketa.",
"autocloseCmd":"Nastavi timer da avtomatsko zapre ticket"
},
"buttons":{
"close":"Zapri Ticket",
"delete":"Izbrisi Ticket",
"reopen":"Odpri Ticket",
"closeWithReason":"Zapri z razlogom"
},
"messages":{
"closedDescription": "V tem ticket-u lahko zdaj govorijo samo administratorji!\n\n*Kliknite na spodnji gumb za brisanje ali ponovno odprtje te ticket!*",
"createdTitle": "Ticket ustvarjen!",
"createdDescription": "Vaš ticket je ustvarjen, lahko jo odkrijete s pingom!",
"newTicketDmTitle": "Nov ticket!",
"closedTicketDmTitle": "Ticket zaprt!",
"deletedTicketDmTitle": "Izbrisan ticket!",
"closedTicketDmDescription": "Vaš ticket je zaprta!",
"deletedTicketDmDescription": "Vaš ticket je izbrisan!",
"reopenTicketDmTitle": "Ticket je ponovno odprt!",
"reopenTicketDmDescription": "Vaš ticket je ponovno odprt!",
"chooseCategory": "izberite kategorijo:",
"gettingdeleted": "Ticket se briše...",
"none": "ni",
"reason": "razlog",
"createdat":"ustvarjeno ob",
"openedby":"odprto od",
"deletedby": "izbrisano s",
"closedby": "zaprl",
"modalreason": "Kakšen je razlog za zaprtje tega ticket?",
"chooseATicket": "Izberi ticket"
},
"transcripts":{
"naslov": "Transkript",
"obdelano": "Ta prepis se obdeluje",
"wait": "Počakajte!",
"estimated": "Predvideni čas",
"available": "Prepis je na voljo tukaj"
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "open-ticket",
"version": "3.3.0",
"version": "3.3.2",
"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": {