v3.1 last push
This commit is contained in:
@@ -105,6 +105,7 @@
|
||||
"other":{
|
||||
"enableTicketExplaination":true,
|
||||
"enableMaxTicketsWarning":true,
|
||||
|
||||
"customDropdownPlaceholder":{
|
||||
"enable":false,
|
||||
"text":"Choose a ticket"
|
||||
|
||||
+36
-4
@@ -311,10 +311,6 @@ exports.checker = async () => {
|
||||
checkHexColor(input.color,path+"/color")
|
||||
}
|
||||
|
||||
//ticket explaination & max tickets warning
|
||||
checkType(input.other.enableTicketExplaination,"boolean",path+"/other/enableTicketExplaination")
|
||||
checkType(input.other.enableMaxTicketsWarning,"boolean",path+"/other/enableMaxTicketsWarning")
|
||||
|
||||
//OPTIONS!!!
|
||||
var counter = 0
|
||||
input.options.forEach((option) => {if (!configParser.optionExists(option)){counter++}})
|
||||
@@ -328,6 +324,42 @@ exports.checker = async () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//other
|
||||
//ticket explaination & max tickets warning
|
||||
if (typeof input.other != "object"){
|
||||
createError("'"+path+"/other' | this object doesn't exist!")
|
||||
}else{
|
||||
checkType(input.other.enableTicketExplaination,"boolean",path+"/other/enableTicketExplaination")
|
||||
checkType(input.other.enableMaxTicketsWarning,"boolean",path+"/other/enableMaxTicketsWarning")
|
||||
|
||||
//customDropdownPlaceholder
|
||||
if (typeof input.other.customDropdownPlaceholder != "object"){
|
||||
createError("'"+path+"/other/customDropdownPlaceholder' | this object doesn't exist!")
|
||||
}else{
|
||||
checkType(input.other.customDropdownPlaceholder.enable,"boolean",path+"/other/customDropdownPlaceholder/enable")
|
||||
checkType(input.other.customDropdownPlaceholder.text,"string",path+"/other/customDropdownPlaceholder/text")
|
||||
if (input.other.customDropdownPlaceholder.enable && input.other.customDropdownPlaceholder.text.length < 1){createError("'"+path+"/other/customDropdownPlaceholder/text' | there is no placeholder text!")}
|
||||
}
|
||||
|
||||
//customCategoryText
|
||||
if (typeof input.other.customCategoryText != "object"){
|
||||
createError("'"+path+"/other/customCategoryText' | this object doesn't exist!")
|
||||
}else{
|
||||
checkType(input.other.customCategoryText.enable,"boolean",path+"/other/customCategoryText/enable")
|
||||
checkType(input.other.customCategoryText.text,"string",path+"/other/customCategoryText/text")
|
||||
if (input.other.customCategoryText.enable && input.other.customCategoryText.text.length < 1){createError("'"+path+"/other/customCategoryText/text' | there is no category text!")}
|
||||
}
|
||||
|
||||
//embedTitleURL
|
||||
if (typeof input.other.embedTitleURL != "object"){
|
||||
createError("'"+path+"/other/embedTitleURL' | this object doesn't exist!")
|
||||
}else{
|
||||
checkType(input.other.embedTitleURL.enable,"boolean",path+"/other/embedTitleURL/enable")
|
||||
checkType(input.other.embedTitleURL.url,"string",path+"/other/embedTitleURL/text")
|
||||
if (input.other.embedTitleURL.enable && input.other.embedTitleURL.url.length < 1){createError("'"+path+"/other/embedTitleURL/url' | there is no url!")}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------|
|
||||
|
||||
@@ -4,7 +4,12 @@ const location = "./storage/database.json"
|
||||
|
||||
/**@returns {[{category:String, key:String, value:String}]}*/
|
||||
function getData(){
|
||||
if (fs.existsSync(location)){
|
||||
return JSON.parse(fs.readFileSync(location).toString())
|
||||
}else{
|
||||
fs.writeFileSync(location,"[]")
|
||||
return []
|
||||
}
|
||||
}
|
||||
/**@param {[{category:String, key:String, value:String}]} data*/
|
||||
function setData(data){
|
||||
|
||||
@@ -22,7 +22,6 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
|
||||
const guild = channel.guild
|
||||
const user = member.user
|
||||
const chalk = await (await import("chalk")).default
|
||||
const channelmessages = await channel.messages.fetch()
|
||||
|
||||
const newReason = reason ? reason : l.messages.none
|
||||
|
||||
@@ -31,9 +30,6 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
|
||||
//FIX CHANNEL COULD BE CLOSED AFTER DELETE:
|
||||
if (pendingDelete.includes(channel.id)) return false
|
||||
|
||||
//remove ot bot from transcript
|
||||
channelmessages.sweep((msgSweep) => {return msgSweep.author.id == client.user.id})
|
||||
|
||||
/**@type {String}*/
|
||||
const channelname = channel.name
|
||||
const ticketOpenerChannelName = channelname.split(prefix)[1]
|
||||
@@ -293,12 +289,17 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
|
||||
}
|
||||
|
||||
|
||||
const transcriptHandler = async () => {
|
||||
if (enableTranscript == true && mode != "deletenotranscript"){
|
||||
|
||||
//transcript messages
|
||||
const transcriptReason = (mode == "close") ? "**"+l.messages.reason+":** "+newReason : "**"+l.messages.reason+":** "+l.messages.none
|
||||
const closedByPrefix = (mode.startsWith("delete")) ? l.messages.deletedby : l.messages.closedby
|
||||
|
||||
if (config.system.enable_transcript || config.system.enable_DM_transcript){
|
||||
const channelmessages = await channel.messages.fetch({cache:true})
|
||||
//remove ot bot from transcript
|
||||
channelmessages.sweep((msgSweep) => {return msgSweep.author.id == client.user.id})
|
||||
|
||||
var fileattachment = await require("../transcript").createTranscript(channelmessages,channel)
|
||||
|
||||
if (fileattachment == false){log("system","internal error: transcript is not created!");return}
|
||||
@@ -330,16 +331,23 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
const deleteHandler = async () => {
|
||||
if (deleteRequired){
|
||||
//const timer = () => {return new Promise((resolve,reject) => {
|
||||
// setTimeout(() => {resolve(true)},7000)
|
||||
//})}
|
||||
//await timer()
|
||||
|
||||
setTimeout(async () => {
|
||||
pendingDelete.shift()
|
||||
await channel.delete()
|
||||
},6000)
|
||||
|
||||
//setTimeout(async () => {
|
||||
// pendingDelete.shift()
|
||||
// await channel.delete()
|
||||
//},6000)
|
||||
}
|
||||
}
|
||||
await transcriptHandler()
|
||||
deleteHandler()
|
||||
}
|
||||
Reference in New Issue
Block a user