3.0 public beta 4

This commit is contained in:
DJj123dj
2022-10-05 20:25:35 +02:00
parent 69b669956e
commit e4c1e2559e
27 changed files with 397 additions and 51 deletions
+1
View File
@@ -27,6 +27,7 @@ This is an open-source discord ticket bot, you can configure it and it comes wit
- josuens14 - josuens14
- M4 - M4
- David. - David.
- Maurizio
## features ## features
- discord interaction buttons - discord interaction buttons
+80
View File
@@ -0,0 +1,80 @@
const discord = require('discord.js')
const bot = require('../index')
const client = bot.client
const config = bot.config
const log = bot.errorLog.log
const l = bot.language
const permsChecker = require("../core/utils/permisssionChecker")
const APIEvents = require("../core/api/modules/events")
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 (!msg.content.startsWith(config.prefix+"claim")) return
var user = msg.mentions.users.first()
const claimingUser = user ? user : msg.author
if (!msg.guild) return
if (!permsChecker.command(msg.author.id,msg.guild.id)){
permsChecker.sendUserNoPerms(msg.author)
return
}
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 hiddendata = bot.hiddenData.readHiddenData(firstmsg.embeds[0].description)
const ticketId = hiddendata.data.find(d => d.key == "type").value
//msg.channel.send({embeds:[bot.embeds.commands.claimEmbed(claimingUser,msg.author)]})
msg.channel.send({embeds:[bot.errorLog.warning("Coming soon!","This feature isn't ready yet!\nIt will become active in the next update!")]})
var loguser = claimingUser
log("command","someone used the 'claim' command",[{key:"user",value:msg.author.tag}])
log("system","user claimed to ticket",[{key:"user",value:msg.author.tag},{key:"ticket",value:msg.channel.name},{key:"claimed_user",value:claimingUser.tag}])
const ticketData = require("../core/utils/configParser").getTicketById(ticketId,true)
//APIEvents.onTicketAdd(msg.author,loguser,msg.channel,msg.guild,new Date(),{status:"open",name:msg.channel.name,ticketOptions:ticketData})
//APIEvents.onCommand("add",permsChecker.command(msg.author.id,msg.guild.id),msg.author,msg.channel,msg.guild,new Date())
})
})
if (!DISABLE.commands.slash.claim) client.on("interactionCreate",(interaction) => {
if (!interaction.isChatInputCommand()) return
if (interaction.commandName != "claim") return
const user = interaction.options.getUser("user",false) ? interaction.options.getUser("user",true) : interaction.user
if (!interaction.guild) return
if (!permsChecker.command(interaction.user.id,interaction.guild.id)){
permsChecker.sendUserNoPerms(interaction.user)
return
}
interaction.channel.messages.fetchPinned().then(msglist => {
var firstmsg = msglist.last()
if (firstmsg == undefined || firstmsg.author.id != client.user.id) return interaction.reply({embeds:[bot.errorLog.notInATicket]})
const hiddendata = bot.hiddenData.readHiddenData(firstmsg.embeds[0].description)
const ticketId = hiddendata.data.find(d => d.key == "type").value
//interaction.reply({embeds:[bot.embeds.commands.claimEmbed(user,interaction.user)]})
interaction.reply({embeds:[bot.errorLog.warning("Coming soon!","This feature isn't ready yet!\nIt will become active in the next update!")]})
var loguser = user
log("command","someone used the 'claim' command",[{key:"user",value:interaction.user.tag}])
log("system","user claimed to ticket",[{key:"user",value:interaction.user.tag},{key:"ticket",value:interaction.channel.name},{key:"claimed_user",value:loguser.tag}])
const ticketData = require("../core/utils/configParser").getTicketById(ticketId,true)
//APIEvents.onTicketAdd(interaction.user,loguser,interaction.channel,interaction.guild,new Date(),{status:"open",name:interaction.channel.name,ticketOptions:ticketData})
//APIEvents.onCommand("add",permsChecker.command(interaction.user.id,interaction.guild.id),interaction.user,interaction.channel,interaction.guild,new Date())
})
})
}
+4 -2
View File
@@ -11,13 +11,15 @@ const DISABLE = require("../core/api/api.json").disable
module.exports = () => { module.exports = () => {
bot.errorLog.log("debug","COMMANDS: loaded help.js") bot.errorLog.log("debug","COMMANDS: loaded help.js")
const msgName = config.system.showSlashcmdsInHelp ? "message" : "msg"
const prefix = config.system.showSlashcmdsInHelp ? "/" : config.prefix
const helpEmbed = new discord.EmbedBuilder() const helpEmbed = new discord.EmbedBuilder()
.setColor(config.main_color) .setColor(config.main_color)
.setTitle("❔ "+l.helpMenu.title) .setTitle("❔ "+l.helpMenu.title)
const prefix = config.prefix
const header = config.system.ticket_channel ? l.helpMenu.header1.replace("{0}","<#"+config.system.ticket_channel+">") : l.helpMenu.header2 const header = config.system.ticket_channel ? l.helpMenu.header1.replace("{0}","<#"+config.system.ticket_channel+">") : l.helpMenu.header2
helpEmbed.setDescription(header+"`"+prefix+"msg <id>` ➜ _"+l.helpMenu.msgCmd+"_\n\n`"+prefix+"rename <name>` ➜ _"+l.helpMenu.renameCmd+"_\n`"+prefix+"close` ➜ _"+l.helpMenu.closeCmd+"_\n`"+prefix+"delete` ➜ _"+l.helpMenu.deleteCmd+"_\n`"+prefix+"reopen` ➜ _"+l.helpMenu.reopenCmd+"_\n\n`"+prefix+"add <user>` ➜ _"+l.helpMenu.addCmd+"_\n`"+prefix+"remove <user>` ➜ _"+l.helpMenu.removeCmd+"_`") helpEmbed.setDescription(header+"`"+prefix+msgName+" <id>` ➜ _"+l.helpMenu.msgCmd+"_\n\n`"+prefix+"rename <name>` ➜ _"+l.helpMenu.renameCmd+"_\n`"+prefix+"close` ➜ _"+l.helpMenu.closeCmd+"_\n`"+prefix+"delete` ➜ _"+l.helpMenu.deleteCmd+"_\n`"+prefix+"reopen` ➜ _"+l.helpMenu.reopenCmd+"_\n\n`"+prefix+"add <user>` ➜ _"+l.helpMenu.addCmd+"_\n`"+prefix+"remove <user>` ➜ _"+l.helpMenu.removeCmd+"_")
if (config.credits) helpEmbed.setFooter({text:"Open-Ticket by DJdj Development | view on github for source code",iconURL:"https://raw.githubusercontent.com/DJj123dj/open-ticket/main/logo.png"}) if (config.credits) helpEmbed.setFooter({text:"Open-Ticket by DJdj Development | view on github for source code",iconURL:"https://raw.githubusercontent.com/DJj123dj/open-ticket/main/logo.png"})
+77
View File
@@ -0,0 +1,77 @@
const discord = require('discord.js')
const bot = require('../index')
const client = bot.client
const config = bot.config
const log = bot.errorLog.log
const l = bot.language
const permsChecker = require("../core/utils/permisssionChecker")
const APIEvents = require("../core/api/modules/events")
const DISABLE = require("../core/api/api.json").disable
module.exports = () => {
bot.errorLog.log("debug","COMMANDS: loaded unclaim.js")
if (!DISABLE.commands.text.unclaim) client.on("messageCreate",msg => {
if (!msg.content.startsWith(config.prefix+"unclaim")) return
if (!msg.guild) return
if (!permsChecker.command(msg.author.id,msg.guild.id)){
permsChecker.sendUserNoPerms(msg.author)
return
}
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 hiddendata = bot.hiddenData.readHiddenData(firstmsg.embeds[0].description)
const ticketId = hiddendata.data.find(d => d.key == "type").value
//msg.channel.send({embeds:[bot.embeds.commands.unclaimEmbed(msg.author)]})
msg.channel.send({embeds:[bot.errorLog.warning("Coming soon!","This feature isn't ready yet!\nIt will become active in the next update!")]})
var loguser = msg.author
log("command","someone used the 'unclaim' command",[{key:"user",value:msg.author.tag}])
log("system","user unclaimed from ticket",[{key:"user",value:msg.author.tag},{key:"ticket",value:msg.channel.name},{key:"unclaimed_user",value:msg.author.tag}])
const ticketData = require("../core/utils/configParser").getTicketById(ticketId,true)
//APIEvents.onTicketAdd(msg.author,loguser,msg.channel,msg.guild,new Date(),{status:"open",name:msg.channel.name,ticketOptions:ticketData})
//APIEvents.onCommand("add",permsChecker.command(msg.author.id,msg.guild.id),msg.author,msg.channel,msg.guild,new Date())
})
})
if (!DISABLE.commands.slash.unclaim) client.on("interactionCreate",(interaction) => {
if (!interaction.isChatInputCommand()) return
if (interaction.commandName != "unclaim") return
const user = interaction.user
if (!interaction.guild) return
if (!permsChecker.command(interaction.user.id,interaction.guild.id)){
permsChecker.sendUserNoPerms(interaction.user)
return
}
interaction.channel.messages.fetchPinned().then(msglist => {
var firstmsg = msglist.last()
if (firstmsg == undefined || firstmsg.author.id != client.user.id) return interaction.reply({embeds:[bot.errorLog.notInATicket]})
const hiddendata = bot.hiddenData.readHiddenData(firstmsg.embeds[0].description)
const ticketId = hiddendata.data.find(d => d.key == "type").value
//interaction.reply({embeds:[bot.embeds.commands.unclaimEmbed(interaction.user)]})
interaction.reply({embeds:[bot.errorLog.warning("Coming soon!","This feature isn't ready yet!\nIt will become active in the next update!")]})
var loguser = user
log("command","someone used the 'unclaim' command",[{key:"user",value:interaction.user.tag}])
log("system","user unclaimed from ticket",[{key:"user",value:interaction.user.tag},{key:"ticket",value:interaction.channel.name},{key:"unclaimed_user",value:loguser.tag}])
const ticketData = require("../core/utils/configParser").getTicketById(ticketId,true)
//APIEvents.onTicketAdd(interaction.user,loguser,interaction.channel,interaction.guild,new Date(),{status:"open",name:interaction.channel.name,ticketOptions:ticketData})
//APIEvents.onCommand("add",permsChecker.command(interaction.user.id,interaction.guild.id),interaction.user,interaction.channel,interaction.guild,new Date())
})
})
}
+12 -3
View File
@@ -24,7 +24,9 @@
"enable_transcript":false, "enable_transcript":false,
"enable_DM_transcript":false, "enable_DM_transcript":false,
"transcript_channel":"channel id" "transcript_channel":"channel id",
"showSlashcmdsInHelp":false
}, },
"options":[ "options":[
@@ -44,8 +46,15 @@
"enableDmOnOpen":true, "enableDmOnOpen":true,
"ticketmessage":"The staff will help you soon!\n\n*Click on the button below to close the ticket!*", "ticketmessage":"The staff will help you soon!\n\n*Click on the button below to close the ticket!*",
"enableThumbnail":false, "thumbnail":{
"thumbnailUrl":"https://www.example.com/catmemes/cat.png" "enable":false,
"url":"https://www.example.com/catmemes/cat.png"
},
"closedCategory":{
"enable":false,
"id":"category id"
}
}, },
{ {
+11 -2
View File
@@ -1,6 +1,7 @@
{ {
"version":"1.0.0", "version":"1.0.0",
"enableAPIdebug":false, "enableAPIdebug":false,
"enableAPIconsolelogs":false,
"info":"If you turn these switches to true, then the feature will be turned OFF!", "info":"If you turn these switches to true, then the feature will be turned OFF!",
"info2":"You can use this to disable some features you don't want!", "info2":"You can use this to disable some features you don't want!",
@@ -26,7 +27,9 @@
"new":false, "new":false,
"add":false, "add":false,
"remove":false, "remove":false,
"rename":false "rename":false,
"claim":false,
"unclaim":false
}, },
"slash":{ "slash":{
"help":false, "help":false,
@@ -37,12 +40,18 @@
"new":false, "new":false,
"add":false, "add":false,
"remove":false, "remove":false,
"rename":false "rename":false,
"claim":false,
"unclaim":false
} }
}, },
"checkerjs":{ "checkerjs":{
"token":false, "token":false,
"all":false "all":false
},
"debug":{
"all":false,
"debuglogs":false
} }
} }
} }
+2 -22
View File
@@ -1,28 +1,8 @@
const discord = require('discord.js')
const bot = require("../../../index")
const client = bot.client
const config = bot.config
const log = bot.errorLog.log
const l = bot.language
const storage = bot.storage
/** FOR DEVELOPERS ONLY!! /** FOR DEVELOPERS ONLY!!
* Don't change anything in this file, read the api documentation first! * Don't change anything in this file before reading the documentation!
* look into "api docs.md" for the docs! * visit the api documentation at https://docs.openticket.dj-dj.be
*/ */
//used when creating plugins!
exports.enableApiLogs = false
//DOESN'T WORK YET
//this is used when embedding open ticket into another bot
exports.embeddedMode = false exports.embeddedMode = false
exports.clientLocation = require("../../../index").client exports.clientLocation = require("../../../index").client
/** !! WARNING !!
* Only edit or extend the code when you know what you are doing!
* If open ticket crashes while you change the code, then we can't help you!
*
* DO IT ON YOUR OWN RISK!
*/
+13 -1
View File
@@ -217,6 +217,17 @@ exports.checker = async () => {
//ticketmessage //ticketmessage
checkType(option.ticketmessage,"string",path+"/ticketmessage") checkType(option.ticketmessage,"string",path+"/ticketmessage")
//thumbnail
checkType(option.thumbnail.enable,"boolean",path/"/thumbnail/enable")
checkType(option.thumbnail.url,"string",path/"/thumbnail/url")
//closedCategory
checkType(option.closedCategory.enable,"boolean",path/"/closedCategory/enable")
checkType(option.closedCategory.id,"string",path/"/closedCategory/id")
if (option.closedCategory.enable){
checkDiscord("roleid",option.closedCategory.id,path+"/closedCategory/id")
}
}else if (type == "website"){ }else if (type == "website"){
//url //url
checkType(option.url,"string",path+"/url") checkType(option.url,"string",path+"/url")
@@ -339,7 +350,7 @@ exports.checker = async () => {
//languagefile //languagefile
checkType(config.languagefile,"string","languagefile") checkType(config.languagefile,"string","languagefile")
const lf = config.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")){ 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")){
createError("'languagefile' | invalid language, more info in the wiki") createError("'languagefile' | invalid language, more info in the wiki")
} }
@@ -382,6 +393,7 @@ exports.checker = async () => {
if (config.system.enable_transcript){ if (config.system.enable_transcript){
checkDiscord("channelid",config.system.transcript_channel,"system/transcript_channel") checkDiscord("channelid",config.system.transcript_channel,"system/transcript_channel")
} }
checkType(config.system.showSlashcmdsInHelp,"boolean","system/showSlashcmdsInHelp")
//options //options
+1 -1
View File
@@ -125,7 +125,7 @@ exports.log = async (type,message,params) => {
}else if (ptype == "system"){ }else if (ptype == "system"){
console.log(chalk.green("[system] ")+message+" "+chalk.yellow(parameters)) console.log(chalk.green("[system] ")+message+" "+chalk.yellow(parameters))
}else if (ptype == "api"){ }else if (ptype == "api"){
if (require("./api/modules/base").enableApiLogs == true){ if (require("./api/api.json").enableAPIconsolelogs == true){
console.log(chalk.red("[api v"+require("./api/api.json").version+"] ")+message+" "+chalk.yellow(parameters)) console.log(chalk.red("[api v"+require("./api/api.json").version+"] ")+message+" "+chalk.yellow(parameters))
} }
ptype = "api v"+require("./api/api.json").version ptype = "api v"+require("./api/api.json").version
@@ -90,6 +90,31 @@ exports.renameEmbed = (renamer,newname) => {
.setFooter({text:reopener.tag,iconURL:reopener.displayAvatarURL()}) .setFooter({text:reopener.tag,iconURL:reopener.displayAvatarURL()})
} }
/**
*
* @param {discord.User} claimer
* @param {discord.User} user
* @returns {discord.EmbedBuilder}
*/
exports.claimEmbed = (claimer,user) => {
return new embed()
.setTitle("📌 "+l.commands.claimTitle.replace("{0}",claimer.username))
.setColor(mc)
.setFooter({text:user.tag,iconURL:user.displayAvatarURL()})
}
/**
*
* @param {discord.User} unclaimer
* @returns {discord.EmbedBuilder}
*/
exports.unclaimEmbed = (unclaimer) => {
return new embed()
.setTitle("🆓 "+l.commands.unclaimTitle)
.setColor(mc)
.setFooter({text:unclaimer.tag,iconURL:unclaimer.displayAvatarURL()})
}
/** /**
* *
* @param {Boolean} done * @param {Boolean} done
+1
View File
@@ -15,6 +15,7 @@ else if (config.languagefile.startsWith("romanian")) localLanguage = require("..
else if (config.languagefile.startsWith("arabic")) localLanguage = require("../language/arabic.json") else if (config.languagefile.startsWith("arabic")) localLanguage = require("../language/arabic.json")
else if (config.languagefile.startsWith("spanish")) localLanguage = require("../language/spanish.json") else if (config.languagefile.startsWith("spanish")) localLanguage = require("../language/spanish.json")
else if (config.languagefile.startsWith("portuguese")) localLanguage = require("../language/portuguese.json") else if (config.languagefile.startsWith("portuguese")) localLanguage = require("../language/portuguese.json")
else if (config.languagefile.startsWith("italian")) localLanguage = require("../language/italian.json")
const errorLog = async () => { const errorLog = async () => {
+32 -3
View File
@@ -32,10 +32,10 @@ module.exports = async () => {
//process.stdout.write("[status] there are "+chalk.blue("0 out of 10")+" commands ready! (this can take up to 40 seconds)") //process.stdout.write("[status] there are "+chalk.blue("0 out of 10")+" commands ready! (this can take up to 40 seconds)")
setInterval(() => { setInterval(() => {
process.stdout.cursorTo(0) process.stdout.cursorTo(0)
process.stdout.write("[status] there are "+chalk.blue(readystats+" out of 10")+" commands ready! (this can take up to 40 seconds)") process.stdout.write("[status] there are "+chalk.blue(readystats+" out of 12")+" commands ready! (this can take up to 40 seconds)")
if (readystats >= 10){ if (readystats >= 12){
console.log(chalk.green("\nready!")) console.log(chalk.green("\nready!"))
console.log(chalk.bgBlue("you can now start the bot with 'npm start'!")) console.log(chalk.blue("you can now start the bot with "+chalk.bgBlue("'npm start'")+"!"))
process.exit(1) process.exit(1)
} }
},100) },100)
@@ -202,4 +202,33 @@ module.exports = async () => {
readystats++ readystats++
}) })
//claim
client.application.commands.create({
name:"claim",
description:"Claim this ticket / claim it for someone else.",
defaultPermission:true,
type:act.ChatInput,
options:[
{
name:"user",
type:acot.User,
required:false,
description:"The user to claim for."
}
]
},sid).then(() => {
readystats++
})
//unclaim
client.application.commands.create({
name:"unclaim",
description:"Unclaim this ticket.",
defaultPermission:true,
type:act.ChatInput
},sid).then(() => {
readystats++
})
} }
+10
View File
@@ -154,6 +154,16 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
if (!ticketData) return if (!ticketData) return
if (ticketData.closedCategory.enable){
/**@type {discord.CategoryChannel} */
const category = guild.channels.cache.find(c => c.id == ticketData.closedCategory.id && c.type == discord.ChannelType.GuildCategory)
try {
channel.setParent(category)
}catch{
bot.errorLog.log("system","failed to move channel to new category!")
}
}
/** /**
* @type {String[]} * @type {String[]}
*/ */
+1 -1
View File
@@ -185,7 +185,7 @@ module.exports = () => {
ticketEmbed.setDescription(hiddendata) ticketEmbed.setDescription(hiddendata)
} }
if (currentTicketOptions.enableThumbnail) ticketEmbed.setThumbnail(currentTicketOptions.thumbnailUrl) if (currentTicketOptions.thumbnail.enable) ticketEmbed.setThumbnail(currentTicketOptions.thumbnail.url)
ticketChannel.send({ ticketChannel.send({
content:"<@"+interaction.member.id+"> @here", content:"<@"+interaction.member.id+"> @here",
+3 -3
View File
@@ -6,7 +6,7 @@ const l = bot.language
//================== //==================
//OTTicketOptions //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, enableThumbnail:Boolean, thumbnailUrl:String}} 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}, closedCategory:{enable:Boolean,id:String}}} OTTicketOptions */
//OTRoleOptions //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 */ /**@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 */
@@ -19,7 +19,7 @@ const l = bot.language
/**@typedef {{id: string, name: string, description: string, dropdown: boolean, enableFooter: boolean, footer: string, enableThumbnail: boolean, thumbnail: string, enableCustomColor: boolean, color: string, options: string[], enableTicketExplaination: boolean, enableMaxTicketsWarning: boolean}} OTConfigMessage*/ /**@typedef {{id: string, name: string, description: string, dropdown: boolean, enableFooter: boolean, footer: string, enableThumbnail: boolean, thumbnail: string, enableCustomColor: boolean, color: string, options: string[], enableTicketExplaination: boolean, enableMaxTicketsWarning: boolean}} OTConfigMessage*/
//StringOptions //StringOptions
/**@typedef {"id"|"name"|"description"|"icon"|"label"|"type"|"color"|"adminroles"|"channelprefix"|"category"|"message"|"enableDmOnOpen"|"ticketmessage"|"enableThumbnail"|"thumbnailUrl"} OTTicketStringOptions */ /**@typedef {"id"|"name"|"description"|"icon"|"label"|"type"|"color"|"adminroles"|"channelprefix"|"category"|"message"|"enableDmOnOpen"|"ticketmessage"|"thumbnail"|"closedCategory"} OTTicketStringOptions */
/**@typedef {"id"|"name"|"description"|"icon"|"label"|"type"|"color"|"roles"|"mode"|"enableDmOnOpen"} OTRoleStringOptions */ /**@typedef {"id"|"name"|"description"|"icon"|"label"|"type"|"color"|"roles"|"mode"|"enableDmOnOpen"} OTRoleStringOptions */
/**@typedef {"id"|"name"|"description"|"icon"|"label"|"type"|"url"} OTWebsiteStringOptions */ /**@typedef {"id"|"name"|"description"|"icon"|"label"|"type"|"url"} OTWebsiteStringOptions */
@@ -169,7 +169,7 @@ this.messageType = {}
//OTAllOptions //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, enableThumbnail:Boolean, thumbnailUrl:String,url:String}} 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}, url:String, closedCategory:{enable:Boolean,id:String}}} OTAllOptions */
/** /**
* *
+17 -3
View File
@@ -12,7 +12,11 @@
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
const client = new discord.Client({ const APIBase = require("./core/api/modules/base")
if (APIBase.embeddedMode){
var tempClient = APIBase.clientLocation
}else{
var tempClient = new discord.Client({
intents:[ intents:[
GatewayIntentBits.DirectMessages, GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildInvites, GatewayIntentBits.GuildInvites,
@@ -22,7 +26,10 @@ const client = new discord.Client({
GatewayIntentBits.MessageContent GatewayIntentBits.MessageContent
], ],
partials:[Partials.Channel,Partials.Message] partials:[Partials.Channel,Partials.Message]
}) })
}
/**@type {discord.Client} */
const client = tempClient
exports.client = client exports.client = client
client.setMaxListeners(50) client.setMaxListeners(50)
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")
@@ -183,6 +190,8 @@ if (process.argv[2] && process.argv[2].startsWith("slash")){
require("./commands/add")() require("./commands/add")()
require("./commands/remove")() require("./commands/remove")()
require("./commands/reopen")() require("./commands/reopen")()
require("./commands/claim")()
require("./commands/unclaim")()
this.errorLog.log("debug","LOADING CORE") this.errorLog.log("debug","LOADING CORE")
//core //core
@@ -198,14 +207,19 @@ if (process.argv[2] && process.argv[2].startsWith("slash")){
this.errorLog.log("debug","loading api") this.errorLog.log("debug","loading api")
const APIEvents = require("./core/api/modules/events") const APIEvents = require("./core/api/modules/events")
const APIConfig = require("./core/api/api.json")
const debugLog = (debugString) => { const debugLog = (debugString) => {
if (!APIConfig.disable.debug.all && !APIConfig.disable.debug.debuglogs){
const content = fs.existsSync("./openticketdebug.txt") ? fs.readFileSync("./openticketdebug.txt").toString() : "==========================\n<OPEN TICKET DEBUG FILE:>\n==========================" const content = fs.existsSync("./openticketdebug.txt") ? fs.readFileSync("./openticketdebug.txt").toString() : "==========================\n<OPEN TICKET DEBUG FILE:>\n=========================="
fs.writeFileSync("./openticketdebug.txt",content+"\nDEBUG: "+debugString) fs.writeFileSync("./openticketdebug.txt",content+"\nDEBUG: "+debugString)
}
} }
const errorLog = (errorString,stack) => { const errorLog = (errorString,stack) => {
if (!APIConfig.disable.debug.all){
const content = fs.existsSync("./openticketdebug.txt") ? fs.readFileSync("./openticketdebug.txt").toString() : "==========================\n<OPEN TICKET DEBUG FILE:>\n==========================" const content = fs.existsSync("./openticketdebug.txt") ? fs.readFileSync("./openticketdebug.txt").toString() : "==========================\n<OPEN TICKET DEBUG FILE:>\n=========================="
fs.writeFileSync("./openticketdebug.txt",content+"\nERROR: "+errorString+" STACK: "+stack) fs.writeFileSync("./openticketdebug.txt",content+"\nERROR: "+errorString+" STACK: "+stack)
}
} }
this.errorLog.log("debug","OT error system loaded successfully") this.errorLog.log("debug","OT error system loaded successfully")
@@ -225,5 +239,5 @@ process.on("uncaughtException",async (error,origin) => {
APIEvents.onError(error.name+": "+error.message,new Date()) APIEvents.onError(error.name+": "+error.message,new Date())
}) })
client.login(config.auth_token) if (!APIBase.embeddedMode) client.login(config.auth_token)
this.errorLog.log("debug","login with token") this.errorLog.log("debug","login with token")
+2
View File
@@ -25,6 +25,8 @@
"closeTitle": "تم أغلاق التكت!", "closeTitle": "تم أغلاق التكت!",
"deleteTitle": " جاري حذف التكت...", "deleteTitle": " جاري حذف التكت...",
"reopenTitle": "إعادة فتح التكت!", "reopenTitle": "إعادة فتح التكت!",
"claimTitle":"This ticket is now claimed to {0}",
"unclaimTitle":"This ticket isn't claimed anymore!",
"ticketWarning": "هذا الأمبد موجود بالفعل في الرسالة بالأسفل!", "ticketWarning": "هذا الأمبد موجود بالفعل في الرسالة بالأسفل!",
"maxTicketWarning": "**تحذير:** _يمكنك فقط فتح {0} تكت في الوقت!_" "maxTicketWarning": "**تحذير:** _يمكنك فقط فتح {0} تكت في الوقت!_"
+2
View File
@@ -25,6 +25,8 @@
"closeTitle":"Closed this ticket!", "closeTitle":"Closed this ticket!",
"deleteTitle":"Deleting this ticket...", "deleteTitle":"Deleting this ticket...",
"reopenTitle":"Re-Opened this ticket!", "reopenTitle":"Re-Opened this ticket!",
"claimTitle":"This ticket is now claimed to {0}",
"unclaimTitle":"This ticket isn't claimed anymore!",
"ticketWarning":"The embed is in the message below!", "ticketWarning":"The embed is in the message below!",
"maxTicketWarning":"**Warning:** _You can only create {0} ticket(s) at a time!_" "maxTicketWarning":"**Warning:** _You can only create {0} ticket(s) at a time!_"
+2
View File
@@ -25,6 +25,8 @@
"closeTitle":"Zavři tento ticket!", "closeTitle":"Zavři tento ticket!",
"deleteTitle":"Smaž tento ticket!", "deleteTitle":"Smaž tento ticket!",
"reopenTitle":"Znovu otevři ticket!", "reopenTitle":"Znovu otevři ticket!",
"claimTitle":"This ticket is now claimed to {0}",
"unclaimTitle":"This ticket isn't claimed anymore!",
"ticketWarning":"The embed is in the message below!", "ticketWarning":"The embed is in the message below!",
"maxTicketWarning":"**Varovaní:** _Můžeš si vytvořit použe {0} ticket(s) v jednu chvíli!_" "maxTicketWarning":"**Varovaní:** _Můžeš si vytvořit použe {0} ticket(s) v jednu chvíli!_"
+2
View File
@@ -25,6 +25,8 @@
"closeTitle":"Ticket gesloten!", "closeTitle":"Ticket gesloten!",
"deleteTitle":"Ticket aan het verwijderen...", "deleteTitle":"Ticket aan het verwijderen...",
"reopenTitle":"Ticket heropend!", "reopenTitle":"Ticket heropend!",
"claimTitle":"This ticket is now claimed to {0}",
"unclaimTitle":"This ticket isn't claimed anymore!",
"ticketWarning":"De embed is in het bericht hier onder!", "ticketWarning":"De embed is in het bericht hier onder!",
"maxTicketWarning":"**Waarschuwing:** _Je kan maar {0} ticket(s) tegelijkertijd maken!_" "maxTicketWarning":"**Waarschuwing:** _Je kan maar {0} ticket(s) tegelijkertijd maken!_"
+2
View File
@@ -25,6 +25,8 @@
"closeTitle":"Closed this ticket!", "closeTitle":"Closed this ticket!",
"deleteTitle":"Deleting this ticket...", "deleteTitle":"Deleting this ticket...",
"reopenTitle":"Re-Opened this ticket!", "reopenTitle":"Re-Opened this ticket!",
"claimTitle":"This ticket is now claimed to {0}",
"unclaimTitle":"This ticket isn't claimed anymore!",
"ticketWarning":"The embed is in the message below!", "ticketWarning":"The embed is in the message below!",
"maxTicketWarning":"**Warning:** _You can only create {0} ticket(s) at a time!_" "maxTicketWarning":"**Warning:** _You can only create {0} ticket(s) at a time!_"
+2
View File
@@ -25,6 +25,8 @@
"closeTitle":"Fermé ce ticket!", "closeTitle":"Fermé ce ticket!",
"deleteTitle":"Suppression de ce ticket...", "deleteTitle":"Suppression de ce ticket...",
"reopenTitle":"A rouvert ce ticket!", "reopenTitle":"A rouvert ce ticket!",
"claimTitle":"This ticket is now claimed to {0}",
"unclaimTitle":"This ticket isn't claimed anymore!",
"ticketWarning":"L'intégration est dans le message ci-dessous!", "ticketWarning":"L'intégration est dans le message ci-dessous!",
"maxTicketWarning":"**Attention :** _Vous ne pouvez créer que {0} ticket(s) à la fois !_" "maxTicketWarning":"**Attention :** _Vous ne pouvez créer que {0} ticket(s) à la fois !_"
+2
View File
@@ -25,6 +25,8 @@
"closeTitle":"Closed this ticket!", "closeTitle":"Closed this ticket!",
"deleteTitle":"Deleting this ticket...", "deleteTitle":"Deleting this ticket...",
"reopenTitle":"Re-Opened this ticket!", "reopenTitle":"Re-Opened this ticket!",
"claimTitle":"This ticket is now claimed to {0}",
"unclaimTitle":"This ticket isn't claimed anymore!",
"ticketWarning":"The embed is in the message below!", "ticketWarning":"The embed is in the message below!",
"maxTicketWarning":"**Warning:** _You can only create {0} ticket(s) at a time!_" "maxTicketWarning":"**Warning:** _You can only create {0} ticket(s) at a time!_"
+77
View File
@@ -0,0 +1,77 @@
{
"errors":{
"missingArgsTitle":"Argomenti non validi!",
"missingArgsDescription":"Argomento mancante",
"noPermsTitle":"Permessi mancanti!",
"noPermsDescription":"Hai bisogno del permesso `ADMINISTRATOR` e essere nella lista dei ruoli accettati!",
"noPermsDelete":"Solo gli amministratori possono chiudere un ticket!",
"chooseFromListTitle":"ID non valido",
"chooseFromListDescription":"Scegli uno degli ID sotto:",
"boterror":"Errore del bot!",
"notInTicketTitle":"Non sei in un ticket!",
"notInTicketDescription":"Questo comando non funziona fuori da un ticket!",
"ticketDoesntExist":"Questo ticket non esiste più!",
"roleDoesntExist":"Questo ruolo non esiste più!",
"anotherOption":"Questa opzione non è di un ticket!",
"maxAmountTitle":"Massimo numero raggiunto!",
"maxAmountDescription":"Hai raggiunto il massimo numero di ticket consentiti!\nNon puoi crearne altri!",
"somethingWentWrong":"**Qualcosa è andato storto!**\nPerfavore riprova un'altra volta!",
"somethingWentWrongTranscript":"Qualcosa è andata storta durante la trascrizione!**\nPerfavore riprova un'altra volta!"
},
"commands":{
"userAddedTitle":"Aggiunto {0} al ticket!",
"userRemovedTitle":"Rimosso {0} da questo ticket!",
"renameTitle":"Cambia il nome in {0}!",
"closeTitle":"Chiudo questo ticket!",
"deleteTitle":"Eliminando questo ticket...",
"reopenTitle":"Ri-Aperto questo ticket!",
"claimTitle":"This ticket is now claimed to {0}",
"unclaimTitle":"This ticket isn't claimed anymore!",
"ticketWarning":"L'embed è nel messaggio sotto!",
"maxTicketWarning":"**Attenzione:** _Tu puoi creare solo {0} ticket(s) per volta!_"
},
"helpMenu":{
"title":"Comandi disponibili:",
"header1":"**Vai a {0} per creare un ticket!**\n\n",
"header2":"**Esegui il comando `/new` o `/ticket` per creare un ticket!**\n\n",
"msgCmd":"Crea un embed con pulsanti. (solo amministratori)",
"renameCmd":"Rinomina un ticket. (senza spazi)",
"closeCmd":"Chiudi un ticket.",
"deleteCmd":"Elimina un ticket.",
"addCmd":"Aggiungi un membro al ticket.",
"removeCmd":"Rimuovi un membro dal ticket.",
"reopenCmd":"Riapri un ticket dopo averlo chiuso."
},
"buttons":{
"close":"Chiudi il ticket",
"delete":"Elimina il ticket",
"reopen":"Riapri il ticket",
"sendTranscript":"Trascrizione"
},
"messages":{
"reopenTitle":"Riaperto questo ticket!",
"reopenDescription":"Sentiti libero di parlare di nuovo!",
"closedTitle":"Chiudo questo ticket!",
"closedDescription":"Solo gli amministratori possono parlare in questo ticket ora!\n\n*Clicca sul bottone sotto per chiudere o riaprire questo ticket!*",
"createdTitle":"Ticket creato!",
"createdDescription":"Il tuo ticket è stato creato, puoi capirlo dal ping!",
"newTicketDmTitle":"Nuovo ticket!",
"closedTicketDmTitle":"Ticket chiuso!",
"deletedTicketDmTitle":"Ticket eliminato!",
"closedTicketDmDescription":"Il tuo ticket è chiuso!",
"deletedTicketDmDescription":"Il tuo ticket è stato eliminato!",
"reopenTicketDmTitle":"Ticket riaperto!",
"reopenTicketDmDescription":"Il tuo ticket è stato riaperto!",
"newTranscriptTitle":"Un nuova trascrizione è qui!",
"hereIsTheTranscript":"Qui è la trascrizione:",
"chooseCategory":"scegli una categoria:",
"gettingdeleted":"Il ticket sta per essere chiuso...",
"none":"nessuno",
"reason":"motivo"
}
}
+2
View File
@@ -25,6 +25,8 @@
"closeTitle":"Fechado este ticket!", "closeTitle":"Fechado este ticket!",
"deleteTitle":"Excluindo este ticket...", "deleteTitle":"Excluindo este ticket...",
"reopenTitle":"Reabriu este ticket!", "reopenTitle":"Reabriu este ticket!",
"claimTitle":"This ticket is now claimed to {0}",
"unclaimTitle":"This ticket isn't claimed anymore!",
"ticketWarning":"A incorporação está na mensagem abaixo!", "ticketWarning":"A incorporação está na mensagem abaixo!",
"maxTicketWarning":"**Cuidado:** _Você só pode criar {0} ticket(s) de cada vez!!_" "maxTicketWarning":"**Cuidado:** _Você só pode criar {0} ticket(s) de cada vez!!_"
+2
View File
@@ -25,6 +25,8 @@
"closeTitle":"Ticket inchis!", "closeTitle":"Ticket inchis!",
"deleteTitle":"Se sterge ticket-ul...", "deleteTitle":"Se sterge ticket-ul...",
"reopenTitle":"Ticket Re-deschis!", "reopenTitle":"Ticket Re-deschis!",
"claimTitle":"This ticket is now claimed to {0}",
"unclaimTitle":"This ticket isn't claimed anymore!",
"ticketWarning":"Embed-ul se afla in mesajul de mai jos!", "ticketWarning":"Embed-ul se afla in mesajul de mai jos!",
"maxTicketWarning":"**Avertizare:** _Poti creea doar {0} tickete active!_" "maxTicketWarning":"**Avertizare:** _Poti creea doar {0} tickete active!_"
+2
View File
@@ -25,6 +25,8 @@
"closeTitle":"Cerró este ticket!", "closeTitle":"Cerró este ticket!",
"deleteTitle":"Eliminando este ticket...", "deleteTitle":"Eliminando este ticket...",
"reopenTitle":"Re-abrió este boleto!", "reopenTitle":"Re-abrió este boleto!",
"claimTitle":"This ticket is now claimed to {0}",
"unclaimTitle":"This ticket isn't claimed anymore!",
"ticketWarning":"La inserción está en el mensaje a continuación!", "ticketWarning":"La inserción está en el mensaje a continuación!",
"maxTicketWarning":"**Advertencia:** _Solo puedes crear {0} ticket(s) a la vez!_" "maxTicketWarning":"**Advertencia:** _Solo puedes crear {0} ticket(s) a la vez!_"