v3.1 last push
This commit is contained in:
@@ -105,6 +105,7 @@
|
|||||||
"other":{
|
"other":{
|
||||||
"enableTicketExplaination":true,
|
"enableTicketExplaination":true,
|
||||||
"enableMaxTicketsWarning":true,
|
"enableMaxTicketsWarning":true,
|
||||||
|
|
||||||
"customDropdownPlaceholder":{
|
"customDropdownPlaceholder":{
|
||||||
"enable":false,
|
"enable":false,
|
||||||
"text":"Choose a ticket"
|
"text":"Choose a ticket"
|
||||||
|
|||||||
+36
-4
@@ -311,10 +311,6 @@ exports.checker = async () => {
|
|||||||
checkHexColor(input.color,path+"/color")
|
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!!!
|
//OPTIONS!!!
|
||||||
var counter = 0
|
var counter = 0
|
||||||
input.options.forEach((option) => {if (!configParser.optionExists(option)){counter++}})
|
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}]}*/
|
/**@returns {[{category:String, key:String, value:String}]}*/
|
||||||
function getData(){
|
function getData(){
|
||||||
|
if (fs.existsSync(location)){
|
||||||
return JSON.parse(fs.readFileSync(location).toString())
|
return JSON.parse(fs.readFileSync(location).toString())
|
||||||
|
}else{
|
||||||
|
fs.writeFileSync(location,"[]")
|
||||||
|
return []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**@param {[{category:String, key:String, value:String}]} data*/
|
/**@param {[{category:String, key:String, value:String}]} data*/
|
||||||
function setData(data){
|
function setData(data){
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
|
|||||||
const guild = channel.guild
|
const guild = channel.guild
|
||||||
const user = member.user
|
const user = member.user
|
||||||
const chalk = await (await import("chalk")).default
|
const chalk = await (await import("chalk")).default
|
||||||
const channelmessages = await channel.messages.fetch()
|
|
||||||
|
|
||||||
const newReason = reason ? reason : l.messages.none
|
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:
|
//FIX CHANNEL COULD BE CLOSED AFTER DELETE:
|
||||||
if (pendingDelete.includes(channel.id)) return false
|
if (pendingDelete.includes(channel.id)) return false
|
||||||
|
|
||||||
//remove ot bot from transcript
|
|
||||||
channelmessages.sweep((msgSweep) => {return msgSweep.author.id == client.user.id})
|
|
||||||
|
|
||||||
/**@type {String}*/
|
/**@type {String}*/
|
||||||
const channelname = channel.name
|
const channelname = channel.name
|
||||||
const ticketOpenerChannelName = channelname.split(prefix)[1]
|
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"){
|
if (enableTranscript == true && mode != "deletenotranscript"){
|
||||||
|
//transcript messages
|
||||||
const transcriptReason = (mode == "close") ? "**"+l.messages.reason+":** "+newReason : "**"+l.messages.reason+":** "+l.messages.none
|
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
|
const closedByPrefix = (mode.startsWith("delete")) ? l.messages.deletedby : l.messages.closedby
|
||||||
|
|
||||||
if (config.system.enable_transcript || config.system.enable_DM_transcript){
|
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)
|
var fileattachment = await require("../transcript").createTranscript(channelmessages,channel)
|
||||||
|
|
||||||
if (fileattachment == false){log("system","internal error: transcript is not created!");return}
|
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){
|
if (deleteRequired){
|
||||||
//const timer = () => {return new Promise((resolve,reject) => {
|
//const timer = () => {return new Promise((resolve,reject) => {
|
||||||
// setTimeout(() => {resolve(true)},7000)
|
// setTimeout(() => {resolve(true)},7000)
|
||||||
//})}
|
//})}
|
||||||
//await timer()
|
//await timer()
|
||||||
|
|
||||||
setTimeout(async () => {
|
|
||||||
pendingDelete.shift()
|
pendingDelete.shift()
|
||||||
await channel.delete()
|
await channel.delete()
|
||||||
},6000)
|
|
||||||
|
//setTimeout(async () => {
|
||||||
|
// pendingDelete.shift()
|
||||||
|
// await channel.delete()
|
||||||
|
//},6000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await transcriptHandler()
|
||||||
|
deleteHandler()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user