(v4.1) Additional autoclose/autodelete features
This commit is contained in:
@@ -28,6 +28,12 @@ export const registerActions = async () => {
|
||||
ticket.get("opendiscord:open").value = true
|
||||
ticket.get("opendiscord:busy").value = true
|
||||
|
||||
if (generalConfig.data.system.disableAutocloseAfterReopen){
|
||||
//disable autoclose after reopen
|
||||
ticket.get("opendiscord:autoclose-enabled").value = false
|
||||
ticket.get("opendiscord:autoclose-hours").value = 0
|
||||
}
|
||||
|
||||
//update stats
|
||||
await opendiscord.stats.get("opendiscord:global").setStat("opendiscord:tickets-reopened",1,"increase")
|
||||
await opendiscord.stats.get("opendiscord:user").setStat("opendiscord:tickets-reopened",user.id,1,"increase")
|
||||
|
||||
@@ -235,8 +235,6 @@ export interface ODJsonConfig_DefaultSystem {
|
||||
replyOnTicketCreation:boolean,
|
||||
/**Reply with an ephemeral message when reaction roles are changed. */
|
||||
replyOnReactionRole:boolean,
|
||||
/**Show a warning message before the ticket gets autoclosed. This will happen when only 1/4th of the autoclose time remains. */
|
||||
showPreAutocloseWarning:boolean,
|
||||
/**Ask for the priority of this ticket on ticket creation. This will happen in a dropdown in the ticket message. */
|
||||
askPriorityOnTicketCreation:boolean,
|
||||
/**Remove all participants (except admins) from the ticket when it's closed. */
|
||||
|
||||
@@ -1239,7 +1239,6 @@ async function saveQuickSetupConfig(){
|
||||
|
||||
replyOnTicketCreation:false,
|
||||
replyOnReactionRole:true,
|
||||
showPreAutocloseWarning:false,
|
||||
askPriorityOnTicketCreation:false,
|
||||
removeParticipantsOnClose:quickSetupStorage.removeParticipantsOnClose ?? false,
|
||||
disableAutocloseAfterReopen:true,
|
||||
|
||||
@@ -57,7 +57,6 @@ export const migrations = [
|
||||
generalConfig.data.system.showGlobalAdminsInPanelRoles = false
|
||||
generalConfig.data.system.alwaysShowReason = false
|
||||
generalConfig.data.system.pinEmoji = "📌"
|
||||
generalConfig.data.system.showPreAutocloseWarning = false
|
||||
generalConfig.data.system.askPriorityOnTicketCreation = false
|
||||
generalConfig.data.system.disableAutocloseAfterReopen = true
|
||||
generalConfig.data.system.autodeleteRequiresClosedTicket = true
|
||||
|
||||
@@ -278,7 +278,6 @@ export const defaultGeneralStructure = new api.ODCheckerObjectStructure("opendis
|
||||
|
||||
{key:"replyOnTicketCreation",checker:new api.ODCheckerBooleanStructure("opendiscord:reply-on-ticket-creation",{cliDisplayName:"Reply On Ticket Creation",cliDisplayDescription:"When enabled, the bot will send an ephemeral reply in the channel of the panel when creating a ticket."})},
|
||||
{key:"replyOnReactionRole",checker:new api.ODCheckerBooleanStructure("opendiscord:reply-on-reaction-role",{cliDisplayName:"Reply On Reaction Role",cliDisplayDescription:"When enabled, the bot will send an ephemeral reply in the channel of the panel when using a role button."})},
|
||||
{key:"showPreAutocloseWarning",checker:new api.ODCheckerBooleanStructure("opendiscord:show-pre-autoclose-warning",{cliDisplayName:"Show Pre-Autoclose Warning",cliDisplayDescription:"Show a warning message before the ticket gets autoclosed. This will happen when only 1/4th of the autoclose time remains."})},
|
||||
{key:"askPriorityOnTicketCreation",checker:new api.ODCheckerBooleanStructure("opendiscord:ask-priority-creation",{cliDisplayName:"Ask Priority On Ticket Creation",cliDisplayDescription:"Ask for the priority of this ticket on ticket creation. This will happen in a dropdown in the ticket message."})},
|
||||
{key:"removeParticipantsOnClose",checker:new api.ODCheckerBooleanStructure("opendiscord:remove-participants-on-close",{cliDisplayName:"Remove Participants On Close",cliDisplayDescription:"When enabled, all participants except admins will be removed from the ticket."})},
|
||||
{key:"disableAutocloseAfterReopen",checker:new api.ODCheckerBooleanStructure("opendiscord:disable-autoclose-reopen",{cliDisplayName:"Disable Autoclose On Reopen",cliDisplayDescription:"Disable autoclose for a ticket when it has been closed and re-opened."})},
|
||||
|
||||
@@ -446,7 +446,9 @@ const loadAutoCode = () => {
|
||||
if (lastMessage){
|
||||
//ticket has last message
|
||||
const disableOnClaim = ticket.option.get("opendiscord:autodelete-disable-claim").value && ticket.get("opendiscord:claimed").value
|
||||
const enabled = (disableOnClaim) ? false : ticket.get("opendiscord:autodelete-enabled").value
|
||||
const disableWhenNotClosed = generalConfig.data.system.autodeleteRequiresClosedTicket && !ticket.get("opendiscord:closed").value
|
||||
|
||||
const enabled = (disableOnClaim || disableWhenNotClosed) ? false : ticket.get("opendiscord:autodelete-enabled").value
|
||||
const days = ticket.get("opendiscord:autodelete-days").value
|
||||
|
||||
const time = days*24*60*60*1000 //days in milliseconds
|
||||
@@ -475,7 +477,8 @@ const loadAutoCode = () => {
|
||||
if (!channel) return
|
||||
//ticket has been created by this user
|
||||
const disableOnClaim = ticket.option.get("opendiscord:autodelete-disable-claim").value && ticket.get("opendiscord:claimed").value
|
||||
const enabled = (disableOnClaim || !ticket.get("opendiscord:autodelete-enabled").value) ? false : ticket.option.get("opendiscord:autodelete-enable-leave")
|
||||
const disableWhenNotClosed = generalConfig.data.system.autodeleteRequiresClosedTicket && !ticket.get("opendiscord:closed").value
|
||||
const enabled = (disableOnClaim || disableWhenNotClosed || !ticket.get("opendiscord:autodelete-enabled").value) ? false : ticket.option.get("opendiscord:autodelete-enable-leave")
|
||||
|
||||
if (enabled){
|
||||
//autodelete ticket
|
||||
|
||||
@@ -74,7 +74,6 @@ export const defaultGeneralFormatter = new fjs.ObjectFormatter(null,true,[
|
||||
new fjs.TextFormatter(""),
|
||||
new fjs.PropertyFormatter("replyOnTicketCreation"),
|
||||
new fjs.PropertyFormatter("replyOnReactionRole"),
|
||||
new fjs.PropertyFormatter("showPreAutocloseWarning"),
|
||||
new fjs.PropertyFormatter("askPriorityOnTicketCreation"),
|
||||
new fjs.PropertyFormatter("removeParticipantsOnClose"),
|
||||
new fjs.PropertyFormatter("disableAutocloseAfterReopen"),
|
||||
|
||||
Reference in New Issue
Block a user