Added priority system (Part 1, Incomplete)

This commit is contained in:
DJj123dj
2025-09-14 22:04:11 +02:00
parent b07252151b
commit 415330be21
13 changed files with 254 additions and 4 deletions
+67
View File
@@ -555,6 +555,42 @@ export const loadAllSlashCommands = async () => {
}
]
}))
//PRIORITY
if (allowedCommands.includes("priority")) commands.add(new api.ODSlashCommand("opendiscord:priority",{
type:act.ChatInput,
name:"priority",
description:"Set the priority of the ticket.", //TODO TRANSLATION!!!
contexts:[discord.InteractionContextType.Guild],
integrationTypes:[discord.ApplicationIntegrationType.GuildInstall],
options:[
{
name:"set",
description:"Set the priority of the ticket.", //TODO TRANSLATION!!!
type:acot.Subcommand,
options:[
{
name:"priority",
description:"The priority of the channel.",
type:acot.String,
required:true,
choices:opendiscord.priorities.getAll().sort((a,b) => b.priority-a.priority).map((prio) => ({value:prio.rawName,name:prio.renderDisplayName()}))
},
{
name:"reason",
description:lang.getTranslation("commands.reason"),
type:acot.String,
required:false
}
]
},
{
name:"get",
description:"Get the priority of the ticket.", //TODO TRANSLATION!!!
type:acot.Subcommand
},
//TODO: list (v4.2)
]
}))
}
export const loadAllTextCommands = async () => {
@@ -1057,6 +1093,37 @@ export const loadAllTextCommands = async () => {
}
]
}))
//PRIORITY
//TODO: priority list (v4.2)
if (allowedCommands.includes("priority")) commands.add(new api.ODTextCommand("opendiscord:priority-set",{
name:"priority set",
prefix,
dmPermission:false,
guildPermission:true,
allowBots:false,
options:[
{
name:"priority",
type:"string",
required:true,
allowSpaces:false,
choices:opendiscord.priorities.getAll().sort((a,b) => b.priority-a.priority).map((prio) => prio.rawName)
},
{
name:"reason",
type:"string",
required:false,
allowSpaces:true
}
]
}))
if (allowedCommands.includes("priority")) commands.add(new api.ODTextCommand("opendiscord:priority-get",{
name:"priority get",
prefix,
dmPermission:false,
guildPermission:true,
allowBots:false,
}))
}
export const loadAllContextMenus = async () => {
+4
View File
@@ -75,6 +75,10 @@ export const loadAllEvents = () => {
"afterClientActivityLoaded",
"onClientActivityInit",
"afterClientActivityInitiated",
//priority levels
"onPriorityLoad",
"afterPrioritiesLoaded",
//client slash commands
"onSlashCommandLoad",
+8
View File
@@ -269,5 +269,13 @@ export const loadAllHelpMenuComponents = async () => {
textOptions:[{name:"time",optional:false},{name:"reason",optional:true}],
slashOptions:[{name:"time",optional:false},{name:"reason",optional:true}]
}))
if (allowedCommands.includes("priority")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:priority-set",0,{
textName:prefix+"priority set",
textDescription:"Set the priority of the ticket channel.", //TODO TRANSLATION!!!
slashName:"/priority set",
slashDescription:"Set the priority of the ticket channel.", //TODO TRANSLATION!!!
textOptions:[{name:"priority",optional:false}],
slashOptions:[{name:"priority",optional:false}]
}))
}
}
+11
View File
@@ -0,0 +1,11 @@
import {opendiscord, api, utilities} from "../../index"
export const loadAllPriorities = async () => {
opendiscord.priorities.add(new api.ODPriority("opendiscord:urgent",5,"urgent","Urgent","🔴","🔴")) //TODO TRANSLATION!!!
opendiscord.priorities.add(new api.ODPriority("opendiscord:very-high",4,"very-high","Very High","🟠","🟠")) //TODO TRANSLATION!!!
opendiscord.priorities.add(new api.ODPriority("opendiscord:high",3,"high","High","🟡","🟡")) //TODO TRANSLATION!!!
opendiscord.priorities.add(new api.ODPriority("opendiscord:normal",2,"normal","Normal","🟢","🟢")) //TODO TRANSLATION!!!
opendiscord.priorities.add(new api.ODPriority("opendiscord:low",1,"low","Low","🔵","🔵")) //TODO TRANSLATION!!!
opendiscord.priorities.add(new api.ODPriority("opendiscord:very-low",0,"very-low","Very Low","⚪","⚪")) //TODO TRANSLATION!!!
opendiscord.priorities.add(new api.ODPriority("opendiscord:none",-1,"none","None",null,null)) //TODO TRANSLATION!!!
}