BREAKING: changed openticket to opendiscord in API
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import {openticket, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
|
||||
export const loadAllBlacklistedUsers = async () => {
|
||||
const userDatabase = openticket.databases.get("openticket:users")
|
||||
const userDatabase = opendiscord.databases.get("openticket:users")
|
||||
if (!userDatabase) return
|
||||
|
||||
const users = await userDatabase.getCategory("openticket:blacklist") ?? []
|
||||
users.forEach((user) => {
|
||||
if (typeof user.value == "string" || user.value === null) openticket.blacklist.add(new api.ODBlacklist(user.key,user.value))
|
||||
if (typeof user.value == "string" || user.value === null) opendiscord.blacklist.add(new api.ODBlacklist(user.key,user.value))
|
||||
})
|
||||
}
|
||||
@@ -1,47 +1,47 @@
|
||||
import {openticket, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
|
||||
export const loadAllOptions = async () => {
|
||||
const optionConfig = openticket.configs.get("openticket:options")
|
||||
const optionConfig = opendiscord.configs.get("openticket:options")
|
||||
if (!optionConfig) return
|
||||
|
||||
optionConfig.data.forEach((option) => {
|
||||
if (option.type == "ticket"){
|
||||
const loadedOption = loadTicketOption(option)
|
||||
openticket.options.add(loadedOption)
|
||||
openticket.options.suffix.add(loadTicketOptionSuffix(loadedOption))
|
||||
opendiscord.options.add(loadedOption)
|
||||
opendiscord.options.suffix.add(loadTicketOptionSuffix(loadedOption))
|
||||
}else if (option.type == "website"){
|
||||
openticket.options.add(loadWebsiteOption(option))
|
||||
opendiscord.options.add(loadWebsiteOption(option))
|
||||
}else if (option.type == "role"){
|
||||
openticket.options.add(loadRoleOption(option))
|
||||
opendiscord.options.add(loadRoleOption(option))
|
||||
}
|
||||
})
|
||||
|
||||
//update options on config reload
|
||||
optionConfig.onReload(async () => {
|
||||
//clear previous options & suffixes
|
||||
await openticket.options.loopAll((data,id) => {openticket.options.remove(id)})
|
||||
await openticket.options.suffix.loopAll((data,id) => {openticket.options.suffix.remove(id)})
|
||||
await opendiscord.options.loopAll((data,id) => {opendiscord.options.remove(id)})
|
||||
await opendiscord.options.suffix.loopAll((data,id) => {opendiscord.options.suffix.remove(id)})
|
||||
|
||||
//add new options
|
||||
optionConfig.data.forEach((option) => {
|
||||
if (option.type == "ticket"){
|
||||
const loadedOption = loadTicketOption(option)
|
||||
openticket.options.add(loadedOption)
|
||||
openticket.options.suffix.add(loadTicketOptionSuffix(loadedOption))
|
||||
opendiscord.options.add(loadedOption)
|
||||
opendiscord.options.suffix.add(loadTicketOptionSuffix(loadedOption))
|
||||
}else if (option.type == "website"){
|
||||
openticket.options.add(loadWebsiteOption(option))
|
||||
opendiscord.options.add(loadWebsiteOption(option))
|
||||
}else if (option.type == "role"){
|
||||
openticket.options.add(loadRoleOption(option))
|
||||
opendiscord.options.add(loadRoleOption(option))
|
||||
}
|
||||
})
|
||||
|
||||
//update options in tickets
|
||||
await openticket.tickets.loopAll((ticket) => {
|
||||
await opendiscord.tickets.loopAll((ticket) => {
|
||||
const optionId = ticket.option.id
|
||||
const option = openticket.options.get(optionId)
|
||||
const option = opendiscord.options.get(optionId)
|
||||
if (option && option instanceof api.ODTicketOption) ticket.option = option
|
||||
else{
|
||||
openticket.log("Unable to move ticket to unexisting option due to config reload!","warning",[
|
||||
opendiscord.log("Unable to move ticket to unexisting option due to config reload!","warning",[
|
||||
{key:"channelid",value:ticket.id.value},
|
||||
{key:"option",value:optionId.value}
|
||||
])
|
||||
@@ -49,7 +49,7 @@ export const loadAllOptions = async () => {
|
||||
})
|
||||
|
||||
//update roles on config reload
|
||||
await openticket.roles.loopAll((data,id) => {openticket.roles.remove(id)})
|
||||
await opendiscord.roles.loopAll((data,id) => {opendiscord.roles.remove(id)})
|
||||
await (await import("./roleLoader.js")).loadAllRoles()
|
||||
})
|
||||
}
|
||||
@@ -134,7 +134,7 @@ export const loadRoleOption = (opt:api.ODJsonConfig_DefaultOptionRoleType): api.
|
||||
|
||||
export const loadTicketOptionSuffix = (option:api.ODTicketOption): api.ODOptionSuffix => {
|
||||
const mode = option.get("openticket:channel-suffix").value
|
||||
const globalDatabase = openticket.databases.get("openticket:global")
|
||||
const globalDatabase = opendiscord.databases.get("openticket:global")
|
||||
if (mode == "user-name") return new api.ODOptionUserNameSuffix(option.id.value,option)
|
||||
else if (mode == "random-number") return new api.ODOptionRandomNumberSuffix(option.id.value,option,globalDatabase)
|
||||
else if (mode == "random-hex") return new api.ODOptionRandomHexSuffix(option.id.value,option,globalDatabase)
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import {openticket, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
export const loadAllPanels = async () => {
|
||||
const panelConfig = openticket.configs.get("openticket:panels")
|
||||
const panelConfig = opendiscord.configs.get("openticket:panels")
|
||||
if (!panelConfig) return
|
||||
|
||||
panelConfig.data.forEach((panel) => {
|
||||
openticket.panels.add(loadPanel(panel))
|
||||
opendiscord.panels.add(loadPanel(panel))
|
||||
})
|
||||
|
||||
//update panels on config reload
|
||||
panelConfig.onReload(async () => {
|
||||
//clear previous panels
|
||||
await openticket.panels.loopAll((data,id) => {openticket.panels.remove(id)})
|
||||
await opendiscord.panels.loopAll((data,id) => {opendiscord.panels.remove(id)})
|
||||
|
||||
//add new panels
|
||||
panelConfig.data.forEach((panel) => {
|
||||
openticket.panels.add(loadPanel(panel))
|
||||
opendiscord.panels.add(loadPanel(panel))
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -53,7 +53,7 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
|
||||
let websiteOnly = true
|
||||
let roleOnly = true
|
||||
panel.get("openticket:options").value.forEach((id) => {
|
||||
const opt = openticket.options.get(id)
|
||||
const opt = opendiscord.options.get(id)
|
||||
if (opt){
|
||||
if (opt instanceof api.ODTicketOption){
|
||||
options.push(opt)
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import {openticket, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
|
||||
export const loadAllQuestions = async () => {
|
||||
const questionConfig = openticket.configs.get("openticket:questions")
|
||||
const questionConfig = opendiscord.configs.get("openticket:questions")
|
||||
if (!questionConfig) return
|
||||
|
||||
questionConfig.data.forEach((question) => {
|
||||
if (question.type == "short"){
|
||||
openticket.questions.add(loadShortQuestion(question))
|
||||
opendiscord.questions.add(loadShortQuestion(question))
|
||||
}else if (question.type == "paragraph"){
|
||||
openticket.questions.add(loadParagraphQuestion(question))
|
||||
opendiscord.questions.add(loadParagraphQuestion(question))
|
||||
}
|
||||
})
|
||||
|
||||
//update questions on config reload
|
||||
questionConfig.onReload(async () => {
|
||||
//clear previous questions
|
||||
await openticket.questions.loopAll((data,id) => {openticket.questions.remove(id)})
|
||||
await opendiscord.questions.loopAll((data,id) => {opendiscord.questions.remove(id)})
|
||||
|
||||
//add new questions
|
||||
questionConfig.data.forEach((question) => {
|
||||
if (question.type == "short"){
|
||||
openticket.questions.add(loadShortQuestion(question))
|
||||
opendiscord.questions.add(loadShortQuestion(question))
|
||||
}else if (question.type == "paragraph"){
|
||||
openticket.questions.add(loadParagraphQuestion(question))
|
||||
opendiscord.questions.add(loadParagraphQuestion(question))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {openticket, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
|
||||
export const loadAllRoles = async () => {
|
||||
await openticket.options.loopAll((opt) => {
|
||||
await opendiscord.options.loopAll((opt) => {
|
||||
if (opt instanceof api.ODRoleOption){
|
||||
openticket.roles.add(loadRole(opt))
|
||||
opendiscord.roles.add(loadRole(opt))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import {openticket, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
|
||||
const optionDatabase = openticket.databases.get("openticket:options")
|
||||
const optionDatabase = opendiscord.databases.get("openticket:options")
|
||||
|
||||
export const loadAllTickets = async () => {
|
||||
const ticketDatabase = openticket.databases.get("openticket:tickets")
|
||||
const ticketDatabase = opendiscord.databases.get("openticket:tickets")
|
||||
if (!ticketDatabase) return
|
||||
|
||||
const tickets = await ticketDatabase.getCategory("openticket:ticket")
|
||||
if (!tickets) return
|
||||
for (const ticket of tickets){
|
||||
try {
|
||||
openticket.tickets.add(await loadTicket(ticket.value))
|
||||
opendiscord.tickets.add(await loadTicket(ticket.value))
|
||||
}catch (err){
|
||||
process.emit("uncaughtException",err)
|
||||
process.emit("uncaughtException",new api.ODSystemError("Failed to load ticket from database! => id: "+ticket.key+"\n ===> "+err))
|
||||
@@ -20,14 +20,14 @@ export const loadAllTickets = async () => {
|
||||
|
||||
export const loadTicket = async (ticket:api.ODTicketJson) => {
|
||||
const backupOption = (await optionDatabase.exists("openticket:used-option",ticket.option)) ? api.ODTicketOption.fromJson(await optionDatabase.get("openticket:used-option",ticket.option) as api.ODOptionJson) : null
|
||||
const configOption = openticket.options.get(ticket.option)
|
||||
const configOption = opendiscord.options.get(ticket.option)
|
||||
|
||||
//check if option is of type "ticket"
|
||||
if (configOption && !(configOption instanceof api.ODTicketOption)) throw new api.ODSystemError("Unable to load ticket because option is not of 'ticket' type!")
|
||||
|
||||
//manage backup option
|
||||
if (configOption) await optionDatabase.set("openticket:used-option",configOption.id.value,configOption.toJson(openticket.versions.get("openticket:version")))
|
||||
else if (backupOption) openticket.options.add(backupOption)
|
||||
if (configOption) await optionDatabase.set("openticket:used-option",configOption.id.value,configOption.toJson(opendiscord.versions.get("openticket:version")))
|
||||
else if (backupOption) opendiscord.options.add(backupOption)
|
||||
else throw new api.ODSystemError("Unable to use backup option! Normal option not found in config!")
|
||||
|
||||
//load ticket & option
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import {openticket, api, utilities} from "../../index"
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const collector = openticket.transcripts.collector
|
||||
const messages = openticket.builders.messages
|
||||
const transcriptConfig = openticket.configs.get("openticket:transcripts")
|
||||
const collector = opendiscord.transcripts.collector
|
||||
const messages = opendiscord.builders.messages
|
||||
const transcriptConfig = opendiscord.configs.get("openticket:transcripts")
|
||||
const textConfig = transcriptConfig.data.textTranscriptStyle
|
||||
const htmlVersion = Buffer.from("b3BlbnRpY2tldFRSQU5TQ1JJUFQxMjM0","base64").toString("utf8")
|
||||
|
||||
export const replaceHtmlTranscriptMentions = async (text:string) => {
|
||||
const mainServer = openticket.client.mainServer
|
||||
const mainServer = opendiscord.client.mainServer
|
||||
if (!mainServer) throw new api.ODSystemError("Unknown mainServer! => Required for mention replacement in Html Transcripts!")
|
||||
|
||||
const usertext = await utilities.asyncReplace(text,/<@([0-9]+)>/g,async (match,id) => {
|
||||
const member = await openticket.client.fetchGuildMember(mainServer,id)
|
||||
const member = await opendiscord.client.fetchGuildMember(mainServer,id)
|
||||
return (member ? "<@"+(member.user.displayName).replace(/\s/g," ")+"> " : id) //replace with html spaces => BUG: whitespace CSS isn't "pre-wrap"
|
||||
})
|
||||
|
||||
const channeltext = await utilities.asyncReplace(usertext,/<#([0-9]+)>/g,async (match,id) => {
|
||||
const channel = await openticket.client.fetchGuildChannel(mainServer,id)
|
||||
const channel = await opendiscord.client.fetchGuildChannel(mainServer,id)
|
||||
return (channel ? "<#"+channel.name.replace(/\s/g," ")+"> " : id) //replace with html spaces => BUG: whitespace CSS isn't "pre-wrap"
|
||||
})
|
||||
|
||||
const roletext = await utilities.asyncReplace(channeltext,/<@&([0-9]+)>/g,async (match,id) => {
|
||||
const role = await openticket.client.fetchGuildRole(mainServer,id)
|
||||
const role = await opendiscord.client.fetchGuildRole(mainServer,id)
|
||||
let text = role ? role.name.replace(/\s/g," ") : id
|
||||
let color = role ? ((role.hexColor == "#000000") ? "regular" : role.hexColor) : "regular" //when hex color is #000000 => render as default
|
||||
return "<@&"+text+"::"+color+"> "
|
||||
@@ -44,7 +44,7 @@ export const loadAllTranscriptCompilers = async () => {
|
||||
}
|
||||
|
||||
//TEXT COMPILER
|
||||
openticket.transcripts.add(new api.ODTranscriptCompiler<{contents:string}>("openticket:text-compiler",undefined,async (ticket,channel,user) => {
|
||||
opendiscord.transcripts.add(new api.ODTranscriptCompiler<{contents:string}>("openticket:text-compiler",undefined,async (ticket,channel,user) => {
|
||||
//COMPILE
|
||||
const rawMessages = await collector.collectAllMessages(ticket)
|
||||
if (!rawMessages) return {ticket,channel,user,success:false,errorReason:"Unable to collect messages! Channel not found!",messages:null,data:null}
|
||||
@@ -108,10 +108,10 @@ export const loadAllTranscriptCompilers = async () => {
|
||||
const closeDate = ticket.get("openticket:closed-on").value
|
||||
const claimDate = ticket.get("openticket:claimed-on").value
|
||||
const pinDate = ticket.get("openticket:pinned-on").value
|
||||
const creator = await openticket.tickets.getTicketUser(ticket,"creator")
|
||||
const closer = await openticket.tickets.getTicketUser(ticket,"closer")
|
||||
const claimer = await openticket.tickets.getTicketUser(ticket,"claimer")
|
||||
const pinner = await openticket.tickets.getTicketUser(ticket,"pinner")
|
||||
const creator = await opendiscord.tickets.getTicketUser(ticket,"creator")
|
||||
const closer = await opendiscord.tickets.getTicketUser(ticket,"closer")
|
||||
const claimer = await opendiscord.tickets.getTicketUser(ticket,"claimer")
|
||||
const pinner = await opendiscord.tickets.getTicketUser(ticket,"pinner")
|
||||
|
||||
if (textConfig.includeStats){
|
||||
//TODO TRANSLATION!!!
|
||||
@@ -164,21 +164,21 @@ export const loadAllTranscriptCompilers = async () => {
|
||||
},async (result) => {
|
||||
//READY
|
||||
return {
|
||||
channelMessage:await messages.getSafe("openticket:transcript-text-ready").build("channel",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:openticket.transcripts.get("openticket:text-compiler")}),
|
||||
creatorDmMessage:await messages.getSafe("openticket:transcript-text-ready").build("creator-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:openticket.transcripts.get("openticket:text-compiler")}),
|
||||
participantDmMessage:await messages.getSafe("openticket:transcript-text-ready").build("participant-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:openticket.transcripts.get("openticket:text-compiler")}),
|
||||
activeAdminDmMessage:await messages.getSafe("openticket:transcript-text-ready").build("active-admin-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:openticket.transcripts.get("openticket:text-compiler")}),
|
||||
everyAdminDmMessage:await messages.getSafe("openticket:transcript-text-ready").build("every-admin-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:openticket.transcripts.get("openticket:text-compiler")})
|
||||
channelMessage:await messages.getSafe("openticket:transcript-text-ready").build("channel",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("openticket:text-compiler")}),
|
||||
creatorDmMessage:await messages.getSafe("openticket:transcript-text-ready").build("creator-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("openticket:text-compiler")}),
|
||||
participantDmMessage:await messages.getSafe("openticket:transcript-text-ready").build("participant-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("openticket:text-compiler")}),
|
||||
activeAdminDmMessage:await messages.getSafe("openticket:transcript-text-ready").build("active-admin-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("openticket:text-compiler")}),
|
||||
everyAdminDmMessage:await messages.getSafe("openticket:transcript-text-ready").build("every-admin-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("openticket:text-compiler")})
|
||||
}
|
||||
}))
|
||||
|
||||
//HTML COMPILER
|
||||
openticket.transcripts.add(new api.ODTranscriptCompiler<{url:string}>("openticket:html-compiler",async (ticket,channel,user) => {
|
||||
opendiscord.transcripts.add(new api.ODTranscriptCompiler<{url:string}>("openticket:html-compiler",async (ticket,channel,user) => {
|
||||
//INIT
|
||||
const req = new api.ODHTTPGetRequest("https://apis.dj-dj.be/transcripts/status.json",false)
|
||||
const res = await req.run()
|
||||
if (!res || res.status != 200 || !res.body){
|
||||
openticket.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
|
||||
opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
|
||||
process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts INIT_COMMUNICATON error! (check otdebug.txt for details)"))
|
||||
return {success:false,errorReason:"HTML Transcripts are currently unavailable!",pendingMessage:null}
|
||||
}
|
||||
@@ -186,12 +186,12 @@ export const loadAllTranscriptCompilers = async () => {
|
||||
const data = JSON.parse(res.body)
|
||||
if (!data || data["v2"] != "online") return {success:false,errorReason:"HTML Transcripts are currently unavailable due to maintenance!",pendingMessage:null}
|
||||
}catch{
|
||||
openticket.debugfile.writeNote("HTML Transcripts Error => unable to parse status! body:\n"+res.body)
|
||||
opendiscord.debugfile.writeNote("HTML Transcripts Error => unable to parse status! body:\n"+res.body)
|
||||
process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts INIT_STATUS_PARSE error! (check otdebug.txt for details)"))
|
||||
return {success:false,errorReason:"HTML Transcripts are currently unavailable due to JSON parse error!",pendingMessage:null}
|
||||
}
|
||||
|
||||
return {success:true,errorReason:null,pendingMessage:await messages.getSafe("openticket:transcript-html-progress").build("channel",{guild:channel.guild,channel,user,ticket,compiler:openticket.transcripts.get("openticket:html-compiler"),remaining:16000})}
|
||||
return {success:true,errorReason:null,pendingMessage:await messages.getSafe("openticket:transcript-html-progress").build("channel",{guild:channel.guild,channel,user,ticket,compiler:opendiscord.transcripts.get("openticket:html-compiler"),remaining:16000})}
|
||||
},async (ticket,channel,user) => {
|
||||
//COMPILE
|
||||
const rawMessages = await collector.collectAllMessages(ticket)
|
||||
@@ -349,19 +349,19 @@ export const loadAllTranscriptCompilers = async () => {
|
||||
const dss = transcriptConfig.data.htmlTranscriptStyle.stats
|
||||
const dsf = transcriptConfig.data.htmlTranscriptStyle.favicon
|
||||
|
||||
const creator = await openticket.tickets.getTicketUser(ticket,"creator")
|
||||
const claimer = await openticket.tickets.getTicketUser(ticket,"claimer")
|
||||
const closer = await openticket.tickets.getTicketUser(ticket,"closer")
|
||||
const creator = await opendiscord.tickets.getTicketUser(ticket,"creator")
|
||||
const claimer = await opendiscord.tickets.getTicketUser(ticket,"claimer")
|
||||
const closer = await opendiscord.tickets.getTicketUser(ticket,"closer")
|
||||
|
||||
const htmlFinal: api.ODTranscriptHtmlV2Data = {
|
||||
version:"2",
|
||||
otversion:openticket.versions.get("openticket:version").toString(true),
|
||||
otversion:opendiscord.versions.get("openticket:version").toString(true),
|
||||
bot:{
|
||||
name:openticket.client.client.user.displayName,
|
||||
id:openticket.client.client.user.id,
|
||||
pfp:openticket.client.client.user.displayAvatarURL({extension:"png"}),
|
||||
name:opendiscord.client.client.user.displayName,
|
||||
id:opendiscord.client.client.user.id,
|
||||
pfp:opendiscord.client.client.user.displayAvatarURL({extension:"png"}),
|
||||
},
|
||||
language:openticket.languages.getLanguageMetadata()?.language ?? "english",
|
||||
language:opendiscord.languages.getLanguageMetadata()?.language ?? "english",
|
||||
style:{
|
||||
background:{
|
||||
backgroundData:(dsb.backgroundImage == "") ? dsb.backgroundColor : dsb.backgroundImage,
|
||||
@@ -426,12 +426,12 @@ export const loadAllTranscriptCompilers = async () => {
|
||||
customCredits:{
|
||||
enable:false,
|
||||
replaceText:"Powered By Open Ticket!",
|
||||
replaceURL:"https://openticket.dj-dj.be",
|
||||
replaceURL:"https://opendiscord.dj-dj.be",
|
||||
enableReportBug:true
|
||||
},
|
||||
customHeaderUrl:{
|
||||
enabled:false,
|
||||
url:"https://openticket.dj-dj.be",
|
||||
url:"https://opendiscord.dj-dj.be",
|
||||
text:"Hello!"
|
||||
},
|
||||
customTranscriptUrl:{
|
||||
@@ -454,17 +454,17 @@ export const loadAllTranscriptCompilers = async () => {
|
||||
if (res.status == 429) return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts! (Ratelimit)\nTry again in a few minutes!",messages,data:null}
|
||||
|
||||
//unknown status error
|
||||
openticket.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
|
||||
opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
|
||||
return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts! (Unknown Error)",messages,data:null}
|
||||
}
|
||||
//check body
|
||||
try{
|
||||
var data: api.ODTranscriptHtmlV2Response = JSON.parse(res.body)
|
||||
if (!data || data["status"] != "success"){
|
||||
openticket.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
|
||||
opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
|
||||
return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts! (Server 500 Error)",messages,data:null}}
|
||||
}catch{
|
||||
openticket.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
|
||||
opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
|
||||
return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts! (JSON parse error)",messages,data:null}
|
||||
}
|
||||
|
||||
@@ -474,11 +474,11 @@ export const loadAllTranscriptCompilers = async () => {
|
||||
//READY
|
||||
await utilities.timer(16000) //wait until transcript is ready
|
||||
return {
|
||||
channelMessage:await messages.getSafe("openticket:transcript-html-ready").build("channel",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:openticket.transcripts.get("openticket:html-compiler")}),
|
||||
creatorDmMessage:await messages.getSafe("openticket:transcript-html-ready").build("creator-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:openticket.transcripts.get("openticket:html-compiler")}),
|
||||
participantDmMessage:await messages.getSafe("openticket:transcript-html-ready").build("participant-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:openticket.transcripts.get("openticket:html-compiler")}),
|
||||
activeAdminDmMessage:await messages.getSafe("openticket:transcript-html-ready").build("active-admin-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:openticket.transcripts.get("openticket:html-compiler")}),
|
||||
everyAdminDmMessage:await messages.getSafe("openticket:transcript-html-ready").build("every-admin-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:openticket.transcripts.get("openticket:html-compiler")})
|
||||
channelMessage:await messages.getSafe("openticket:transcript-html-ready").build("channel",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("openticket:html-compiler")}),
|
||||
creatorDmMessage:await messages.getSafe("openticket:transcript-html-ready").build("creator-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("openticket:html-compiler")}),
|
||||
participantDmMessage:await messages.getSafe("openticket:transcript-html-ready").build("participant-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("openticket:html-compiler")}),
|
||||
activeAdminDmMessage:await messages.getSafe("openticket:transcript-html-ready").build("active-admin-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("openticket:html-compiler")}),
|
||||
everyAdminDmMessage:await messages.getSafe("openticket:transcript-html-ready").build("every-admin-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("openticket:html-compiler")})
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user