BREAKING: changed all ids to "opendiscord:"
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
|
||||
export const loadAllBlacklistedUsers = async () => {
|
||||
const userDatabase = opendiscord.databases.get("openticket:users")
|
||||
const userDatabase = opendiscord.databases.get("opendiscord:users")
|
||||
if (!userDatabase) return
|
||||
|
||||
const users = await userDatabase.getCategory("openticket:blacklist") ?? []
|
||||
const users = await userDatabase.getCategory("opendiscord:blacklist") ?? []
|
||||
users.forEach((user) => {
|
||||
if (typeof user.value == "string" || user.value === null) opendiscord.blacklist.add(new api.ODBlacklist(user.key,user.value))
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
|
||||
export const loadAllOptions = async () => {
|
||||
const optionConfig = opendiscord.configs.get("openticket:options")
|
||||
const optionConfig = opendiscord.configs.get("opendiscord:options")
|
||||
if (!optionConfig) return
|
||||
|
||||
optionConfig.data.forEach((option) => {
|
||||
@@ -56,85 +56,85 @@ export const loadAllOptions = async () => {
|
||||
|
||||
export const loadTicketOption = (option:api.ODJsonConfig_DefaultOptionTicketType): api.ODTicketOption => {
|
||||
return new api.ODTicketOption(option.id,[
|
||||
new api.ODOptionData("openticket:name",option.name),
|
||||
new api.ODOptionData("openticket:description",option.description),
|
||||
new api.ODOptionData("opendiscord:name",option.name),
|
||||
new api.ODOptionData("opendiscord:description",option.description),
|
||||
|
||||
new api.ODOptionData("openticket:button-emoji",option.button.emoji),
|
||||
new api.ODOptionData("openticket:button-label",option.button.label),
|
||||
new api.ODOptionData("openticket:button-color",option.button.color),
|
||||
new api.ODOptionData("opendiscord:button-emoji",option.button.emoji),
|
||||
new api.ODOptionData("opendiscord:button-label",option.button.label),
|
||||
new api.ODOptionData("opendiscord:button-color",option.button.color),
|
||||
|
||||
new api.ODOptionData("openticket:admins",option.ticketAdmins),
|
||||
new api.ODOptionData("openticket:admins-readonly",option.readonlyAdmins),
|
||||
new api.ODOptionData("openticket:allow-blacklisted-users",option.allowCreationByBlacklistedUsers),
|
||||
new api.ODOptionData("openticket:questions",option.questions),
|
||||
new api.ODOptionData("opendiscord:admins",option.ticketAdmins),
|
||||
new api.ODOptionData("opendiscord:admins-readonly",option.readonlyAdmins),
|
||||
new api.ODOptionData("opendiscord:allow-blacklisted-users",option.allowCreationByBlacklistedUsers),
|
||||
new api.ODOptionData("opendiscord:questions",option.questions),
|
||||
|
||||
new api.ODOptionData("openticket:channel-prefix",option.channel.prefix),
|
||||
new api.ODOptionData("openticket:channel-suffix",option.channel.suffix),
|
||||
new api.ODOptionData("openticket:channel-category",option.channel.category),
|
||||
new api.ODOptionData("openticket:channel-category-closed",option.channel.closedCategory),
|
||||
new api.ODOptionData("openticket:channel-category-backup",option.channel.backupCategory),
|
||||
new api.ODOptionData("openticket:channel-categories-claimed",option.channel.claimedCategory),
|
||||
new api.ODOptionData("openticket:channel-description",option.channel.description),
|
||||
new api.ODOptionData("opendiscord:channel-prefix",option.channel.prefix),
|
||||
new api.ODOptionData("opendiscord:channel-suffix",option.channel.suffix),
|
||||
new api.ODOptionData("opendiscord:channel-category",option.channel.category),
|
||||
new api.ODOptionData("opendiscord:channel-category-closed",option.channel.closedCategory),
|
||||
new api.ODOptionData("opendiscord:channel-category-backup",option.channel.backupCategory),
|
||||
new api.ODOptionData("opendiscord:channel-categories-claimed",option.channel.claimedCategory),
|
||||
new api.ODOptionData("opendiscord:channel-description",option.channel.description),
|
||||
|
||||
new api.ODOptionData("openticket:dm-message-enabled",option.dmMessage.enabled),
|
||||
new api.ODOptionData("openticket:dm-message-text",option.dmMessage.text),
|
||||
new api.ODOptionData("openticket:dm-message-embed",option.dmMessage.embed),
|
||||
new api.ODOptionData("opendiscord:dm-message-enabled",option.dmMessage.enabled),
|
||||
new api.ODOptionData("opendiscord:dm-message-text",option.dmMessage.text),
|
||||
new api.ODOptionData("opendiscord:dm-message-embed",option.dmMessage.embed),
|
||||
|
||||
new api.ODOptionData("openticket:ticket-message-enabled",option.ticketMessage.enabled),
|
||||
new api.ODOptionData("openticket:ticket-message-text",option.ticketMessage.text),
|
||||
new api.ODOptionData("openticket:ticket-message-embed",option.ticketMessage.embed),
|
||||
new api.ODOptionData("openticket:ticket-message-ping",option.ticketMessage.ping),
|
||||
new api.ODOptionData("opendiscord:ticket-message-enabled",option.ticketMessage.enabled),
|
||||
new api.ODOptionData("opendiscord:ticket-message-text",option.ticketMessage.text),
|
||||
new api.ODOptionData("opendiscord:ticket-message-embed",option.ticketMessage.embed),
|
||||
new api.ODOptionData("opendiscord:ticket-message-ping",option.ticketMessage.ping),
|
||||
|
||||
new api.ODOptionData("openticket:autoclose-enable-hours",option.autoclose.enableInactiveHours),
|
||||
new api.ODOptionData("openticket:autoclose-enable-leave",option.autoclose.enableUserLeave),
|
||||
new api.ODOptionData("openticket:autoclose-disable-claim",option.autoclose.disableOnClaim),
|
||||
new api.ODOptionData("openticket:autoclose-hours",option.autoclose.inactiveHours),
|
||||
new api.ODOptionData("opendiscord:autoclose-enable-hours",option.autoclose.enableInactiveHours),
|
||||
new api.ODOptionData("opendiscord:autoclose-enable-leave",option.autoclose.enableUserLeave),
|
||||
new api.ODOptionData("opendiscord:autoclose-disable-claim",option.autoclose.disableOnClaim),
|
||||
new api.ODOptionData("opendiscord:autoclose-hours",option.autoclose.inactiveHours),
|
||||
|
||||
new api.ODOptionData("openticket:autodelete-enable-days",option.autodelete.enableInactiveDays),
|
||||
new api.ODOptionData("openticket:autodelete-enable-leave",option.autodelete.enableUserLeave),
|
||||
new api.ODOptionData("openticket:autodelete-disable-claim",option.autodelete.disableOnClaim),
|
||||
new api.ODOptionData("openticket:autodelete-days",option.autodelete.inactiveDays),
|
||||
new api.ODOptionData("opendiscord:autodelete-enable-days",option.autodelete.enableInactiveDays),
|
||||
new api.ODOptionData("opendiscord:autodelete-enable-leave",option.autodelete.enableUserLeave),
|
||||
new api.ODOptionData("opendiscord:autodelete-disable-claim",option.autodelete.disableOnClaim),
|
||||
new api.ODOptionData("opendiscord:autodelete-days",option.autodelete.inactiveDays),
|
||||
|
||||
new api.ODOptionData("openticket:cooldown-enabled",option.cooldown.enabled),
|
||||
new api.ODOptionData("openticket:cooldown-minutes",option.cooldown.cooldownMinutes),
|
||||
new api.ODOptionData("opendiscord:cooldown-enabled",option.cooldown.enabled),
|
||||
new api.ODOptionData("opendiscord:cooldown-minutes",option.cooldown.cooldownMinutes),
|
||||
|
||||
new api.ODOptionData("openticket:limits-enabled",option.limits.enabled),
|
||||
new api.ODOptionData("openticket:limits-maximum-global",option.limits.globalMaximum),
|
||||
new api.ODOptionData("openticket:limits-maximum-user",option.limits.userMaximum)
|
||||
new api.ODOptionData("opendiscord:limits-enabled",option.limits.enabled),
|
||||
new api.ODOptionData("opendiscord:limits-maximum-global",option.limits.globalMaximum),
|
||||
new api.ODOptionData("opendiscord:limits-maximum-user",option.limits.userMaximum)
|
||||
])
|
||||
}
|
||||
|
||||
export const loadWebsiteOption = (opt:api.ODJsonConfig_DefaultOptionWebsiteType): api.ODWebsiteOption => {
|
||||
return new api.ODWebsiteOption(opt.id,[
|
||||
new api.ODOptionData("openticket:name",opt.name),
|
||||
new api.ODOptionData("openticket:description",opt.description),
|
||||
new api.ODOptionData("opendiscord:name",opt.name),
|
||||
new api.ODOptionData("opendiscord:description",opt.description),
|
||||
|
||||
new api.ODOptionData("openticket:button-emoji",opt.button.emoji),
|
||||
new api.ODOptionData("openticket:button-label",opt.button.label),
|
||||
new api.ODOptionData("opendiscord:button-emoji",opt.button.emoji),
|
||||
new api.ODOptionData("opendiscord:button-label",opt.button.label),
|
||||
|
||||
new api.ODOptionData("openticket:url",opt.url)
|
||||
new api.ODOptionData("opendiscord:url",opt.url)
|
||||
])
|
||||
}
|
||||
|
||||
export const loadRoleOption = (opt:api.ODJsonConfig_DefaultOptionRoleType): api.ODRoleOption => {
|
||||
return new api.ODRoleOption(opt.id,[
|
||||
new api.ODOptionData("openticket:name",opt.name),
|
||||
new api.ODOptionData("openticket:description",opt.description),
|
||||
new api.ODOptionData("opendiscord:name",opt.name),
|
||||
new api.ODOptionData("opendiscord:description",opt.description),
|
||||
|
||||
new api.ODOptionData("openticket:button-emoji",opt.button.emoji),
|
||||
new api.ODOptionData("openticket:button-label",opt.button.label),
|
||||
new api.ODOptionData("openticket:button-color",opt.button.color),
|
||||
new api.ODOptionData("opendiscord:button-emoji",opt.button.emoji),
|
||||
new api.ODOptionData("opendiscord:button-label",opt.button.label),
|
||||
new api.ODOptionData("opendiscord:button-color",opt.button.color),
|
||||
|
||||
new api.ODOptionData("openticket:roles",opt.roles),
|
||||
new api.ODOptionData("openticket:mode",opt.mode),
|
||||
new api.ODOptionData("openticket:remove-roles-on-add",opt.removeRolesOnAdd),
|
||||
new api.ODOptionData("openticket:add-on-join",opt.addOnMemberJoin)
|
||||
new api.ODOptionData("opendiscord:roles",opt.roles),
|
||||
new api.ODOptionData("opendiscord:mode",opt.mode),
|
||||
new api.ODOptionData("opendiscord:remove-roles-on-add",opt.removeRolesOnAdd),
|
||||
new api.ODOptionData("opendiscord:add-on-join",opt.addOnMemberJoin)
|
||||
])
|
||||
}
|
||||
|
||||
export const loadTicketOptionSuffix = (option:api.ODTicketOption): api.ODOptionSuffix => {
|
||||
const mode = option.get("openticket:channel-suffix").value
|
||||
const globalDatabase = opendiscord.databases.get("openticket:global")
|
||||
const mode = option.get("opendiscord:channel-suffix").value
|
||||
const globalDatabase = opendiscord.databases.get("opendiscord: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)
|
||||
|
||||
@@ -2,7 +2,7 @@ import {opendiscord, api, utilities} from "../../index"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
export const loadAllPanels = async () => {
|
||||
const panelConfig = opendiscord.configs.get("openticket:panels")
|
||||
const panelConfig = opendiscord.configs.get("opendiscord:panels")
|
||||
if (!panelConfig) return
|
||||
|
||||
panelConfig.data.forEach((panel) => {
|
||||
@@ -23,28 +23,28 @@ export const loadAllPanels = async () => {
|
||||
|
||||
export const loadPanel = (panel:api.ODJsonConfig_DefaultPanelType) => {
|
||||
return new api.ODPanel(panel.id,[
|
||||
new api.ODPanelData("openticket:name",panel.name),
|
||||
new api.ODPanelData("openticket:options",panel.options),
|
||||
new api.ODPanelData("openticket:dropdown",panel.dropdown),
|
||||
new api.ODPanelData("opendiscord:name",panel.name),
|
||||
new api.ODPanelData("opendiscord:options",panel.options),
|
||||
new api.ODPanelData("opendiscord:dropdown",panel.dropdown),
|
||||
|
||||
new api.ODPanelData("openticket:text",panel.text),
|
||||
new api.ODPanelData("openticket:embed",panel.embed),
|
||||
new api.ODPanelData("opendiscord:text",panel.text),
|
||||
new api.ODPanelData("opendiscord:embed",panel.embed),
|
||||
|
||||
new api.ODPanelData("openticket:dropdown-placeholder",panel.settings.dropdownPlaceholder),
|
||||
new api.ODPanelData("openticket:enable-max-tickets-warning-text",panel.settings.enableMaxTicketsWarningInText),
|
||||
new api.ODPanelData("openticket:enable-max-tickets-warning-embed",panel.settings.enableMaxTicketsWarningInEmbed),
|
||||
new api.ODPanelData("openticket:describe-options-layout",panel.settings.describeOptionsLayout),
|
||||
new api.ODPanelData("openticket:describe-options-custom-title",panel.settings.describeOptionsCustomTitle),
|
||||
new api.ODPanelData("openticket:describe-options-in-text",panel.settings.describeOptionsInText),
|
||||
new api.ODPanelData("openticket:describe-options-in-embed-fields",panel.settings.describeOptionsInEmbedFields),
|
||||
new api.ODPanelData("openticket:describe-options-in-embed-description",panel.settings.describeOptionsInEmbedDescription),
|
||||
new api.ODPanelData("opendiscord:dropdown-placeholder",panel.settings.dropdownPlaceholder),
|
||||
new api.ODPanelData("opendiscord:enable-max-tickets-warning-text",panel.settings.enableMaxTicketsWarningInText),
|
||||
new api.ODPanelData("opendiscord:enable-max-tickets-warning-embed",panel.settings.enableMaxTicketsWarningInEmbed),
|
||||
new api.ODPanelData("opendiscord:describe-options-layout",panel.settings.describeOptionsLayout),
|
||||
new api.ODPanelData("opendiscord:describe-options-custom-title",panel.settings.describeOptionsCustomTitle),
|
||||
new api.ODPanelData("opendiscord:describe-options-in-text",panel.settings.describeOptionsInText),
|
||||
new api.ODPanelData("opendiscord:describe-options-in-embed-fields",panel.settings.describeOptionsInEmbedFields),
|
||||
new api.ODPanelData("opendiscord:describe-options-in-embed-description",panel.settings.describeOptionsInEmbedDescription),
|
||||
])
|
||||
}
|
||||
export function describePanelOptions(mode:"fields",panel:api.ODPanel): {name:string,value:string}[]
|
||||
export function describePanelOptions(mode:"text",panel:api.ODPanel): string
|
||||
export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {name:string,value:string}[]|string {
|
||||
const layout = panel.get("openticket:describe-options-layout").value
|
||||
const dropdownMode = panel.get("openticket:dropdown").value
|
||||
const layout = panel.get("opendiscord:describe-options-layout").value
|
||||
const dropdownMode = panel.get("opendiscord:dropdown").value
|
||||
const options: api.ODOption[] = []
|
||||
let hasTicket = false
|
||||
let hasWebsite = false
|
||||
@@ -52,7 +52,7 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
|
||||
let ticketOnly = true
|
||||
let websiteOnly = true
|
||||
let roleOnly = true
|
||||
panel.get("openticket:options").value.forEach((id) => {
|
||||
panel.get("opendiscord:options").value.forEach((id) => {
|
||||
const opt = opendiscord.options.get(id)
|
||||
if (opt){
|
||||
if (opt instanceof api.ODTicketOption){
|
||||
@@ -76,24 +76,24 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
|
||||
|
||||
//TODO TRANSLATION!!!
|
||||
const autotitle = (hasTicket && ticketOnly) ? "Select your ticket:" : ((hasRole && roleOnly) ? "Select your role:" : "Select your option:")
|
||||
const title = (panel.get("openticket:describe-options-custom-title").value.length < 1) ? "__"+autotitle+"__\n" : "__"+panel.get("openticket:describe-options-custom-title").value+"__\n"
|
||||
const title = (panel.get("opendiscord:describe-options-custom-title").value.length < 1) ? "__"+autotitle+"__\n" : "__"+panel.get("opendiscord:describe-options-custom-title").value+"__\n"
|
||||
|
||||
if (mode == "fields") return options.map((opt) => {
|
||||
if (opt instanceof api.ODTicketOption){
|
||||
//ticket option
|
||||
const emoji = opt.exists("openticket:button-emoji") ? opt.get("openticket:button-emoji").value : ""
|
||||
const name = opt.exists("openticket:name") ? opt.get("openticket:name").value : "`<unnamed-ticket>`"
|
||||
let description = opt.exists("openticket:description") ? opt.get("openticket:description").value : "`<no-description>`"
|
||||
const emoji = opt.exists("opendiscord:button-emoji") ? opt.get("opendiscord:button-emoji").value : ""
|
||||
const name = opt.exists("opendiscord:name") ? opt.get("opendiscord:name").value : "`<unnamed-ticket>`"
|
||||
let description = opt.exists("opendiscord:description") ? opt.get("opendiscord:description").value : "`<no-description>`"
|
||||
|
||||
if (layout == "normal" || layout == "detailed"){
|
||||
//TODO TRANSLATION!!!
|
||||
if (opt.exists("openticket:cooldown-enabled") && opt.get("openticket:cooldown-enabled").value) description = description + "\nCooldown: `"+opt.get("openticket:cooldown-minutes").value+" min`"
|
||||
if (opt.exists("opendiscord:cooldown-enabled") && opt.get("opendiscord:cooldown-enabled").value) description = description + "\nCooldown: `"+opt.get("opendiscord:cooldown-minutes").value+" min`"
|
||||
//TODO TRANSLATION!!!
|
||||
if (opt.exists("openticket:limits-enabled") && opt.get("openticket:limits-enabled").value) description = description + "\nMax Tickets: `"+opt.get("openticket:limits-maximum-user").value+"`"
|
||||
if (opt.exists("opendiscord:limits-enabled") && opt.get("opendiscord:limits-enabled").value) description = description + "\nMax Tickets: `"+opt.get("opendiscord:limits-maximum-user").value+"`"
|
||||
}
|
||||
if (layout == "detailed"){
|
||||
//TODO TRANSLATION!!!
|
||||
if (opt.exists("openticket:admins")) description = description + "\nAdmins: "+opt.get("openticket:admins").value.map((admin) => discord.roleMention(admin)).join(", ")
|
||||
if (opt.exists("opendiscord:admins")) description = description + "\nAdmins: "+opt.get("opendiscord:admins").value.map((admin) => discord.roleMention(admin)).join(", ")
|
||||
}
|
||||
|
||||
if (description == "") description = "`<no-description>`"
|
||||
@@ -101,22 +101,22 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
|
||||
|
||||
}else if (opt instanceof api.ODWebsiteOption){
|
||||
//website option
|
||||
const emoji = opt.exists("openticket:button-emoji") ? opt.get("openticket:button-emoji").value : ""
|
||||
const name = opt.exists("openticket:name") ? opt.get("openticket:name").value : "`<unnamed-website>`"
|
||||
let description = opt.exists("openticket:description") ? opt.get("openticket:description").value : "`<no-description>`"
|
||||
const emoji = opt.exists("opendiscord:button-emoji") ? opt.get("opendiscord:button-emoji").value : ""
|
||||
const name = opt.exists("opendiscord:name") ? opt.get("opendiscord:name").value : "`<unnamed-website>`"
|
||||
let description = opt.exists("opendiscord:description") ? opt.get("opendiscord:description").value : "`<no-description>`"
|
||||
|
||||
if (description == "") description = "`<no-description>`"
|
||||
return {name:utilities.emojiTitle(emoji,name),value:description}
|
||||
|
||||
}else if (opt instanceof api.ODRoleOption){
|
||||
//role option
|
||||
const emoji = opt.exists("openticket:button-emoji") ? opt.get("openticket:button-emoji").value : ""
|
||||
const name = opt.exists("openticket:name") ? opt.get("openticket:name").value : "`<unnamed-role>`"
|
||||
let description = opt.exists("openticket:description") ? opt.get("openticket:description").value : "`<no-description>`"
|
||||
const emoji = opt.exists("opendiscord:button-emoji") ? opt.get("opendiscord:button-emoji").value : ""
|
||||
const name = opt.exists("opendiscord:name") ? opt.get("opendiscord:name").value : "`<unnamed-role>`"
|
||||
let description = opt.exists("opendiscord:description") ? opt.get("opendiscord:description").value : "`<no-description>`"
|
||||
|
||||
if (layout == "normal" || layout == "detailed"){
|
||||
//TODO TRANSLATION!!!
|
||||
if (opt.exists("openticket:roles")) description = description + "\nRoles: "+opt.get("openticket:roles").value.map((admin) => discord.roleMention(admin)).join(", ")
|
||||
if (opt.exists("opendiscord:roles")) description = description + "\nRoles: "+opt.get("opendiscord:roles").value.map((admin) => discord.roleMention(admin)).join(", ")
|
||||
}
|
||||
|
||||
if (description == "") description = "`<no-description>`"
|
||||
@@ -124,28 +124,28 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
|
||||
|
||||
}else{
|
||||
//auto-generated plugin option
|
||||
const emoji = opt.get("openticket:button-emoji") as api.ODOptionData<string>|null
|
||||
const name = opt.get("openticket:name") as api.ODOptionData<string>|null
|
||||
const description = opt.get("openticket:description") as api.ODOptionData<string>|null
|
||||
const emoji = opt.get("opendiscord:button-emoji") as api.ODOptionData<string>|null
|
||||
const name = opt.get("opendiscord:name") as api.ODOptionData<string>|null
|
||||
const description = opt.get("opendiscord:description") as api.ODOptionData<string>|null
|
||||
return {name:utilities.emojiTitle((emoji ? emoji.value : ""),(name ? name.value : "`"+opt.id+"`")),value:((description && description.value) ? description.value : "`<no-description>`")}
|
||||
}
|
||||
})
|
||||
else if (mode == "text") return title+options.map((opt) => {
|
||||
if (opt instanceof api.ODTicketOption){
|
||||
//ticket option
|
||||
const emoji = opt.exists("openticket:button-emoji") ? opt.get("openticket:button-emoji").value : ""
|
||||
const name = opt.exists("openticket:name") ? opt.get("openticket:name").value : "`<unnamed-ticket>`"
|
||||
let description = opt.exists("openticket:description") ? opt.get("openticket:description").value : "`<no-description>`"
|
||||
const emoji = opt.exists("opendiscord:button-emoji") ? opt.get("opendiscord:button-emoji").value : ""
|
||||
const name = opt.exists("opendiscord:name") ? opt.get("opendiscord:name").value : "`<unnamed-ticket>`"
|
||||
let description = opt.exists("opendiscord:description") ? opt.get("opendiscord:description").value : "`<no-description>`"
|
||||
|
||||
if (layout == "normal" || layout == "detailed"){
|
||||
//TODO TRANSLATION!!!
|
||||
if (opt.exists("openticket:cooldown-enabled") && opt.get("openticket:cooldown-enabled").value) description = description + "\nCooldown: `"+opt.get("openticket:cooldown-minutes").value+" min`"
|
||||
if (opt.exists("opendiscord:cooldown-enabled") && opt.get("opendiscord:cooldown-enabled").value) description = description + "\nCooldown: `"+opt.get("opendiscord:cooldown-minutes").value+" min`"
|
||||
//TODO TRANSLATION!!!
|
||||
if (opt.exists("openticket:limits-enabled") && opt.get("openticket:limits-enabled").value) description = description + "\nMax Tickets: `"+opt.get("openticket:limits-maximum-user").value+"`"
|
||||
if (opt.exists("opendiscord:limits-enabled") && opt.get("opendiscord:limits-enabled").value) description = description + "\nMax Tickets: `"+opt.get("opendiscord:limits-maximum-user").value+"`"
|
||||
}
|
||||
if (layout == "detailed"){
|
||||
//TODO TRANSLATION!!!
|
||||
if (opt.exists("openticket:admins")) description = description + "\nAdmins: "+opt.get("openticket:admins").value.map((admin) => discord.roleMention(admin)).join(", ")
|
||||
if (opt.exists("opendiscord:admins")) description = description + "\nAdmins: "+opt.get("opendiscord:admins").value.map((admin) => discord.roleMention(admin)).join(", ")
|
||||
}
|
||||
|
||||
if (layout == "simple") return "**"+utilities.emojiTitle(emoji,name)+":** "+description
|
||||
@@ -153,22 +153,22 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
|
||||
|
||||
}else if (opt instanceof api.ODWebsiteOption){
|
||||
//website option
|
||||
const emoji = opt.exists("openticket:button-emoji") ? opt.get("openticket:button-emoji").value : ""
|
||||
const name = opt.exists("openticket:name") ? opt.get("openticket:name").value : "`<unnamed-website>`"
|
||||
let description = opt.exists("openticket:description") ? opt.get("openticket:description").value : "`<no-description>`"
|
||||
const emoji = opt.exists("opendiscord:button-emoji") ? opt.get("opendiscord:button-emoji").value : ""
|
||||
const name = opt.exists("opendiscord:name") ? opt.get("opendiscord:name").value : "`<unnamed-website>`"
|
||||
let description = opt.exists("opendiscord:description") ? opt.get("opendiscord:description").value : "`<no-description>`"
|
||||
|
||||
if (layout == "simple") return "**"+utilities.emojiTitle(emoji,name)+":** "+description
|
||||
else return "**"+utilities.emojiTitle(emoji,name)+"**\n"+description
|
||||
|
||||
}else if (opt instanceof api.ODRoleOption){
|
||||
//role option
|
||||
const emoji = opt.exists("openticket:button-emoji") ? opt.get("openticket:button-emoji").value : ""
|
||||
const name = opt.exists("openticket:name") ? opt.get("openticket:name").value : "`<unnamed-role>`"
|
||||
let description = opt.exists("openticket:description") ? opt.get("openticket:description").value : "`<no-description>`"
|
||||
const emoji = opt.exists("opendiscord:button-emoji") ? opt.get("opendiscord:button-emoji").value : ""
|
||||
const name = opt.exists("opendiscord:name") ? opt.get("opendiscord:name").value : "`<unnamed-role>`"
|
||||
let description = opt.exists("opendiscord:description") ? opt.get("opendiscord:description").value : "`<no-description>`"
|
||||
|
||||
if (layout == "normal" || layout == "detailed"){
|
||||
//TODO TRANSLATION!!!
|
||||
if (opt.exists("openticket:roles")) description = description + "\nRoles: "+opt.get("openticket:roles").value.map((admin) => discord.roleMention(admin)).join(", ")
|
||||
if (opt.exists("opendiscord:roles")) description = description + "\nRoles: "+opt.get("opendiscord:roles").value.map((admin) => discord.roleMention(admin)).join(", ")
|
||||
}
|
||||
|
||||
if (layout == "simple") return "**"+utilities.emojiTitle(emoji,name)+":** "+description
|
||||
@@ -176,9 +176,9 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
|
||||
|
||||
}else{
|
||||
//auto-generated plugin option
|
||||
const emoji = opt.get("openticket:button-emoji") as api.ODOptionData<string>|null
|
||||
const name = opt.get("openticket:name") as api.ODOptionData<string>|null
|
||||
const description = opt.get("openticket:description") as api.ODOptionData<string>|null
|
||||
const emoji = opt.get("opendiscord:button-emoji") as api.ODOptionData<string>|null
|
||||
const name = opt.get("opendiscord:name") as api.ODOptionData<string>|null
|
||||
const description = opt.get("opendiscord:description") as api.ODOptionData<string>|null
|
||||
|
||||
if (layout == "simple") return "**"+utilities.emojiTitle((emoji ? emoji.value : ""),(name ? name.value : "`"+opt.id+"`"))+":** "+(description ? description.value : "`<no-description>`")
|
||||
else return "**"+utilities.emojiTitle((emoji ? emoji.value : ""),(name ? name.value : "`"+opt.id+"`"))+"**\n"+(description ? description.value : "`<no-description>`")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
|
||||
export const loadAllQuestions = async () => {
|
||||
const questionConfig = opendiscord.configs.get("openticket:questions")
|
||||
const questionConfig = opendiscord.configs.get("opendiscord:questions")
|
||||
if (!questionConfig) return
|
||||
|
||||
questionConfig.data.forEach((question) => {
|
||||
@@ -30,24 +30,24 @@ export const loadAllQuestions = async () => {
|
||||
|
||||
export const loadShortQuestion = (option:api.ODJsonConfig_DefaultShortQuestionType) => {
|
||||
return new api.ODShortQuestion(option.id,[
|
||||
new api.ODQuestionData("openticket:name",option.name),
|
||||
new api.ODQuestionData("openticket:required",option.required),
|
||||
new api.ODQuestionData("openticket:placeholder",option.placeholder),
|
||||
new api.ODQuestionData("opendiscord:name",option.name),
|
||||
new api.ODQuestionData("opendiscord:required",option.required),
|
||||
new api.ODQuestionData("opendiscord:placeholder",option.placeholder),
|
||||
|
||||
new api.ODQuestionData("openticket:length-enabled",option.length.enabled),
|
||||
new api.ODQuestionData("openticket:length-min",option.length.min),
|
||||
new api.ODQuestionData("openticket:length-max",option.length.max),
|
||||
new api.ODQuestionData("opendiscord:length-enabled",option.length.enabled),
|
||||
new api.ODQuestionData("opendiscord:length-min",option.length.min),
|
||||
new api.ODQuestionData("opendiscord:length-max",option.length.max),
|
||||
])
|
||||
}
|
||||
|
||||
export const loadParagraphQuestion = (option:api.ODJsonConfig_DefaultParagraphQuestionType) => {
|
||||
return new api.ODParagraphQuestion(option.id,[
|
||||
new api.ODQuestionData("openticket:name",option.name),
|
||||
new api.ODQuestionData("openticket:required",option.required),
|
||||
new api.ODQuestionData("openticket:placeholder",option.placeholder),
|
||||
new api.ODQuestionData("opendiscord:name",option.name),
|
||||
new api.ODQuestionData("opendiscord:required",option.required),
|
||||
new api.ODQuestionData("opendiscord:placeholder",option.placeholder),
|
||||
|
||||
new api.ODQuestionData("openticket:length-enabled",option.length.enabled),
|
||||
new api.ODQuestionData("openticket:length-min",option.length.min),
|
||||
new api.ODQuestionData("openticket:length-max",option.length.max),
|
||||
new api.ODQuestionData("opendiscord:length-enabled",option.length.enabled),
|
||||
new api.ODQuestionData("opendiscord:length-min",option.length.min),
|
||||
new api.ODQuestionData("opendiscord:length-max",option.length.max),
|
||||
])
|
||||
}
|
||||
@@ -10,9 +10,9 @@ export const loadAllRoles = async () => {
|
||||
|
||||
export const loadRole = (option:api.ODRoleOption) => {
|
||||
return new api.ODRole(option.id,[
|
||||
new api.ODRoleData("openticket:roles",option.get("openticket:roles").value),
|
||||
new api.ODRoleData("openticket:mode",option.get("openticket:mode").value),
|
||||
new api.ODRoleData("openticket:remove-roles-on-add",option.get("openticket:remove-roles-on-add").value),
|
||||
new api.ODRoleData("openticket:add-on-join",option.get("openticket:add-on-join").value)
|
||||
new api.ODRoleData("opendiscord:roles",option.get("opendiscord:roles").value),
|
||||
new api.ODRoleData("opendiscord:mode",option.get("opendiscord:mode").value),
|
||||
new api.ODRoleData("opendiscord:remove-roles-on-add",option.get("opendiscord:remove-roles-on-add").value),
|
||||
new api.ODRoleData("opendiscord:add-on-join",option.get("opendiscord:add-on-join").value)
|
||||
])
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
|
||||
const optionDatabase = opendiscord.databases.get("openticket:options")
|
||||
const optionDatabase = opendiscord.databases.get("opendiscord:options")
|
||||
|
||||
export const loadAllTickets = async () => {
|
||||
const ticketDatabase = opendiscord.databases.get("openticket:tickets")
|
||||
const ticketDatabase = opendiscord.databases.get("opendiscord:tickets")
|
||||
if (!ticketDatabase) return
|
||||
|
||||
const tickets = await ticketDatabase.getCategory("openticket:ticket")
|
||||
const tickets = await ticketDatabase.getCategory("opendiscord:ticket")
|
||||
if (!tickets) return
|
||||
for (const ticket of tickets){
|
||||
try {
|
||||
@@ -19,14 +19,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 backupOption = (await optionDatabase.exists("opendiscord:used-option",ticket.option)) ? api.ODTicketOption.fromJson(await optionDatabase.get("opendiscord:used-option",ticket.option) as api.ODOptionJson) : null
|
||||
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(opendiscord.versions.get("openticket:version")))
|
||||
if (configOption) await optionDatabase.set("opendiscord:used-option",configOption.id.value,configOption.toJson(opendiscord.versions.get("opendiscord:version")))
|
||||
else if (backupOption) opendiscord.options.add(backupOption)
|
||||
else throw new api.ODSystemError("Unable to use backup option! Normal option not found in config!")
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as discord from "discord.js"
|
||||
|
||||
const collector = opendiscord.transcripts.collector
|
||||
const messages = opendiscord.builders.messages
|
||||
const transcriptConfig = opendiscord.configs.get("openticket:transcripts")
|
||||
const transcriptConfig = opendiscord.configs.get("opendiscord:transcripts")
|
||||
const textConfig = transcriptConfig.data.textTranscriptStyle
|
||||
const htmlVersion = Buffer.from("b3BlbnRpY2tldFRSQU5TQ1JJUFQxMjM0","base64").toString("utf8")
|
||||
|
||||
@@ -44,7 +44,7 @@ export const loadAllTranscriptCompilers = async () => {
|
||||
}
|
||||
|
||||
//TEXT COMPILER
|
||||
opendiscord.transcripts.add(new api.ODTranscriptCompiler<{contents:string}>("openticket:text-compiler",undefined,async (ticket,channel,user) => {
|
||||
opendiscord.transcripts.add(new api.ODTranscriptCompiler<{contents:string}>("opendiscord: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}
|
||||
@@ -104,10 +104,10 @@ export const loadAllTranscriptCompilers = async () => {
|
||||
|
||||
const finalStats: string[] = []
|
||||
|
||||
const creationDate = ticket.get("openticket:opened-on").value
|
||||
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 creationDate = ticket.get("opendiscord:opened-on").value
|
||||
const closeDate = ticket.get("opendiscord:closed-on").value
|
||||
const claimDate = ticket.get("opendiscord:claimed-on").value
|
||||
const pinDate = ticket.get("opendiscord:pinned-on").value
|
||||
const creator = await opendiscord.tickets.getTicketUser(ticket,"creator")
|
||||
const closer = await opendiscord.tickets.getTicketUser(ticket,"closer")
|
||||
const claimer = await opendiscord.tickets.getTicketUser(ticket,"claimer")
|
||||
@@ -164,16 +164,16 @@ 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: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")})
|
||||
channelMessage:await messages.getSafe("opendiscord:transcript-text-ready").build("channel",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("opendiscord:text-compiler")}),
|
||||
creatorDmMessage:await messages.getSafe("opendiscord:transcript-text-ready").build("creator-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("opendiscord:text-compiler")}),
|
||||
participantDmMessage:await messages.getSafe("opendiscord:transcript-text-ready").build("participant-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("opendiscord:text-compiler")}),
|
||||
activeAdminDmMessage:await messages.getSafe("opendiscord: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("opendiscord:text-compiler")}),
|
||||
everyAdminDmMessage:await messages.getSafe("opendiscord: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("opendiscord:text-compiler")})
|
||||
}
|
||||
}))
|
||||
|
||||
//HTML COMPILER
|
||||
opendiscord.transcripts.add(new api.ODTranscriptCompiler<{url:string}>("openticket:html-compiler",async (ticket,channel,user) => {
|
||||
opendiscord.transcripts.add(new api.ODTranscriptCompiler<{url:string}>("opendiscord: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()
|
||||
@@ -191,7 +191,7 @@ export const loadAllTranscriptCompilers = async () => {
|
||||
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:opendiscord.transcripts.get("openticket:html-compiler"),remaining:16000})}
|
||||
return {success:true,errorReason:null,pendingMessage:await messages.getSafe("opendiscord:transcript-html-progress").build("channel",{guild:channel.guild,channel,user,ticket,compiler:opendiscord.transcripts.get("opendiscord:html-compiler"),remaining:16000})}
|
||||
},async (ticket,channel,user) => {
|
||||
//COMPILE
|
||||
const rawMessages = await collector.collectAllMessages(ticket)
|
||||
@@ -355,7 +355,7 @@ export const loadAllTranscriptCompilers = async () => {
|
||||
|
||||
const htmlFinal: api.ODTranscriptHtmlV2Data = {
|
||||
version:"2",
|
||||
otversion:opendiscord.versions.get("openticket:version").toString(true),
|
||||
otversion:opendiscord.versions.get("opendiscord:version").toString(true),
|
||||
bot:{
|
||||
name:opendiscord.client.client.user.displayName,
|
||||
id:opendiscord.client.client.user.id,
|
||||
@@ -410,7 +410,7 @@ export const loadAllTranscriptCompilers = async () => {
|
||||
claimedpfp:(claimer ? claimer.displayAvatarURL() : "https://transcripts.dj-dj.be/favicon.png"),
|
||||
|
||||
closedtime:new Date().getTime(),
|
||||
openedtime:ticket.get("openticket:opened-on").value ?? new Date().getTime(),
|
||||
openedtime:ticket.get("opendiscord:opened-on").value ?? new Date().getTime(),
|
||||
|
||||
//role colors are currently unused
|
||||
roleColors:[],
|
||||
@@ -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: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")})
|
||||
channelMessage:await messages.getSafe("opendiscord:transcript-html-ready").build("channel",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("opendiscord:html-compiler")}),
|
||||
creatorDmMessage:await messages.getSafe("opendiscord:transcript-html-ready").build("creator-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("opendiscord:html-compiler")}),
|
||||
participantDmMessage:await messages.getSafe("opendiscord:transcript-html-ready").build("participant-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("opendiscord:html-compiler")}),
|
||||
activeAdminDmMessage:await messages.getSafe("opendiscord: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("opendiscord:html-compiler")}),
|
||||
everyAdminDmMessage:await messages.getSafe("opendiscord: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("opendiscord:html-compiler")})
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user