most of the files now support translation
v2.1.0 push 8
This commit is contained in:
+3
-3
@@ -9,7 +9,7 @@ module.exports = () => {
|
||||
client.on("messageCreate",msg => {
|
||||
if (!msg.content.startsWith(config.prefix+"add")) return
|
||||
var user = msg.mentions.users.first()
|
||||
if (!user) return msg.channel.send({embeds:[bot.errorLog.invalidArgsMessage("Missing Argument `<user>`:\n`"+config.prefix+"add <user>`")]})
|
||||
if (!user) return msg.channel.send({embeds:[bot.errorLog.invalidArgsMessage(l.errors.missingArgsDescription+" `<user>`:\n`"+config.prefix+"add <user>`")]})
|
||||
|
||||
if (!msg.member.permissions.has("MANAGE_CHANNELS") && !msg.member.permissions.has("ADMINISTRATOR")){
|
||||
return msg.channel.send({embeds:[bot.errorLog.noPermsMessage]})
|
||||
@@ -21,7 +21,7 @@ module.exports = () => {
|
||||
if (firstmsg == undefined || firstmsg.author.id != client.user.id) return msg.channel.send({embeds:[bot.errorLog.notInATicket]})
|
||||
|
||||
msg.channel.permissionOverwrites.create(user.id, { VIEW_CHANNEL:true, ADD_REACTIONS:true,ATTACH_FILES:true, EMBED_LINKS:true, SEND_MESSAGES:true})
|
||||
msg.channel.send({embeds:[bot.errorLog.success("User Added!",user.tag+" is added to this ticket")]})
|
||||
msg.channel.send({embeds:[bot.errorLog.success(l.commands.userAddedTitle,l.commands.userAddedDescription.replace("{0}",user.tag))]})
|
||||
|
||||
var loguser = msg.mentions.users.first()
|
||||
log("command","someone used the 'add' command",[{key:"user",value:msg.author.tag}])
|
||||
@@ -48,7 +48,7 @@ module.exports = () => {
|
||||
if (firstmsg == undefined || firstmsg.author.id != client.user.id) return interaction.reply({embeds:[bot.errorLog.notInATicket]})
|
||||
|
||||
interaction.channel.permissionOverwrites.create(user.id, { VIEW_CHANNEL:true, ADD_REACTIONS:true,ATTACH_FILES:true, EMBED_LINKS:true, SEND_MESSAGES:true})
|
||||
interaction.reply({embeds:[bot.errorLog.success("User Added!",user.tag+" is added to this ticket")]})
|
||||
interaction.reply({embeds:[bot.errorLog.success(l.commands.userAddedTitle,l.commands.userAddedDescription.replace("{0}",user.tag))]})
|
||||
|
||||
var loguser = user
|
||||
log("command","someone used the 'add' command",[{key:"user",value:interaction.user.tag}])
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ module.exports = () => {
|
||||
.setEmoji("🔒")
|
||||
])
|
||||
|
||||
msg.channel.send({embeds:[bot.errorLog.success("Close this ticket!","You can close this ticket by clicking on the button below!")],components:[closebutton]})
|
||||
msg.channel.send({embeds:[bot.errorLog.success(l.commands.closeTitle,l.commands.closeDescription)],components:[closebutton]})
|
||||
|
||||
log("command","someone used the 'close' command",[{key:"user",value:msg.author.tag}])
|
||||
|
||||
@@ -51,7 +51,7 @@ module.exports = () => {
|
||||
.setEmoji("🔒")
|
||||
])
|
||||
|
||||
interaction.reply({embeds:[bot.errorLog.success("Close this ticket!","You can close this ticket by clicking on the button below!")],components:[closebutton]})
|
||||
interaction.reply({embeds:[bot.errorLog.success(l.commands.closeTitle,l.commands.closeDescription)],components:[closebutton]})
|
||||
|
||||
log("command","someone used the 'close' command",[{key:"user",value:interaction.user.tag}])
|
||||
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ module.exports = () => {
|
||||
.setEmoji("❌")
|
||||
])
|
||||
|
||||
msg.channel.send({embeds:[bot.errorLog.success("Delete this ticket!","You can delete this ticket by clicking on the button below!")],components:[closebutton]})
|
||||
msg.channel.send({embeds:[bot.errorLog.success(l.commands.deleteTitle,l.commands.deleteDescription)],components:[closebutton]})
|
||||
|
||||
log("command","someone used the 'delete' command",[{key:"user",value:msg.author.tag}])
|
||||
|
||||
@@ -51,7 +51,7 @@ module.exports = () => {
|
||||
.setEmoji("❌")
|
||||
])
|
||||
|
||||
interaction.reply({embeds:[bot.errorLog.success("Delete this ticket!","You can delete this ticket by clicking on the button below!")],components:[closebutton]})
|
||||
interaction.reply({embeds:[bot.errorLog.success(l.commands.deleteTitle,l.commands.deleteDescription)],components:[closebutton]})
|
||||
|
||||
log("command","someone used the 'close' command",[{key:"user",value:interaction.user.tag}])
|
||||
|
||||
|
||||
+3
-3
@@ -8,11 +8,11 @@ const l = bot.language
|
||||
module.exports = () => {
|
||||
const helpEmbed = new discord.MessageEmbed()
|
||||
.setColor(config.main_color)
|
||||
.setTitle("Help Menu:")
|
||||
.setTitle(l.helpMenu.title)
|
||||
|
||||
const prefix = config.prefix
|
||||
const header = config.system.ticket_channel ? "**Go to <#"+config.system.ticket_channel+"> to create a ticket!**\n\n" : "**Run the command `/new` or `/ticket` to create a ticket!**\n\n"
|
||||
helpEmbed.setDescription(header+"`"+prefix+"msg <id>` ➜ _Spawn an embed with buttons. (admin only)_\n\n`"+prefix+"rename <name>` ➜ _Rename a ticket. (no spaces)_\n`"+prefix+"close` ➜ _Close a ticket._\n`"+prefix+"delete` ➜ _Delete a ticket._\n`"+prefix+"reopen` ➜ _Re-Open a ticket after it was closed._\n\n`"+prefix+"add <user>` ➜ _Add a user to the ticket._\n`"+prefix+"remove <user>` ➜ _Remove a user from the ticket._`")
|
||||
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+"_`")
|
||||
|
||||
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"})
|
||||
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ module.exports = () => {
|
||||
client.on("messageCreate",msg => {
|
||||
if (!msg.content.startsWith(config.prefix+"remove")) return
|
||||
var user = msg.mentions.users.first()
|
||||
if (!user) return msg.channel.send({embeds:[bot.errorLog.invalidArgsMessage("Missing Argument `<user>`:\n`"+config.prefix+"remove <user>`")]})
|
||||
if (!user) return msg.channel.send({embeds:[bot.errorLog.invalidArgsMessage(l.errors.missingArgsDescription+" `<user>`:\n`"+config.prefix+"remove <user>`")]})
|
||||
|
||||
if (!msg.member.permissions.has("MANAGE_CHANNELS") && !msg.member.permissions.has("ADMINISTRATOR")){
|
||||
return msg.channel.send({embeds:[bot.errorLog.noPermsMessage]})
|
||||
@@ -21,7 +21,7 @@ module.exports = () => {
|
||||
if (firstmsg == undefined || firstmsg.author.id != client.user.id) return msg.channel.send({embeds:[bot.errorLog.notInATicket]})
|
||||
|
||||
msg.channel.permissionOverwrites.delete(user.id)
|
||||
msg.channel.send({embeds:[bot.errorLog.success("User removed!",user.tag+" is removed from this ticket")]})
|
||||
msg.channel.send({embeds:[bot.errorLog.success(l.commands.userRemovedTitle,l.commands.userRemovedDescription.replace("{0}",user.tag))]})
|
||||
|
||||
var loguser = msg.mentions.users.first()
|
||||
|
||||
@@ -50,7 +50,7 @@ module.exports = () => {
|
||||
if (firstmsg == undefined || firstmsg.author.id != client.user.id) return interaction.reply({embeds:[bot.errorLog.notInATicket]})
|
||||
|
||||
interaction.channel.permissionOverwrites.delete(user.id)
|
||||
interaction.reply({embeds:[bot.errorLog.success("User removed!",user.tag+" is removed from this ticket")]})
|
||||
interaction.reply({embeds:[bot.errorLog.success(l.commands.userRemovedTitle,l.commands.userRemovedDescription.replace("{0}",user.tag))]})
|
||||
|
||||
var loguser = user
|
||||
|
||||
|
||||
+3
-3
@@ -21,7 +21,7 @@ module.exports = () => {
|
||||
|
||||
var newname = msg.content.split(config.prefix+"rename")[1].substring(1)
|
||||
|
||||
if (!newname) return msg.channel.send({embeds:[bot.errorLog.invalidArgsMessage("Missing Argument `<name>`:\n`"+config.prefix+"rename <name>`")]})
|
||||
if (!newname) return msg.channel.send({embeds:[bot.errorLog.invalidArgsMessage(l.errors.missingArgsDescription+" `<name>`:\n`"+config.prefix+"rename <name>`")]})
|
||||
|
||||
var name = msg.channel.name
|
||||
var prefix = ""
|
||||
@@ -35,7 +35,7 @@ module.exports = () => {
|
||||
if (!prefix) prefix = "noprefix-"
|
||||
|
||||
msg.channel.setName(prefix+newname)
|
||||
msg.channel.send({embeds:[bot.errorLog.success("The name has changed!","Warning: you can only change the channel name 2 times per minute!\n(this is due discord rate limits)")]})
|
||||
msg.channel.send({embeds:[bot.errorLog.success(l.commands.renameTitle,l.commands.renameWarning)]})
|
||||
|
||||
log("command","someone used the 'rename' command",[{key:"user",value:msg.author.tag}])
|
||||
log("system","ticket renamed",[{key:"user",value:msg.author.tag},{key:"ticket",value:name},{key:"newname",value:newname}])
|
||||
@@ -73,7 +73,7 @@ module.exports = () => {
|
||||
if (!prefix) prefix = "noprefix-"
|
||||
|
||||
interaction.channel.setName(prefix+newname)
|
||||
interaction.reply({embeds:[bot.errorLog.success("The name has changed!","Warning: you can only change the channel name 2 times per minute!\n(this is due discord rate limits)")]})
|
||||
interaction.reply({embeds:[bot.errorLog.success(l.commands.renameTitle,l.commands.renameWarning)]})
|
||||
|
||||
log("command","someone used the 'rename' command",[{key:"user",value:interaction.user.tag}])
|
||||
log("system","ticket renamed",[{key:"user",value:interaction.user.tag},{key:"ticket",value:name},{key:"newname",value:newname}])
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ module.exports = () => {
|
||||
|
||||
if (firstmsg == undefined || firstmsg.author.id != client.user.id) return msg.channel.send({embeds:[bot.errorLog.notInATicket]})
|
||||
|
||||
msg.channel.send({embeds:[bot.errorLog.success("Re-Open this ticket!","You can re-open this ticket by clicking on the button below!")],components:[reopenCommandBar]})
|
||||
msg.channel.send({embeds:[bot.errorLog.success(l.commands.reopenTitle,l.commands.reopenDescription)],components:[reopenCommandBar]})
|
||||
|
||||
|
||||
log("command","someone used the 'reopen' command",[{key:"user",value:msg.author.tag}])
|
||||
@@ -40,7 +40,7 @@ module.exports = () => {
|
||||
|
||||
if (firstmsg == undefined || firstmsg.author.id != client.user.id) return msg.channel.send({embeds:[bot.errorLog.notInATicket]})
|
||||
|
||||
interaction.reply({embeds:[bot.errorLog.success("Re-Open this ticket!","You can re-open this ticket by clicking on the button below!")],components:[reopenCommandBar]})
|
||||
interaction.reply({embeds:[bot.errorLog.success(l.commands.reopenTitle,l.commands.reopenDescription)],components:[reopenCommandBar]})
|
||||
|
||||
|
||||
log("command","someone used the 'reopen' command",[{key:"user",value:interaction.user.tag}])
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ module.exports = () => {
|
||||
|
||||
const id = msg.content.split(config.prefix+"msg")[1].substring(1) ? msg.content.split(config.prefix+"msg")[1].substring(1) : false
|
||||
|
||||
if (!id) return msg.channel.send({embeds:[bot.errorLog.invalidArgsMessage("Missing Argument `<id>`:\n`"+config.prefix+"msg <id>`")]})
|
||||
if (!id) return msg.channel.send({embeds:[bot.errorLog.invalidArgsMessage(l.errors.missingArgsDescription+" `<id>`:\n`"+config.prefix+"msg <id>`")]})
|
||||
if (!msgIds.includes(id)) return msg.channel.send({embeds:[bot.errorLog.invalidIdChooseFromList(msgIds)]})
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ module.exports = () => {
|
||||
|
||||
const {embed,componentRows} = require("../core/ticketMessageEmbed").createEmbed(id)
|
||||
|
||||
interaction.reply({content:"The embed is in the message below!"})
|
||||
interaction.reply({content:l.commands.ticketWarning})
|
||||
interaction.channel.send({embeds:[embed],components:componentRows})
|
||||
|
||||
log("command","someone used the 'msg' command",[{key:"user",value:interaction.user.tag},{key:"id",value:id}])
|
||||
|
||||
+18
-8
@@ -11,14 +11,14 @@ const embed = discord.MessageEmbed
|
||||
|
||||
exports.noPermsMessage = new embed()
|
||||
.setColor("RED")
|
||||
.setTitle(":x: No Permissions! :x:")
|
||||
.setDescription("You don't have the correct roles to run this command!\nYou need the `ADMINISTRATOR` permission or be in the list of allowed roles!")
|
||||
.setTitle(":x: "+l.errors.noPermsTitle+" :x:")
|
||||
.setDescription(l.errors.noPermsDescription)
|
||||
|
||||
/**@param {String} message */
|
||||
exports.invalidArgsMessage = (message) => {
|
||||
var x = new embed()
|
||||
.setColor("RED")
|
||||
.setTitle(":x: Invalid Arguments! :x:")
|
||||
.setTitle(":x: "+l.errors.missingArgsTitle+" :x:")
|
||||
.setDescription(message)
|
||||
|
||||
return x
|
||||
@@ -28,7 +28,7 @@ exports.invalidArgsMessage = (message) => {
|
||||
exports.serverError = (message) => {
|
||||
var x = new embed()
|
||||
.setColor("ORANGE")
|
||||
.setTitle(":warning: Bot Error! :warning:")
|
||||
.setTitle(":warning: "+l.errors.boterror+" :warning:")
|
||||
.setDescription(message)
|
||||
|
||||
return x
|
||||
@@ -38,15 +38,15 @@ exports.serverError = (message) => {
|
||||
exports.invalidIdChooseFromList = (list) => {
|
||||
var x = new embed()
|
||||
.setColor("RED")
|
||||
.setTitle(":x: Invalid ID :x:")
|
||||
.setDescription("Choose one of the id's below:\n`"+list.join("`\n`")+"`")
|
||||
.setTitle(":x: "+l.errors.chooseFromListTitle+" :x:")
|
||||
.setDescription(l.errors.chooseFromListDescription+"\n`"+list.join("`\n`")+"`")
|
||||
return x
|
||||
}
|
||||
|
||||
exports.notInATicket = new embed()
|
||||
.setColor("RED")
|
||||
.setTitle(":x: You are not in a ticket! :x:")
|
||||
.setDescription("This command doesn't work outside tickets!")
|
||||
.setTitle(":x: "+l.errors.notInTicketTitle+" :x:")
|
||||
.setDescription(l.errors.notInTicketDescription)
|
||||
|
||||
|
||||
/**@param {String} message @param {String} title */
|
||||
@@ -79,6 +79,12 @@ exports.custom = (title,message,emoji,color) => {
|
||||
return x
|
||||
}
|
||||
|
||||
const normalLog = (debugString) => {
|
||||
const fs = require("fs")
|
||||
const content = fs.existsSync("./openticketdebug.txt") ? fs.readFileSync("./openticketdebug.txt").toString() : "==========================\n<OPEN TICKET DEBUG FILE:>\n=========================="
|
||||
fs.writeFileSync("./openticketdebug.txt",content+"\nSYSTEM: "+debugString)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {"system"|"command"|"info"} type
|
||||
@@ -104,4 +110,8 @@ exports.log = async (type,message,params) => {
|
||||
}else if (type == "system"){
|
||||
console.log(chalk.green("[system] ")+message+" "+chalk.yellow(parameters))
|
||||
}
|
||||
|
||||
const cd = new Date()
|
||||
const months = ["January","February","March","April","May","June","July","August","September","October","November","December"]
|
||||
normalLog("["+cd.getDate()+" "+months[cd.getMonth()-1]+" "+cd.getFullYear()+" - "+cd.getSeconds()+":"+cd.getMinutes()+":"+cd.getHours()+"] ["+type+"] "+message+" "+parameters)
|
||||
}
|
||||
@@ -181,7 +181,7 @@ module.exports = async () => {
|
||||
readystats++
|
||||
})
|
||||
|
||||
//rename
|
||||
//reopen
|
||||
client.application.commands.create({
|
||||
name:"reopen",
|
||||
description:"Reopen this ticket.",
|
||||
|
||||
@@ -48,6 +48,8 @@ module.exports = () => {
|
||||
//ticketoptions from config
|
||||
const currentTicketOptions = getconfigoptions.getOptionsById(customId)
|
||||
|
||||
if (currentTicketOptions.type != "ticket") return interaction.reply({embeds:bot.errorLog.serverError("This option isn't a ticket!")})
|
||||
|
||||
if (currentTicketOptions == false || currentTicketOptions.type != "ticket") return interaction.reply({embeds:[bot.errorLog.serverError("This option is not a ticket but another type!")]})
|
||||
|
||||
if (interaction.isButton()){
|
||||
|
||||
@@ -14,6 +14,9 @@ if (process.argv[2]){
|
||||
}else{var isDev = false}
|
||||
|
||||
exports.developerMode = isDev
|
||||
const language = require("./core/languageManager").language
|
||||
exports.language = language
|
||||
|
||||
if (isDev){
|
||||
try {
|
||||
var config = require('./devConfig.json')
|
||||
@@ -26,15 +29,12 @@ exports.config = config
|
||||
exports.errorLog = require("./core/errorLogSystem")
|
||||
const log = this.errorLog.log
|
||||
|
||||
const language = require("./core/languageManager").language
|
||||
exports.language = language
|
||||
|
||||
client.on('ready',async () => {
|
||||
const chalk = await (await import("chalk")).default
|
||||
|
||||
if (!process.argv[2].startsWith("slash")){
|
||||
console.log(chalk.red("WELCOME TO OPEN TICKET!"))
|
||||
log("info","open ticket ready")
|
||||
log("info","open ticket ready",[{key:"version",value:require("./package.json").version}])
|
||||
|
||||
console.log(chalk.blue("\n\nlogs:")+"\n============")
|
||||
if (config.status.enabled){
|
||||
@@ -89,52 +89,27 @@ if (process.argv[2] && !process.argv[2].startsWith("slash")){
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=====================================================================
|
||||
//=====================================================================
|
||||
//ERROR DEBUG MODE: turn not on exept when you know what you are doing!
|
||||
var errorDebugMode = false
|
||||
//ERROR DEBUG MODE: turn not on exept when you know what you are doing!
|
||||
//=====================================================================
|
||||
//=====================================================================
|
||||
|
||||
|
||||
|
||||
if (!errorDebugMode){
|
||||
process.on("uncaughtException",async (error,origin) => {
|
||||
const chalk = await (await import("chalk")).default
|
||||
console.log(chalk.red("\nOPEN TICKET ERROR: ")+error+"\n"+chalk.green("\nCreate a ticket in our support server for more information!\nIf you do this, you might help us to avoid a future bug!\n"))
|
||||
})
|
||||
}
|
||||
if (errorDebugMode) {
|
||||
const debugLog = (debugString) => {
|
||||
const debugLog = (debugString) => {
|
||||
const content = fs.existsSync("./openticketdebug.txt") ? fs.readFileSync("./openticketdebug.txt").toString() : "==========================\n<OPEN TICKET DEBUG FILE:>\n=========================="
|
||||
fs.writeFileSync("./openticketdebug.txt",content+"\nDEBUG: "+debugString)
|
||||
}
|
||||
const errorLog = (errorString,stack) => {
|
||||
}
|
||||
const errorLog = (errorString,stack) => {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
client.on("debug", async (message) => {
|
||||
client.on("debug", async (message) => {
|
||||
if (message.startsWith("Provided token:")){
|
||||
debugLog("Provided token: ***********bot token is invisible**************...")
|
||||
return
|
||||
}
|
||||
debugLog(message)
|
||||
});
|
||||
});
|
||||
|
||||
const asyncfunction = async () => {
|
||||
process.on("uncaughtException",async (error,origin) => {
|
||||
const chalk = await (await import("chalk")).default
|
||||
console.log("\n\nopen-ticket debug:\n"+chalk.bgYellow("ENTERING DEBUG MODE:"))
|
||||
}
|
||||
asyncfunction()
|
||||
|
||||
process.on("uncaughtException",async (error,origin) => {
|
||||
const chalk = await (await import("chalk")).default
|
||||
console.log(chalk.red("\nMAIN ERROR: ")+"this error is saved in the debug file!")
|
||||
console.log(chalk.red("\nOPEN TICKET ERROR: ")+error+"\n"+chalk.green("\nCreate a ticket in our support server for more information!\nIf you do this, you might help us to avoid a future bug!\n"))
|
||||
errorLog(error.name+": "+error.message+" | origin: "+origin,error.stack)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
client.login(config.auth_token)
|
||||
@@ -4,7 +4,9 @@
|
||||
"missingArgsDescription":"Missing Argument",
|
||||
"noPermsTitle":"No Permissions!",
|
||||
"noPermsDescription":"You don't have the correct roles to run this command!\nYou need the `ADMINISTRATOR` permission or be in the list of allowed roles!",
|
||||
"chooseFromList":"Choose one of the id's below:",
|
||||
"chooseFromListTitle":"Invalid ID",
|
||||
"chooseFromListDescription":"Choose one of the id's below:",
|
||||
"boterror":"Bot Error!",
|
||||
"notInTicketTitle":"You are not in a ticket!",
|
||||
"notInTicketDescription":"This command doesn't work outside tickets!",
|
||||
"ticketDoesntExist":"This ticket doesn't exist anymore!",
|
||||
|
||||
Reference in New Issue
Block a user