Add user-nickname option for channel suffixe

This commit is contained in:
Steven DUBOIS
2025-09-10 18:38:57 +02:00
committed by Steven Dubois
parent b07252151b
commit 21ce2921a1
5 changed files with 32 additions and 17 deletions
+2 -2
View File
@@ -402,7 +402,7 @@ export const defaultOptionsStructure = new api.ODCheckerArrayStructure("opendisc
//TICKET CHANNEL
{key:"channel",checker:new api.ODCheckerObjectStructure("opendiscord:ticket-channel",{cliInitSkipKeys:["backupCategory","claimedCategory"],children:[
{key:"prefix",checker:new api.ODCheckerStringStructure("opendiscord:ticket-channel-prefix",{maxLength:25,regex:/^[^\s]*$/,cliDisplayName:"Prefix",cliDisplayDescription:"The prefix of the name of the ticket channel. (e.g. 'question-')"})},
{key:"suffix",checker:new api.ODCheckerStringStructure("opendiscord:ticket-channel-suffix",{choices:["user-name","user-id","random-number","random-hex","counter-dynamic","counter-fixed"],cliDisplayName:"Suffix",cliDisplayDescription:"The suffix mode to use. The number/text will be appended after the prefix."})},
{key:"suffix",checker:new api.ODCheckerStringStructure("opendiscord:ticket-channel-suffix",{choices:["user-name","user-nickname","user-id","random-number","random-hex","counter-dynamic","counter-fixed"],cliDisplayName:"Suffix",cliDisplayDescription:"The suffix mode to use. The number/text will be appended after the prefix."})},
{key:"category",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:ticket-channel-category","category",true,[],{cliDisplayName:"Category",cliDisplayDescription:"The category the ticket will be created in. Leave empty for no category."})},
{key:"closedCategory",checker:new api.ODCheckerCustomStructure_DiscordId("opendiscord:ticket-channel-closed-category","category",true,[],{cliDisplayName:"Closed Category",cliDisplayDescription:"An additional category where the ticket will be moved to when closed."})},
@@ -700,4 +700,4 @@ export const defaultDropdownOptionsFunction = (manager:api.ODCheckerManager, fun
})
return {valid:(final.length < 1),messages:final}
}
}
+1
View File
@@ -139,6 +139,7 @@ export const loadTicketOptionSuffix = (option:api.ODTicketOption): api.ODOptionS
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 == "user-nickname") return new api.ODOptionUserNicknameSuffix(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)
else if (mode == "counter-fixed") return new api.ODOptionCounterFixedSuffix(option.id.value,option,globalDatabase)