v3.2 last push
This commit is contained in:
@@ -17,3 +17,4 @@ storage/.DS_Store
|
|||||||
.vscode/
|
.vscode/
|
||||||
livestatus.json
|
livestatus.json
|
||||||
test.js
|
test.js
|
||||||
|
testtsconfig.json
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
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 change.js")
|
||||||
|
|
||||||
|
if (!DISABLE.commands.text.change) client.on("messageCreate",msg => {
|
||||||
|
if (!msg.content.startsWith(config.prefix+"change")) 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
|
||||||
|
|
||||||
|
var newtype = msg.content.split(config.prefix+"change")[1].substring(1)
|
||||||
|
if (!newtype) return msg.channel.send({embeds:[bot.errorLog.invalidArgsMessage(l.errors.missingArgsDescription+" `<type>`:\n`"+config.prefix+"change <type>`")]})
|
||||||
|
|
||||||
|
const newTicket = require("../core/utils/configParser").getTicketById(newtype)
|
||||||
|
const list = []
|
||||||
|
config.options.forEach((o) => list.push(o.id))
|
||||||
|
if (!newTicket) return bot.errorLog.invalidIdChooseFromList(list)
|
||||||
|
|
||||||
|
/**@type {String} */
|
||||||
|
var chName = msg.channel.name
|
||||||
|
const splitted = chName.split("-")
|
||||||
|
const prefix = splitted.shift()
|
||||||
|
const name = (splitted.length > 0) ? splitted.join("-") : prefix
|
||||||
|
|
||||||
|
|
||||||
|
msg.channel.setName(newTicket.channelprefix+name)
|
||||||
|
msg.channel.send({embeds:[bot.embeds.commands.changeEmbed(msg.author,newtype)]})
|
||||||
|
|
||||||
|
log("command","someone used the 'change' command",[{key:"user",value:msg.author.tag}])
|
||||||
|
log("system","ticket type changed",[{key:"user",value:msg.author.tag},{key:"ticket",value:name},{key:"newtype",value:newtype}])
|
||||||
|
APIEvents.onCommand("change",permsChecker.command(msg.author.id,msg.guild.id),msg.author,msg.channel,msg.guild,new Date())
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!DISABLE.commands.slash.change) client.on("interactionCreate",(interaction) => {
|
||||||
|
if (!interaction.isChatInputCommand()) return
|
||||||
|
if (interaction.commandName != "change") return
|
||||||
|
|
||||||
|
if (!interaction.guild) return
|
||||||
|
if (!permsChecker.command(interaction.user.id,interaction.guild.id)){
|
||||||
|
permsChecker.sendUserNoPerms(interaction.user)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//interaction.deferReply()
|
||||||
|
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
|
||||||
|
|
||||||
|
console.log("HELLO WORLD!! 1")
|
||||||
|
var newtype = interaction.options.getString("type",true)
|
||||||
|
if (!newtype) return interaction.reply({embeds:[bot.errorLog.invalidArgsMessage(l.errors.missingArgsDescription+" `<type>`:\n`"+config.prefix+"change <type>`")]})
|
||||||
|
|
||||||
|
console.log("HELLO WORLD!! 2")
|
||||||
|
const newTicket = require("../core/utils/configParser").getTicketById(newtype,true)
|
||||||
|
const list = []
|
||||||
|
config.options.forEach((o) => list.push(o.id))
|
||||||
|
if (!newTicket) return bot.errorLog.invalidIdChooseFromList(list)
|
||||||
|
|
||||||
|
console.log("HELLO WORLD!! 3")
|
||||||
|
/**@type {String} */
|
||||||
|
var chName = interaction.channel.name
|
||||||
|
const splitted = chName.split("-")
|
||||||
|
const prefix = splitted.shift()
|
||||||
|
const name = (splitted.length > 0) ? splitted.join("-") : prefix
|
||||||
|
|
||||||
|
console.log("HELLO WORLD!! 4")
|
||||||
|
|
||||||
|
interaction.channel.setName(newTicket.channelprefix+name)
|
||||||
|
interaction.reply({embeds:[bot.embeds.commands.changeEmbed(interaction.user,newtype)]})
|
||||||
|
|
||||||
|
console.log("HELLO WORLD!! 5")
|
||||||
|
log("command","someone used the 'change' command",[{key:"user",value:interaction.user.tag}])
|
||||||
|
log("system","ticket type changed",[{key:"user",value:interaction.user.tag},{key:"ticket",value:name},{key:"newtype",value:newtype}])
|
||||||
|
APIEvents.onCommand("change",permsChecker.command(interaction.user.id,interaction.guild.id),interaction.user,interaction.channel,interaction.guild,new Date())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
+4
-2
@@ -29,7 +29,8 @@
|
|||||||
"remove":false,
|
"remove":false,
|
||||||
"rename":false,
|
"rename":false,
|
||||||
"claim":false,
|
"claim":false,
|
||||||
"unclaim":false
|
"unclaim":false,
|
||||||
|
"change":false
|
||||||
},
|
},
|
||||||
"slash":{
|
"slash":{
|
||||||
"help":false,
|
"help":false,
|
||||||
@@ -42,7 +43,8 @@
|
|||||||
"remove":false,
|
"remove":false,
|
||||||
"rename":false,
|
"rename":false,
|
||||||
"claim":false,
|
"claim":false,
|
||||||
"unclaim":false
|
"unclaim":false,
|
||||||
|
"change":false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"checkerjs":{
|
"checkerjs":{
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ const ticketReopenListeners = []
|
|||||||
const ticketAddListeners = []
|
const ticketAddListeners = []
|
||||||
const ticketRemoveListeners = []
|
const ticketRemoveListeners = []
|
||||||
|
|
||||||
|
const ticketClaimListeners = []
|
||||||
|
const ticketUnclaimListeners = []
|
||||||
|
const ticketChangeListeners = []
|
||||||
|
|
||||||
|
|
||||||
const transcriptCreationListeners = []
|
const transcriptCreationListeners = []
|
||||||
const commandListeners = []
|
const commandListeners = []
|
||||||
@@ -146,6 +150,66 @@ exports.onTicketRemove = (user,editeduser,channel,guild,date,ticketdata) => {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {discord.User} user
|
||||||
|
* @param {discord.TextChannel} channel
|
||||||
|
* @param {discord.Guild} guild
|
||||||
|
* @param {Date} date
|
||||||
|
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
|
||||||
|
*/
|
||||||
|
exports.onTicketClaim = (user,channel,guild,date,ticketdata) => {
|
||||||
|
//system
|
||||||
|
bot.errorLog.log("api","user claimed a ticket",[{key:"userid",value:user.id},{key:"channelid",value:channel.id},{key:"guildid",value:guild.id},{key:"ticketdata",value:JSON.stringify(ticketdata)}])
|
||||||
|
|
||||||
|
ticketClaimListeners.forEach((func) => {
|
||||||
|
try {
|
||||||
|
func(user,channel,guild,date,ticketdata)
|
||||||
|
}catch{}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {discord.User} user
|
||||||
|
* @param {discord.TextChannel} channel
|
||||||
|
* @param {discord.Guild} guild
|
||||||
|
* @param {Date} date
|
||||||
|
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
|
||||||
|
*/
|
||||||
|
exports.onTicketUnclaim = (user,channel,guild,date,ticketdata) => {
|
||||||
|
//system
|
||||||
|
bot.errorLog.log("api","user unclaimed a ticket",[{key:"userid",value:user.id},{key:"channelid",value:channel.id},{key:"guildid",value:guild.id},{key:"ticketdata",value:JSON.stringify(ticketdata)}])
|
||||||
|
|
||||||
|
ticketUnclaimListeners.forEach((func) => {
|
||||||
|
try {
|
||||||
|
func(user,channel,guild,date,ticketdata)
|
||||||
|
}catch{}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {String} newtype
|
||||||
|
* @param {discord.User} user
|
||||||
|
* @param {discord.TextChannel} channel
|
||||||
|
* @param {discord.Guild} guild
|
||||||
|
* @param {Date} date
|
||||||
|
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
|
||||||
|
*/
|
||||||
|
exports.onTicketChange = (newtype,user,channel,guild,date,ticketdata) => {
|
||||||
|
//system
|
||||||
|
bot.errorLog.log("api","user changed ticket type",[{key:"newtype",value:newtype},{key:"userid",value:user.id},{key:"channelid",value:channel.id},{key:"guildid",value:guild.id},{key:"ticketdata",value:JSON.stringify(ticketdata)}])
|
||||||
|
|
||||||
|
ticketChangeListeners.forEach((func) => {
|
||||||
|
try {
|
||||||
|
func(newtype,user,channel,guild,date,ticketdata)
|
||||||
|
}catch{}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {discord.Message[]} messages
|
* @param {discord.Message[]} messages
|
||||||
@@ -165,7 +229,7 @@ exports.onTranscriptCreation = (messages,channel,guild,date) => {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@typedef {"help"|"message"|"close"|"delete"|"reopen"|"rename"|"add"|"remove"} OTCommandType */
|
/**@typedef {"help"|"message"|"close"|"delete"|"reopen"|"rename"|"add"|"remove"|"claim"|"unclaim"|"change"} OTCommandType */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -269,6 +333,16 @@ exports.onCommand = (type,hasPerms,user,channel,guild,date) => {
|
|||||||
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
|
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @callback TicketTypeChangeEvent
|
||||||
|
* @param {String} newtype
|
||||||
|
* @param {discord.User} user
|
||||||
|
* @param {discord.TextChannel} channel
|
||||||
|
* @param {discord.Guild} guild
|
||||||
|
* @param {Date} date
|
||||||
|
* @param {{name:String,status:"open"|"closed"|"deleted"|"reopened",ticketOptions:configParser.OTTicketOptions}} ticketdata
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @callback CommandEvent
|
* @callback CommandEvent
|
||||||
* @param {OTCommandType} type
|
* @param {OTCommandType} type
|
||||||
@@ -328,6 +402,21 @@ const onTicketRemove = (callback) => {
|
|||||||
ticketRemoveListeners.push(callback)
|
ticketRemoveListeners.push(callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**@param {TicketActionEvent} callback */
|
||||||
|
const onTicketClaim = (callback) => {
|
||||||
|
ticketClaimListeners.push(callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**@param {TicketActionEvent} callback */
|
||||||
|
const onTicketUnclaim = (callback) => {
|
||||||
|
ticketUnclaimListeners.push(callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**@param {TicketTypeChangeEvent} callback */
|
||||||
|
const onTicketChange = (callback) => {
|
||||||
|
ticketChangeListeners.push(callback)
|
||||||
|
}
|
||||||
|
|
||||||
/**@param {TranscriptCreationEvent} callback */
|
/**@param {TranscriptCreationEvent} callback */
|
||||||
const onTranscriptCreation = (callback) => {
|
const onTranscriptCreation = (callback) => {
|
||||||
transcriptCreationListeners.push(callback)
|
transcriptCreationListeners.push(callback)
|
||||||
@@ -355,6 +444,9 @@ exports.events = {
|
|||||||
onTicketReopen,
|
onTicketReopen,
|
||||||
onTicketAdd,
|
onTicketAdd,
|
||||||
onTicketRemove,
|
onTicketRemove,
|
||||||
|
onTicketClaim,
|
||||||
|
onTicketUnclaim,
|
||||||
|
onTicketChange,
|
||||||
onTranscriptCreation,
|
onTranscriptCreation,
|
||||||
onCommand,
|
onCommand,
|
||||||
onReactionRole,
|
onReactionRole,
|
||||||
|
|||||||
@@ -137,3 +137,16 @@ exports.renameEmbed = (renamer,newname) => {
|
|||||||
.setFooter({text:author.tag,iconURL:author.displayAvatarURL()})
|
.setFooter({text:author.tag,iconURL:author.displayAvatarURL()})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {discord.User} changer
|
||||||
|
* @param {String} newtype
|
||||||
|
* @returns {discord.EmbedBuilder}
|
||||||
|
*/
|
||||||
|
exports.changeEmbed = (changer,newtype) => {
|
||||||
|
return new embed()
|
||||||
|
.setTitle("🔄 "+l.commands.changeTitle.replace("{0}",newtype))
|
||||||
|
.setColor(mc)
|
||||||
|
.setFooter({text:changer.tag,iconURL:changer.displayAvatarURL()})
|
||||||
|
}
|
||||||
@@ -32,8 +32,8 @@ 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 12")+" commands ready! (this can take up to 40 seconds)")
|
process.stdout.write("[status] there are "+chalk.blue(readystats+" out of 13")+" commands ready! (this can take up to 40 seconds)")
|
||||||
if (readystats >= 12){
|
if (readystats >= 13){
|
||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
fs.writeFileSync("./storage/slashcmdEnabled.txt","true")
|
fs.writeFileSync("./storage/slashcmdEnabled.txt","true")
|
||||||
console.log(chalk.green("\nready!"))
|
console.log(chalk.green("\nready!"))
|
||||||
@@ -245,4 +245,23 @@ module.exports = async () => {
|
|||||||
readystats++
|
readystats++
|
||||||
})
|
})
|
||||||
|
|
||||||
|
//category
|
||||||
|
client.application.commands.create({
|
||||||
|
name:"change",
|
||||||
|
description:"Change ticket type.",
|
||||||
|
defaultPermission:true,
|
||||||
|
type:act.ChatInput,
|
||||||
|
options:[
|
||||||
|
{
|
||||||
|
type:acot.String,
|
||||||
|
name:"type",
|
||||||
|
description:"The new ticket type.",
|
||||||
|
required:true,
|
||||||
|
choices:choices
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},sid).then(() => {
|
||||||
|
readystats++
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -88,12 +88,6 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
|
|||||||
|
|
||||||
if (!id) return false
|
if (!id) return false
|
||||||
|
|
||||||
try{
|
|
||||||
if (config.system.enable_DM_Messages){
|
|
||||||
member.send({embeds:[bot.errorLog.custom(l.messages.deletedTicketDmTitle,l.messages.deletedTicketDmDescription,":ticket:",config.main_color)]})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch{log("system","can't send DM to member, member doesn't allow dm's")}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}else if (mode == "close"){
|
}else if (mode == "close"){
|
||||||
@@ -229,12 +223,6 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
|
|||||||
|
|
||||||
if (!id) return false
|
if (!id) return false
|
||||||
|
|
||||||
try{
|
|
||||||
if (config.system.enable_DM_Messages){
|
|
||||||
member.send({embeds:[bot.errorLog.custom(l.messages.closedTicketDmTitle,l.messages.closedTicketDmDescription+"\n\n**reason:** "+newReason,":ticket:",config.main_color)]})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch{log("system","can't send DM to member, member doesn't allow dm's")}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ module.exports = () => {
|
|||||||
if (storage.get("ticketStorage",interaction.member.id) == null || storage.get("ticketStorage",interaction.member.id) == "false"|| Number(storage.get("ticketStorage",interaction.member.id)) < config.system.max_allowed_tickets){
|
if (storage.get("ticketStorage",interaction.member.id) == null || storage.get("ticketStorage",interaction.member.id) == "false"|| Number(storage.get("ticketStorage",interaction.member.id)) < config.system.max_allowed_tickets){
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if (config.system.enable_DM_Messages){
|
if (currentTicketOptions.enableDmOnOpen){
|
||||||
interaction.member.send({embeds:[bot.errorLog.custom(l.messages.newTicketDmTitle,currentTicketOptions.message,":ticket:",config.main_color)]})
|
interaction.member.send({embeds:[bot.errorLog.custom(l.messages.newTicketDmTitle,currentTicketOptions.message,":ticket:",config.main_color)]})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const version = require("../info.json").version
|
|||||||
*/
|
*/
|
||||||
exports.compile = (guild,channel,user,messagesInv,data) => {
|
exports.compile = (guild,channel,user,messagesInv,data) => {
|
||||||
const messages = messagesInv.reverse()
|
const messages = messagesInv.reverse()
|
||||||
|
var invisibleMessages = 0
|
||||||
|
|
||||||
const rawfiles = messages.filter((m) => Array.from(m.attachments).length > 0)
|
const rawfiles = messages.filter((m) => Array.from(m.attachments).length > 0)
|
||||||
var fileAmount = 0
|
var fileAmount = 0
|
||||||
@@ -30,8 +31,6 @@ exports.compile = (guild,channel,user,messagesInv,data) => {
|
|||||||
|
|
||||||
const messagesArray = []
|
const messagesArray = []
|
||||||
messages.forEach((msg) => {
|
messages.forEach((msg) => {
|
||||||
|
|
||||||
console.log("'"+msg.content+"'",msg.embeds.length,msg.attachments.toJSON().length)
|
|
||||||
if (msg.content || msg.embeds.length > 0 || msg.attachments.toJSON().length > 0){
|
if (msg.content || msg.embeds.length > 0 || msg.attachments.toJSON().length > 0){
|
||||||
|
|
||||||
const embedArray = []
|
const embedArray = []
|
||||||
@@ -78,7 +77,7 @@ exports.compile = (guild,channel,user,messagesInv,data) => {
|
|||||||
embeds:embedArray,
|
embeds:embedArray,
|
||||||
files:fileArray
|
files:fileArray
|
||||||
})
|
})
|
||||||
}
|
}else {invisibleMessages++}
|
||||||
})
|
})
|
||||||
|
|
||||||
const result = {
|
const result = {
|
||||||
@@ -109,7 +108,7 @@ exports.compile = (guild,channel,user,messagesInv,data) => {
|
|||||||
closedtime:data.ticket.closedtime,
|
closedtime:data.ticket.closedtime,
|
||||||
openedtime:data.ticket.openedtime,
|
openedtime:data.ticket.openedtime,
|
||||||
|
|
||||||
messages:Array.from(messages).length,
|
messages:Array.from(messages).length-invisibleMessages,
|
||||||
files:fileAmount
|
files:fileAmount
|
||||||
},
|
},
|
||||||
messages:messagesArray
|
messages:messagesArray
|
||||||
|
|||||||
@@ -10,19 +10,20 @@ const tsdb = require("../tsdb")
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} json
|
* @param {Object} json
|
||||||
* @returns {OTuploadResponse}
|
* @returns {Promise<OTuploadResponse|false>}
|
||||||
*/
|
*/
|
||||||
exports.upload = async (json) => {
|
exports.upload = async (json) => {
|
||||||
|
return new Promise(async (resolve,reject) => {
|
||||||
|
const data = encodeURIComponent(JSON.stringify(json))
|
||||||
|
|
||||||
const data = encodeURIComponent(JSON.stringify(json))
|
try {
|
||||||
|
const res = await axios.get("https://api.transcripts.dj-dj.be/upload?auth=openticketTRANSCRIPT1234&version=1.0.0&data="+data)
|
||||||
|
if (res.status != 200) resolve(false)
|
||||||
|
|
||||||
try {
|
resolve(res.data)
|
||||||
const res = await axios.get("https://api.transcripts.dj-dj.be/upload?auth=openticketTRANSCRIPT1234&version=1.0.0&data="+data)
|
}catch{
|
||||||
if (res.status != 200) return false
|
console.log("failed transcript upload!")
|
||||||
|
resolve(false)
|
||||||
return res.data
|
}
|
||||||
}catch{
|
})
|
||||||
console.log("failed transcript upload!")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -57,15 +57,18 @@ exports.tsready = (name,id,url,user) => {
|
|||||||
* @param {String} name
|
* @param {String} name
|
||||||
* @param {String} id
|
* @param {String} id
|
||||||
* @param {discord.User} user
|
* @param {discord.User} user
|
||||||
|
* @param {undefined|String} err
|
||||||
*/
|
*/
|
||||||
exports.tserror = (name,id,user) => {
|
exports.tserror = (name,id,user,err) => {
|
||||||
const embed = new discord.EmbedBuilder()
|
const embed = new discord.EmbedBuilder()
|
||||||
.setTitle("❌ Transcript")
|
.setTitle("❌ Transcript")
|
||||||
.setColor(discord.Colors.Red)
|
.setColor(discord.Colors.Red)
|
||||||
.setAuthor({name:user.tag,iconURL:user.displayAvatarURL()})
|
.setAuthor({name:user.tag,iconURL:user.displayAvatarURL()})
|
||||||
.setFooter({text:name})
|
.setFooter({text:name})
|
||||||
|
|
||||||
.setDescription("Something went wrong while creating the HTML transcript.\n\n[possible reasons](https://docs.openticket.dj-dj.be/the-system/transcripts/transcript-errors)")
|
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)
|
||||||
|
|
||||||
return embed
|
return embed
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ module.exports = async (messages,guild,channel,user,reason) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (!await checkAvailability()){
|
if (!await checkAvailability()){
|
||||||
const attachment = await require("./oldTranscript").createTranscript(messages,ch)
|
const attachment = await require("./oldTranscript").createTranscript(messages,channel)
|
||||||
const errembed = tsembeds.tserror(chName,chId,user)
|
const errembed = tsembeds.tserror(chName,chId,user)
|
||||||
|
|
||||||
if (tsconfig.sendTranscripts.enableChannel){
|
if (tsconfig.sendTranscripts.enableChannel){
|
||||||
@@ -85,6 +85,7 @@ 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) return false
|
||||||
|
|
||||||
if (TSdata.status == "success"){
|
if (TSdata.status == "success"){
|
||||||
const url = "https://transcripts.dj-dj.be/t/"+TSdata.time+"_"+TSdata.id+".html"
|
const url = "https://transcripts.dj-dj.be/t/"+TSdata.time+"_"+TSdata.id+".html"
|
||||||
|
|
||||||
@@ -121,6 +122,17 @@ module.exports = async (messages,guild,channel,user,reason) => {
|
|||||||
}catch{}
|
}catch{}
|
||||||
}
|
}
|
||||||
},duration)
|
},duration)
|
||||||
|
}else{
|
||||||
|
const attachment = await require("./oldTranscript").createTranscript(messages,channel)
|
||||||
|
const errembed = tsembeds.tserror(chName,chId,user,"`error type: transcript API error`")
|
||||||
|
|
||||||
|
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]})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
asyncmanager(msglist)
|
asyncmanager(msglist)
|
||||||
|
|||||||
@@ -216,6 +216,7 @@ if (process.argv[2] && process.argv[2].startsWith("slash")){
|
|||||||
require("./commands/reopen")()
|
require("./commands/reopen")()
|
||||||
require("./commands/claim")()
|
require("./commands/claim")()
|
||||||
require("./commands/unclaim")()
|
require("./commands/unclaim")()
|
||||||
|
require("./commands/change")()
|
||||||
|
|
||||||
this.errorLog.log("debug","LOADING CORE")
|
this.errorLog.log("debug","LOADING CORE")
|
||||||
//core
|
//core
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
"reopenTitle":"Re-Opened this ticket!",
|
"reopenTitle":"Re-Opened this ticket!",
|
||||||
"claimTitle":"This ticket is now claimed to {0}",
|
"claimTitle":"This ticket is now claimed to {0}",
|
||||||
"unclaimTitle":"This ticket isn't claimed anymore!",
|
"unclaimTitle":"This ticket isn't claimed anymore!",
|
||||||
|
"changeTitle":"Changed ticket type to {0}!",
|
||||||
|
|
||||||
"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!_"
|
||||||
|
|||||||
@@ -114,26 +114,37 @@
|
|||||||
"it":"Rinomina il canale di un ticket."
|
"it":"Rinomina il canale di un ticket."
|
||||||
},
|
},
|
||||||
"claim":{
|
"claim":{
|
||||||
"en-GB":"",
|
"en-GB":"Claim a ticket.",
|
||||||
"en-US":"",
|
"en-US":"Claim a ticket.",
|
||||||
"nl":"",
|
"nl":"Claim een ticket.",
|
||||||
"ro":"",
|
"ro":" ",
|
||||||
"de":"",
|
"de":" ",
|
||||||
"cs":"",
|
"cs":" ",
|
||||||
"fr":"",
|
"fr":" ",
|
||||||
"es-ES":"",
|
"es-ES":" ",
|
||||||
"it":""
|
"it":" "
|
||||||
},
|
},
|
||||||
"unclaim":{
|
"unclaim":{
|
||||||
"en-GB":"",
|
"en-GB":"Un-claim a ticket.",
|
||||||
"en-US":"",
|
"en-US":"Un-claim a ticket.",
|
||||||
"nl":"",
|
"nl":"Ontclaim een ticket.",
|
||||||
"ro":"",
|
"ro":" ",
|
||||||
"de":"",
|
"de":" ",
|
||||||
"cs":"",
|
"cs":" ",
|
||||||
"fr":"",
|
"fr":" ",
|
||||||
"es-ES":"",
|
"es-ES":" ",
|
||||||
"it":""
|
"it":" "
|
||||||
|
},
|
||||||
|
"category":{
|
||||||
|
"en-GB":"Change ticket type.",
|
||||||
|
"en-US":"Change ticket type.",
|
||||||
|
"nl":"Verander ticket type.",
|
||||||
|
"ro":" ",
|
||||||
|
"de":" ",
|
||||||
|
"cs":" ",
|
||||||
|
"fr":" ",
|
||||||
|
"es-ES":" ",
|
||||||
|
"it":" "
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
{
|
{
|
||||||
"sendTranscripts":{
|
"sendTranscripts":{
|
||||||
"enableChannel":true,
|
"enableChannel":false,
|
||||||
"channel":"968899606912061490",
|
"channel":"transcript channel id",
|
||||||
|
|
||||||
"enableDM":true
|
"enableDM":false
|
||||||
},
|
},
|
||||||
"style":{
|
"style":{
|
||||||
"titleColor":"#49c100",
|
"titleColor":"#F8BA00",
|
||||||
"background":{
|
"background":{
|
||||||
"enableCustomBackground":true,
|
"enableCustomBackground":false,
|
||||||
"backgroundModus":"image",
|
"backgroundModus":"color OR image",
|
||||||
"backgroundData":"https://pbs.twimg.com/media/EBjFBlVXsAAhvXl?format=jpg&name=4096x4096"
|
"backgroundData":"#abc123 OR https://www.example.com/image.png"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user