v3.5.4 push 2

This commit is contained in:
DJj123dj
2024-04-04 14:06:48 +02:00
parent 5dfbce1856
commit e80ce1a64a
19 changed files with 299 additions and 146 deletions
+5 -4
View File
@@ -5,13 +5,13 @@ There will be massive improvements for more stability & features! But the best p
<img src="https://apis.dj-dj.be/cdn/openticket/logo.png" alt="Open Ticket" width="600px"> <img src="https://apis.dj-dj.be/cdn/openticket/logo.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.5.4-brightgreen.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/releases/tag/v3.5.4) [![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.5.4-brightgreen.svg?style=flat-square)](https://github.com/DJj123dj/open-ticket/releases/tag/v3.5.4) [![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://otdocs.dj-dj.be)
### Open Ticket ### 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 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! 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 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!
Take a look at all the features and discover the possibilities! Take a look at all the features and discover the possibilities!
### [Visit the Documentation!](https://docs.openticket.dj-dj.be/quick-start) ### [Visit the Documentation!](https://otdocs.dj-dj.be/quick-start)
## Features ## Features
- **🎉 advanced html transcripts!** - **🎉 advanced html transcripts!**
@@ -70,10 +70,11 @@ Take a look at all the features and discover the possibilities!
|Indonesian |erxg |🟢 Up To Date | |Indonesian |erxg |🟢 Up To Date |
|Kurdish |raze.hama |🟢 Up To Date | |Kurdish |raze.hama |🟢 Up To Date |
|Hungarian |Snowy |🔴 Outdated | |Hungarian |Snowy |🔴 Outdated |
|Persian |sasanwm |🟢 Up To Date |
## links ## links
current version: _v3.5.4_ current version: _v3.5.4_
</br>changelog: [click here](https://otgithub.dj-dj.be/releases) </br>changelog: [click here](https://otgithub.dj-dj.be/releases)
</br>documentation: [click here](https://docs.openticket.dj-dj.be/quick-start) </br>documentation: [click here](https://otdocs.dj-dj.be/quick-start)
© 2023 - DJdj Development | [website](https://www.dj-dj.be) | [discord](https://discord.dj-dj.be) | [terms of service](https://www.dj-dj.be/terms) © 2024 - DJdj Development | [website](https://www.dj-dj.be) | [discord](https://discord.dj-dj.be) | [terms of service](https://www.dj-dj.be/terms)
-2
View File
@@ -57,8 +57,6 @@ module.exports = () => {
const reason = interaction.options.getString("reason") ? interaction.options.getString("reason") : false const reason = interaction.options.getString("reason") ? interaction.options.getString("reason") : false
const hiddendata = bot.hiddenData.readHiddenData(interaction.channel.id) const hiddendata = bot.hiddenData.readHiddenData(interaction.channel.id)
if (hiddendata.length < 1) return interaction.reply({embeds:[bot.errorLog.notInATicket]}) if (hiddendata.length < 1) return interaction.reply({embeds:[bot.errorLog.notInATicket]})
const ticketId = hiddendata.find(d => d.key == "type").value const ticketId = hiddendata.find(d => d.key == "type").value
+2 -2
View File
@@ -23,7 +23,7 @@ module.exports = () => {
msg.channel.send({embeds:[bot.embeds.commands.reopenEmbed(msg.author)],components:[bot.buttons.close.openRowNormal]}) msg.channel.send({embeds:[bot.embeds.commands.reopenEmbed(msg.author)],components:[bot.buttons.close.openRowNormal]})
require("../core/ticketActions/ticketReopener").reopenTicket(msg.guild,msg.channel,msg.author) require("../core/ticketActions/ticketReopener").reopenTicket(msg.guild,msg.channel,msg.author,ticketId)
log("command","someone used the 'reopen' command",[{key:"user",value:msg.author.username}]) log("command","someone used the 'reopen' command",[{key:"user",value:msg.author.username}])
APIEvents.onCommand("reopen",true,msg.author,msg.channel,msg.guild,new Date()) APIEvents.onCommand("reopen",true,msg.author,msg.channel,msg.guild,new Date())
@@ -43,7 +43,7 @@ module.exports = () => {
await interaction.editReply({embeds:[bot.embeds.commands.reopenEmbed(interaction.user)],components:[bot.buttons.close.openRowNormal]}) await interaction.editReply({embeds:[bot.embeds.commands.reopenEmbed(interaction.user)],components:[bot.buttons.close.openRowNormal]})
require("../core/ticketActions/ticketReopener").reopenTicket(interaction.guild,interaction.channel,interaction.user) require("../core/ticketActions/ticketReopener").reopenTicket(interaction.guild,interaction.channel,interaction.user,ticketId)
log("command","someone used the 'reopen' command",[{key:"user",value:interaction.user.username}]) log("command","someone used the 'reopen' command",[{key:"user",value:interaction.user.username}])
APIEvents.onCommand("reopen",true,interaction.user,interaction.channel,interaction.guild,new Date()) APIEvents.onCommand("reopen",true,interaction.user,interaction.channel,interaction.guild,new Date())
+13 -14
View File
@@ -1,4 +1,7 @@
{ {
"_DOCUMENTATION":"https://otdocs.dj-dj.be",
"_SUPPORT":"https://discord.dj-dj.be",
"color":"#ffffff", "color":"#ffffff",
"serverId":"server id (for slash cmds)", "serverId":"server id (for slash cmds)",
"token":{ "token":{
@@ -28,10 +31,9 @@
"answerInEphemeralOnOpen":true "answerInEphemeralOnOpen":true
}, },
"SUPPORT":"Take look at our wiki: https://docs.openticket.dj-dj.be or join our discord server: https://discord.dj-dj.be if you need support!",
"options":[ "options":[
{ {
"id":"general", "id":"example-ticket",
"name":"Question", "name":"Question",
"description":"Create this ticket if you have a question.", "description":"Create this ticket if you have a question.",
"icon":"🎫", "icon":"🎫",
@@ -74,10 +76,9 @@
"roleId":"012345678910" "roleId":"012345678910"
} }
} }
}, },
{ {
"id":"website", "id":"example-website",
"name":"Website", "name":"Website",
"description":"Go to our website.", "description":"Go to our website.",
"icon":"✅", "icon":"✅",
@@ -85,27 +86,25 @@
"type":"website", "type":"website",
"url":"https://www.dj-dj.be" "url":"https://www.dj-dj.be"
}, },
{ {
"id":"role", "id":"example-role",
"name":"Verify", "name":"Update Ping",
"description":"Click here to get the verify role.", "description":"Click here to get pinged for updates!",
"icon":"👮🏼", "icon":"📢",
"label":"get a role", "label":"Update Ping",
"type":"role", "type":"role",
"color":"red", "color":"red",
"roles":["discord role id"], "roles":["discord role id"],
"mode":"add&remove|remove|add", "mode":"add&remove|remove|add",
"enableDmOnOpen":true "enableDmOnOpen":true
} }
], ],
"messages":[ "messages":[
{ {
"id":"1", "id":"example-embed",
"name":"Choose Your Ticket", "name":"Choose Your Ticket",
"description":"You can click one of the buttons below!", "description":"You can click one of the buttons below!",
"dropdown":false, "dropdown":false,
@@ -125,7 +124,7 @@
"enableCustomColor":false, "enableCustomColor":false,
"color":"#ffffff", "color":"#ffffff",
"options":["general","apply"], "options":["example-ticket","example-website","example-role"],
"other":{ "other":{
"enableTicketExplaination":true, "enableTicketExplaination":true,
@@ -146,4 +145,4 @@
} }
} }
] ]
} }
+1 -1
View File
@@ -4,7 +4,7 @@ const bot = require("../../index")
exports.client = bot.client exports.client = bot.client
exports.config = bot.config exports.config = bot.config
exports.utils = { exports.utils = {
log:bot.errorLog.log(), log:bot.errorLog.log,
storage:bot.storage storage:bot.storage
} }
+72 -46
View File
@@ -29,23 +29,23 @@ exports.checker = async () => {
/**@param {"userid"|"roleid"|"channelid"|"serverid"|"categoryid"} mode @param {String} value @param {String} path */ /**@param {"userid"|"roleid"|"channelid"|"serverid"|"categoryid"} mode @param {String} value @param {String} path */
const checkDiscord = (mode,value,path) => { const checkDiscord = (mode,value,path) => {
if (mode == "userid"){ if (mode == "userid"){
if (value.length < 16 || value.length > 20 || !/^\d+$/.test(value)){ if (value.length < 16 || value.length > 40 || !/^\d+$/.test(value)){
createError("'"+path+"' | this user id is invalid") createError("'"+path+"' | this user id is invalid")
} }
}else if (mode == "channelid"){ }else if (mode == "channelid"){
if (value.length < 16 || value.length > 20 || !/^\d+$/.test(value)){ if (value.length < 16 || value.length > 40 || !/^\d+$/.test(value)){
createError("'"+path+"' | this channel id is invalid") createError("'"+path+"' | this channel id is invalid")
} }
}else if (mode == "roleid"){ }else if (mode == "roleid"){
if (value.length < 16 || value.length > 20 || !/^\d+$/.test(value)){ if (value.length < 16 || value.length > 40 || !/^\d+$/.test(value)){
createError("'"+path+"' | this role id is invalid") createError("'"+path+"' | this role id is invalid")
} }
}else if (mode == "serverid"){ }else if (mode == "serverid"){
if (value.length < 16 || value.length > 20 || !/^\d+$/.test(value)){ if (value.length < 16 || value.length > 40 || !/^\d+$/.test(value)){
createError("'"+path+"' | this server id is invalid") createError("'"+path+"' | this server id is invalid")
} }
}else if (mode == "categoryid"){ }else if (mode == "categoryid"){
if (value.length < 16 || value.length > 20 || !/^\d+$/.test(value)){ if (value.length < 16 || value.length > 40 || !/^\d+$/.test(value)){
createError("'"+path+"' | this category id is invalid") createError("'"+path+"' | this category id is invalid")
} }
} }
@@ -402,11 +402,11 @@ exports.checker = async () => {
} }
} }
//--------------------------| //////////////////////////////////////////
//--------------------------| //////////////////////////////////////////
//checker => START HERE | /////////!!! CHECKER.JS START !!!/////////
//--------------------------| //////////////////////////////////////////
//--------------------------| //////////////////////////////////////////
var configArray = ["color","serverId","token","adminRoles","prefix","languageFile","status","system","options","messages"] var configArray = ["color","serverId","token","adminRoles","prefix","languageFile","status","system","options","messages"]
configArray.forEach((item) => { configArray.forEach((item) => {
@@ -416,19 +416,44 @@ exports.checker = async () => {
}) })
checkHexColor(config.color,"main_color") checkHexColor(config.color,"main_color")
checkDiscord("serverid",config.serverId,"server_id") checkDiscord("serverid",config.serverId,"serverId")
if (!require("./api/api.json").disable.checkerjs.token && !config.token.fromENV) checkToken(config.token.value) if (!require("./api/api.json").disable.checkerjs.token && !config.token.fromENV) checkToken(config.token.value)
checkType(config.adminRoles,"array","/main_adminroles") checkType(config.adminRoles,"array","/adminRoles")
checkDiscordArray("roleid",config.adminRoles,"main_adminroles") checkDiscordArray("roleid",config.adminRoles,"adminRoles")
checkString(config.prefix,1,15,"prefix","prefix") checkString(config.prefix,1,15,"prefix","prefix")
//languagefile
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") && !lf.startsWith("slovenian") && !lf.startsWith("thai") && !lf.startsWith("norwegian") && !lf.startsWith("greek") && !lf.startsWith("ukrainian") && !lf.startsWith("hungarian") && !lf.startsWith("indonesian") && !lf.startsWith("kurdish")){ //languagefile
createError("'languagefile' | invalid language, more info in the wiki") checkType(config.languageFile,"string","languageFile")
const languageList = [
"custom",
"english",
"dutch",
"romanian",
"german",
"arabic",
"spanish",
"portuguese",
"french",
"italian",
"czech",
"danish",
"russian",
"turkish",
"polish",
"slovenian",
"thai",
"norwegian",
"greek",
"ukrainian",
"hungarian",
"indonesian",
"kurdish",
"persian"
]
if (!languageList.some((l) => config.languageFile.startsWith(l))){
createError("'languageFile' | invalid language, more info in the wiki")
} }
//status: //status:
@@ -483,34 +508,35 @@ exports.checker = async () => {
//the end //the end
if (errorList.length > 0 || warnList.length > 0){ if (errorList.length > 0 || warnList.length > 0){
console.log("REPORT:\n===========================") console.log("REPORT:\n===========================")
} warnList.forEach((w) => {
warnList.forEach((w) => { const splitw = w.split("'")
const splitw = w.split("'") if (splitw.length > 1){
if (splitw.length > 1){ var splitstring = chalk.yellow(splitw[0])+chalk.blue("'"+splitw[1]+"'")+chalk.yellow(splitw[2])
var splitstring = chalk.yellow(splitw[0])+chalk.blue("'"+splitw[1]+"'")+chalk.yellow(splitw[2]) if (splitw[3]){splitstring = splitstring+chalk.yellow(splitw[3])}
if (splitw[3]){splitstring = splitstring+chalk.yellow(splitw[3])} if (splitw[4]){splitstring = splitstring+chalk.yellow(splitw[4])}
if (splitw[4]){splitstring = splitstring+chalk.yellow(splitw[4])} if (splitw[5]){splitstring = splitstring+chalk.yellow(splitw[5])}
if (splitw[5]){splitstring = splitstring+chalk.yellow(splitw[5])} }else {var splitstring = chalk.yellow(splitw[0])}
}else {var splitstring = chalk.yellow(splitw[0])} console.log(splitstring)
console.log(splitstring) })
}) errorList.forEach((e) => {
errorList.forEach((e) => { const splite = e.split("'")
const splite = e.split("'") if (splite.length > 1){
if (splite.length > 1){ var splitstring = chalk.red(splite[0])+chalk.blue("'"+splite[1]+"'")+chalk.red(splite[2])
var splitstring = chalk.red(splite[0])+chalk.blue("'"+splite[1]+"'")+chalk.red(splite[2]) }else {var splitstring = chalk.red(splite[0])}
}else {var splitstring = chalk.red(splite[0])} console.log(splitstring)
console.log(splitstring) })
}) if (isError){
if (isError){ console.log("===========================")
console.log("===========================") console.log("=> "+chalk.bgRed("your bot doesn't work if you don't fix the above errors!"))
console.log("=> "+chalk.bgRed("your bot doesn't work if you don't fix the above errors!")) if (isWarn){
if (isWarn){ console.log("\n=> "+chalk.bgYellow("if you ignore warns, some things may work differently than expected!"))
console.log("\n=> "+chalk.bgYellow("if you ignore warns, some things may work differently than expected!")) }
console.log(chalk.bold.green("\nDOCUMENTATION => https://otdocs.dj-dj.be\nSUPPORT => https://discord.dj-dj.be\n"))
process.exit(0)
}else if (isWarn){
console.log("===========================")
console.log("=> "+chalk.bgYellow("if you ignore warns, some things may work differently than expected!"))
console.log(chalk.bold.green("\nDOCUMENTATION => https://otdocs.dj-dj.be\nSUPPORT => https://discord.dj-dj.be\n"))
} }
process.exit(0)
}else if (isWarn == true && isError == false){
console.log("===========================")
console.log("=> "+chalk.bgYellow("if you ignore warns, some things may work differently than expected!"))
} }
} }
-53
View File
@@ -1,53 +0,0 @@
const fs = require('fs')
const readline = require("readline")
const rl = readline.createInterface({
input:process.stdin,
output:process.stdout,
terminal:true
})
const ask = async () => {
const chalk = await (await import("chalk")).default
rl.question(chalk.yellow("WARNING: are you sure that there are",chalk.red("no tickets open"),"at the moment? ")+chalk.green("(yes/no)")+"\n",(answer) => {
if (answer != "1" && !answer.toLowerCase().startsWith("yes")){
console.log(chalk.red("invalid answer"))
ask()
return
}
console.log(chalk.green("clearing data..."))
runClear()
rl.close()
})
}
ask()
const runClear = async () => {
const chalk = await (await import("chalk")).default
//console.log(chalk.blue("You can get a node.js warning below, just ignore that, it's not important!"))
const dataPaths = ["./storage/dynamicDB"]
var index = 0
dataPaths.forEach((path) => {
try {
fs.rmSync(path,{recursive:true,force:true})
}catch{
//console.log(path,"doesn't exist")
}
setTimeout(() => {
try{
fs.mkdirSync(path)
}catch{
//console.log(path,"already exists")
}
index++
},500)
})
setInterval(() => {
if (index >= 1){
console.log(chalk.bgGreen("All local data is cleared!"))
process.exit(1)
}
},500)
}
@@ -40,7 +40,7 @@ module.exports = () => {
if (!permissionChecker.sendUserNoPerms(interaction.user)){ if (!permissionChecker.sendUserNoPerms(interaction.user)){
permissionChecker.sendChannelNoPerms(interaction.channel,interaction.user) permissionChecker.sendChannelNoPerms(interaction.channel,interaction.user)
} }
interaction.message.edit({components:[firstcomponents]}) interaction.message.edit({components:firstcomponents})
closeTicketButtonChecker = false closeTicketButtonChecker = false
return return
} }
@@ -65,7 +65,7 @@ module.exports = () => {
if (!permissionChecker.sendUserNoPerms(interaction.user)){ if (!permissionChecker.sendUserNoPerms(interaction.user)){
permissionChecker.sendChannelNoPerms(interaction.channel,interaction.user) permissionChecker.sendChannelNoPerms(interaction.channel,interaction.user)
} }
interaction.message.edit({components:[firstcomponents]}) interaction.message.edit({components:firstcomponents})
closeTicketButtonChecker = false closeTicketButtonChecker = false
return interaction.deferUpdate() return interaction.deferUpdate()
} }
@@ -21,8 +21,21 @@ module.exports = () => {
if (!interaction.isButton()) return if (!interaction.isButton()) return
if (interaction.customId != "OTreopenTicket") return if (interaction.customId != "OTreopenTicket") return
const hiddendata = bot.hiddenData.readHiddenData(interaction.channel.id)
if (hiddendata.length < 1) return interaction.reply({embeds:[bot.errorLog.notInATicket]})
const ticketId = hiddendata.find(d => d.key == "type").value
if (config.system.closeMode == "adminonly"){
if (!permissionChecker.ticket(interaction.user.id,interaction.guild.id,ticketId)){
if (!permissionChecker.sendUserNoPerms(interaction.user)){
permissionChecker.sendChannelNoPerms(interaction.channel,interaction.user)
}
return interaction.deferUpdate()
}
}
await interaction.deferUpdate() await interaction.deferUpdate()
interaction.message.edit({embeds:[bot.embeds.commands.reopenEmbed(interaction.user)],components:[bot.buttons.close.openRowNormal]}) 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) require("../../../ticketActions/ticketReopener").reopenTicket(interaction.guild,interaction.channel,interaction.user,ticketId)
}) })
} }
+2 -1
View File
@@ -63,7 +63,7 @@ module.exports = () => {
} catch{} } catch{}
} }
if (storage.get("amountOfUserTickets",interaction.member.id) == null || storage.get("amountOfUserTickets",interaction.member.id) == "false"|| Number(storage.get("amountOfUserTickets",interaction.member.id)) < config.system.maxAmountOfTickets){ if (storage.get("amountOfUserTickets",interaction.member.id) == null || storage.get("amountOfUserTickets",interaction.member.id) == "false"|| Number(storage.get("amountOfUserTickets",interaction.member.id)) <= config.system.maxAmountOfTickets){
//update storage //update storage
storage.set("amountOfUserTickets",interaction.member.id,Number(storage.get("amountOfUserTickets",interaction.member.id))+1) storage.set("amountOfUserTickets",interaction.member.id,Number(storage.get("amountOfUserTickets",interaction.member.id))+1)
@@ -258,6 +258,7 @@ module.exports = () => {
}) })
}else{ }else{
interaction.editReply({embeds:[bot.errorLog.warning(l.errors.maxAmountTitle,l.errors.maxAmountDescription)]})
try { try {
if (config.system.dmMessages){ if (config.system.dmMessages){
interaction.member.send({embeds:[bot.errorLog.warning(l.errors.maxAmountTitle,l.errors.maxAmountDescription)]}) interaction.member.send({embeds:[bot.errorLog.warning(l.errors.maxAmountTitle,l.errors.maxAmountDescription)]})
+12 -1
View File
@@ -6,15 +6,26 @@ const log = bot.errorLog.log
const l = bot.language const l = bot.language
const storage = bot.storage const storage = bot.storage
const pfb = discord.PermissionFlagsBits const pfb = discord.PermissionFlagsBits
const permsChecker = require("../utils/permisssionChecker")
/** /**
* *
* @param {discord.Guild} guild * @param {discord.Guild} guild
* @param {discord.TextBasedChannel} channel * @param {discord.TextBasedChannel} channel
* @param {discord.User} user * @param {discord.User} user
* @param {String} ticketId option id
* @returns * @returns
*/ */
const reopenTicket = (guild,channel,user) => { const reopenTicket = (guild,channel,user,ticketId) => {
//check perms
if (config.system.closeMode == "adminonly"){
if (!guild) return
if (!permsChecker.ticket(user.id,guild.id,ticketId)){
permsChecker.sendUserNoPerms(user)
return
}
}
log("system","re-opened a ticket",[{key:"ticket",value:channel.name},{key:"user",value:user.username}]) log("system","re-opened a ticket",[{key:"ticket",value:channel.name},{key:"user",value:user.username}])
var permissionsArray = [] var permissionsArray = []
@@ -215,7 +215,7 @@ exports.compile = (guild,channel,user,messagesInv,data) => {
interactionName:msg.interaction.commandName interactionName:msg.interaction.commandName
}, },
user:{ user:{
name:msg.interaction.user.username, name:msg.interaction.user.displayName,
id:msg.interaction.user.id, id:msg.interaction.user.id,
color:replycolor, color:replycolor,
pfp:msg.interaction.user.displayAvatarURL(), pfp:msg.interaction.user.displayAvatarURL(),
@@ -227,15 +227,15 @@ exports.compile = (guild,channel,user,messagesInv,data) => {
}else if (replytype == "reply"){ }else if (replytype == "reply"){
var replycontentRAW = messages.find((msg2) => msg2.id == msg.reference.messageId) var replycontentRAW = messages.find((msg2) => msg2.id == msg.reference.messageId)
var replycontent = (replycontentRAW && replycontentRAW.content) ? replycontentRAW.content.slice(0,(60-replycontentRAW.author.username.length)) : "deleted this message" var replycontent = (replycontentRAW && replycontentRAW.content) ? replycontentRAW.content.slice(0,(60-replycontentRAW.author.displayName.length)) : "deleted this message"
const replycolorRAW = (replycontentRAW) ? msg.guild.members.cache.find((m) => m.id == replycontentRAW.author.id) : false const replycolorRAW = (replycontentRAW) ? msg.guild.members.cache.find((m) => m.id == replycontentRAW.author.id) : false
const replycolor = (replycolorRAW) ? replycolorRAW.displayHexColor.replace("#000000","#ffffff") : "#ffffff" const replycolor = (replycolorRAW) ? replycolorRAW.displayHexColor.replace("#000000","#ffffff") : "#ffffff"
var user = (replycontentRAW && replycontentRAW.content) ? { var user = (replycontentRAW && replycontentRAW.content) ? {
name:(replycontentRAW) ? replycontentRAW.author.username : "undefined", name:(replycontentRAW) ? replycontentRAW.author.displayName : "undefined",
id:(replycontentRAW) ? replycontentRAW.author.id : "undefined", id:(replycontentRAW) ? replycontentRAW.author.id : "undefined",
color:replycolor, color:replycolor,
pfp:(replycontentRAW) ? replycontentRAW.author.username : "", pfp:(replycontentRAW) ? replycontentRAW.author.displayName : "",
bot:(replycontentRAW) ? replycontentRAW.author.bot : false, bot:(replycontentRAW) ? replycontentRAW.author.bot : false,
system:(replycontentRAW) ? replycontentRAW.author.system : false, system:(replycontentRAW) ? replycontentRAW.author.system : false,
verifiedBot:(replycontentRAW) ? replycontentRAW.author.flags.has(discord.UserFlags.VerifiedBot) : false, verifiedBot:(replycontentRAW) ? replycontentRAW.author.flags.has(discord.UserFlags.VerifiedBot) : false,
@@ -264,7 +264,7 @@ exports.compile = (guild,channel,user,messagesInv,data) => {
const authorColor = msg.member ? msg.member.displayHexColor.replace("#000000","#ffffff") : "#ffffff" const authorColor = msg.member ? msg.member.displayHexColor.replace("#000000","#ffffff") : "#ffffff"
messagesArray.push({ messagesArray.push({
author:{ author:{
name:msg.author.username, name:msg.author.displayName,
id:msg.author.id, id:msg.author.id,
color:authorColor, color:authorColor,
pfp:msg.author.displayAvatarURL(), pfp:msg.author.displayAvatarURL(),
@@ -332,7 +332,7 @@ exports.compile = (guild,channel,user,messagesInv,data) => {
creatorid:data.ticket.creatorid, creatorid:data.ticket.creatorid,
creatorpfp:data.ticket.creatorpfp, creatorpfp:data.ticket.creatorpfp,
closedbyname:user.username, closedbyname:user.displayName,
closedbyid:user.id, closedbyid:user.id,
closedbypfp:user.displayAvatarURL(), closedbypfp:user.displayAvatarURL(),
+1 -1
View File
@@ -22,7 +22,7 @@ exports.upload = async (json) => {
resolve(res.data) resolve(res.data)
}catch(err){ }catch(err){
console.log("failed transcript upload!",err.response) console.log("Failed HTML transcript upload! Reached Ratelimit 429!")
resolve(false) resolve(false)
} }
}) })
+1 -1
View File
@@ -74,7 +74,7 @@ exports.tserror = (name,id,user,err) => {
const errDesc = (typeof err == "string") ? "\n"+err : "" const errDesc = (typeof err == "string") ? "\n"+err : ""
embed.setDescription("Something went wrong while creating the HTML transcript.\n\n[possible reasons](https://docs.openticket.dj-dj.be/the-system/transcripts/transcript-errors)"+errDesc) embed.setDescription("Something went wrong while creating the HTML transcript.\n\n[possible reasons](https://otdocs.dj-dj.be/docs/current/docs/system/transcripts)"+errDesc)
return embed return embed
} }
+21 -3
View File
@@ -88,13 +88,13 @@ module.exports = async (messages,guild,channel,user,reason) => {
}, },
bot:{ bot:{
name:client.user.username, name:client.user.displayName,
id:client.user.id, id:client.user.id,
pfp:client.user.displayAvatarURL(), pfp:client.user.displayAvatarURL(),
}, },
ticket:{ ticket:{
creatorid:ticketopener.id, creatorid:ticketopener.id,
creatorname:ticketopener.username, creatorname:ticketopener.displayName,
creatorpfp:ticketopener.displayAvatarURL(), creatorpfp:ticketopener.displayAvatarURL(),
openedtime:opentime.getTime(), openedtime:opentime.getTime(),
@@ -123,7 +123,25 @@ module.exports = async (messages,guild,channel,user,reason) => {
} }
const TSdata = await require("./communication/index").upload(JSONDATA) const TSdata = await require("./communication/index").upload(JSONDATA)
if (!TSdata) return false if (!TSdata){
const attachment = await require("./oldTranscript").createTranscript(messages,channel)
const errembed = tsembeds.tserror(chName,chId,user,"`HTML Transcript API: reached ratelimit`")
if (tsconfig.sendTranscripts.enableChannel){
/**@type {discord.TextChannel|undefined} */
const tc = guild.channels.cache.find((c) => c.id == tsconfig.sendTranscripts.channel)
if (!tc) return
tc.send({embeds:[errembed],files:[attachment]})
}
if (tsconfig.sendTranscripts.enableDM && user){
const embed = tsembeds.tsready(chName,null,user,ticketopener)
try {
ticketopener.send({embeds:[embed],files:[attachment]})
}catch{}
}
return false
}
if (TSdata.status == "success"){ if (TSdata.status == "success"){
//MAKE THIS COMPATIBLE WITH PREMIUM "customTranscriptUrl" IN FUTURE VERSIONS!! //MAKE THIS COMPATIBLE WITH PREMIUM "customTranscriptUrl" IN FUTURE VERSIONS!!
+6 -2
View File
@@ -38,7 +38,7 @@
Send ./openticketdebug.txt when there are errors! Send ./openticketdebug.txt when there are errors!
*/ */
/** discord :)*/
const discord = require("discord.js") const discord = require("discord.js")
const fs = require('fs') const fs = require('fs')
const {GatewayIntentBits,Partials} = discord const {GatewayIntentBits,Partials} = discord
@@ -54,7 +54,7 @@ const client = new discord.Client({
partials:[Partials.Channel,Partials.Message] partials:[Partials.Channel,Partials.Message]
}) })
exports.client = client exports.client = client
client.setMaxListeners(100) client.setMaxListeners(120)
if (process.argv.some((v) => v == "--debug")) console.log("[TEMP_DEBUG]","created client") if (process.argv.some((v) => v == "--debug")) console.log("[TEMP_DEBUG]","created client")
//LOAD CONFIG //LOAD CONFIG
@@ -161,6 +161,10 @@ client.on('ready',async () => {
if (config.status.enabled){ if (config.status.enabled){
setStatus(config.status.type,config.status.text) setStatus(config.status.type,config.status.text)
//refresh status every 10 minutes
setInterval(() => {
setStatus(config.status.type,config.status.text)
},(60*10*1000))
} }
this.actionRecorder.push({ this.actionRecorder.push({
+135
View File
@@ -0,0 +1,135 @@
{
"_CREDITS":"sasanwm",
"_INFO":"This file is a translation for open ticket 3.5.4",
"errors":{
"missingArgsTitle":"آرگومان‌های گم شده!",
"missingArgsDescription":"آرگومان گم شده",
"noPermsTitle":"شما دسترسی نداری!",
"noPermsDescription":"شما نیاز به دسترسی `ADMINISTRATOR` دارید یا باید در لیست رول‌های مجاز باشید!",
"noPermsDelete":"فقط ادمین ها میتونند یک تیکت رو حذف کنند!",
"chooseFromListTitle":"ایدی نامعتبر",
"chooseFromListDescription":"یکی از ایدی‌های زیر رو انتخاب کن:",
"boterror":"خطای ربات!",
"notInTicketTitle":"شما در یک تیکت نیستید!",
"notInTicketDescription":"این کامند خارج از تیکت‌ها کار نمیکند!",
"ticketDoesntExist":"این تیکت دیگه وجود نداره!",
"roleDoesntExist":"این رول دیگه وجود نداره!",
"anotherOption":"این گزینه یک تیکت نیست بلکه نوع دیگه ای هست!",
"maxAmountTitle":"حداکثر مقدار رسیده هست!",
"maxAmountDescription":"شما به حداکثر تعداد تیکت‌های مجاز رسیدید!\nبنابراین نمیتونید یکی دیگه ایجاد کنید!",
"somethingWentWrong":"**مشکلی پیش اومد!**\nدوباره تلاش کن!"
},
"commands":{
"userAddedTitle":"{0} به این تیکت اضافه شد!",
"userRemovedTitle":"{0} از این تیکت حذف شد!",
"renameTitle":"اسم به {0} تغییر یافت!",
"closeTitle":"این تیکت بسته شد!",
"deleteTitle":"حذف این تیکت...",
"reopenTitle":"این تیکت دوباره باز شد!",
"claimTitle":"این تیکت به {0} اختصاص یافته است",
"unclaimTitle":"این تیکت دیگه به اختصاص یک یوزر نمیباشد!",
"changeTitle":"نوع تیکت به {0} تغییر یافت!",
"statsTitle":"آمار اینجا {0} هست!",
"autocloseTitle":"این تیکت به طور خودکار بعد از {0} بسته خواهد شد!",
"autocloseRejectTitle":"این تیکت دیگه به طور خودکار بسته نخواهد شد!",
"autocloseWarn":"این فقط بر روی تیکت‌های غیرفعال تأثیر میزاره!",
"goToTicket":"رفتن به تیکت",
"ticketWarning":"امبد در پیام زیر هست!",
"maxTicketWarning":"**هشدار:** _شما فقط میتوانید {0} تیکت رو در همان زمان ایجاد کنید!_"
},
"helpMenu":{
"title":"کامند های موجود:",
"header1":"**به {0} براید تا یک تیکت ایجاد کنید!**\n\n",
"header2":"**کامند `/new` یا `/ticket` رو اجرو کن تا یک تیکت ایجاد کنید!**\n\n",
"msgCmd":"فرستادن یک امبد با دکمه ها (فقط ادمین ها)",
"renameCmd":"اسم یک تیکت رو تغییر دهید. (بدون فاصله)",
"closeCmd":"بستن یک تیکت.",
"deleteCmd":"حذف یک تیکت.",
"addCmd":"اضافه کردن یک یوزر به تیکت.",
"removeCmd":"حذف کردن یک یوزر از تیکت.",
"reopenCmd":"باز کردن یک تیکت پس از بسته شدن.",
"changeCmd":"تغییر دادن نوع تیکت.",
"claimCmd":"به اختیار گرفتن یک تیکت.",
"unclaimCmd":"خارج کردن یک تیکت از اختیار خود.",
"statsCmd":"مشاهده کردن امار یک تیکت.",
"autocloseCmd":"تنظیم زمان بندی برای بسته شدن خودکار تیکت. "
},
"buttons":{
"close":"بستن تیکت",
"delete":"حذف تیکت",
"reopen":"بازکردن مجدد تیکت",
"closeWithReason":"بستن با دلیل"
},
"messages":{
"closedDescription":"فقط ادمین‌ها میتواننند در این تیکت صحبت کنند!\n\n*برای حذف یا بازکردن این تیکت، روی دکمه زیر کلیک کن!*",
"createdTitle":"تیکت ایجاد شد!",
"createdDescription":"تیکت شما ایجاد شده، توی تیکت منشن شدی!",
"newTicketDmTitle":"تیکت جدید!",
"closedTicketDmTitle":"تیکت بسته شد!",
"deletedTicketDmTitle":"تیکت حذف شد!",
"closedTicketDmDescription":"تیکت شما بسته شده هست!",
"deletedTicketDmDescription":"تیکت شما حذف شده هست!",
"reopenTicketDmTitle":"تیکت دوباره باز شد!",
"reopenTicketDmDescription":"تیکت شما دوباره باز شده هست!",
"chooseCategory":"یک دسته بندی رو انتخاب کن:",
"gettingdeleted":"تیکت در حال حذف شدن هست...",
"none":"هیچ",
"reason":"دلیل",
"createdat":"ایجاد شده در",
"openedby":"باز شده توسط",
"deletedby":"حذف شده توسط",
"closedby":"بسته شده توسط",
"modalreason":"دلیل بستن این تیکت چیه؟",
"chooseATicket": "یک تیکت رو انتخاب کن"
},
"transcripts":{
"title":"گزارش",
"processed":"این گزارش در حال پردازش هست",
"wait":"لطفاً صبر کن!",
"estimated":"زمان تقریبی",
"available":"گزارش در دسترس هست در اینجا"
},
"stats":{
"globalTitle":"آمار گلوبال",
"ticketTitle":"آمار تیکت برای {0}",
"userTitle":"آمار یوزر برای {0}",
"systemTitle":"آمار سیستم",
"versionTitle":"ورژن ربات",
"ticketsCreated":"تیکت‌های ایجاد شده",
"ticketsClosed":"تیکت‌های بسته شده",
"ticketsDeleted":"تیکت‌های حذف شده",
"ticketsReopened":"تیکت‌های دوباره باز شده",
"ticketsAutoclosed":"تیکت‌های به طور خودکار بسته شده",
"transcriptsCreated":"گزارش‌های ایجاد شده",
"startupDate":"تاریخ راه‌اندازی‌",
"latestUpdate":"آخرین بروزرسانی",
"ticketCreatedOn":"تیکت ایجاد شده در",
"ticketCreatedBy":"تیکت ایجاد شده توسط",
"messagesSent":"پیام‌های ارسال شده",
"status":"وضعیت",
"participants":"مشارکت‌کنندگان",
"role":"رول",
"switches":{
"globalAdmin":"ادمین گلوبال",
"ticketAdmin":"ادمین تیکت",
"member":"ممبر",
"open":"باز",
"reopened":"دوباره باز شده",
"closed":"بسته شده",
"autoclosed":"بسته شده به طور خودکار"
},
"errorUserNotFound":"این یوزر در دیتابیس آمار پیدا نمیشه!"
}
}
+6 -6
View File
@@ -1,16 +1,15 @@
{ {
"name": "open-ticket", "name": "open-ticket",
"author": "DJdj Development",
"version": "3.5.4", "version": "3.5.4",
"description": "TThe most advanced open-source discord ticket bot with HTML transcripts and plugins! It uses discord.js v14 & no database required!", "description": "The most advanced open-source discord ticket bot with HTML transcripts and plugins! It uses discord.js v14 & no database required!",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "node index.js", "start": "node index.js",
"test": "node index.js --devconfig --noerrorupload", "test": "node index.js --devconfig --noerrorupload",
"slashEnable": "node index.js slash enable", "slashEnable": "node index.js slash enable",
"slashDisable": "node index.js slash disable", "slashDisable": "node index.js slash disable"
"cleardata": "node ./core/dynamicdatabase/cleardata.js"
}, },
"author": "DJdj Development",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"axios": "^1.6.2", "axios": "^1.6.2",
@@ -22,7 +21,8 @@
"url": "git+https://github.com/DJj123dj/open-ticket.git" "url": "git+https://github.com/DJj123dj/open-ticket.git"
}, },
"bugs": { "bugs": {
"url": "https://github.com/DJj123dj/open-ticket/issues" "url": "https://github.com/DJj123dj/open-ticket/issues",
"email": "support@dj-dj.be"
}, },
"homepage": "https://github.com/DJj123dj/open-ticket#readme" "homepage": "https://openticket.dj-dj.be"
} }