Added /topic set command (Part 1, Incomplete)

This commit is contained in:
DJj123dj
2025-09-14 22:04:42 +02:00
parent 415330be21
commit 6ce017b407
5 changed files with 81 additions and 8 deletions
+14
View File
@@ -1313,6 +1313,20 @@ const autoEmbeds = () => {
} }
const extraEmbeds = () => { const extraEmbeds = () => {
//TOPIC SET
embeds.add(new api.ODEmbed("opendiscord:topic-set"))
embeds.get("opendiscord:topic-set").workers.add(
new api.ODWorker("opendiscord:topic-set",0,async (instance,params,source) => {
const {user,topic} = params
instance.setAuthor(user.displayName,user.displayAvatarURL())
instance.setColor(generalConfig.data.mainColor)
instance.setTitle(utilities.emojiTitle("ℹ️","Topic Changed")) //TODO TRANSLATION!!!
instance.setDescription("The channel topic has been changed by "+discord.userMention(user.id)+" successfully!") //TODO TRANSLATION!!!
if (topic) instance.addFields({name:"Topic"+":",value:"```"+topic+"```"}) //TODO TRANSLATION!!!
})
)
//PRIORITY SET //PRIORITY SET
embeds.add(new api.ODEmbed("opendiscord:priority-set")) embeds.add(new api.ODEmbed("opendiscord:priority-set"))
embeds.get("opendiscord:priority-set").workers.add( embeds.get("opendiscord:priority-set").workers.add(
+4
View File
@@ -295,6 +295,8 @@ export interface ODEmbedManagerIds_Default {
"opendiscord:autodelete-enable":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,time:number,reason:string|null},workers:"opendiscord:autodelete-enable"}, "opendiscord:autodelete-enable":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,time:number,reason:string|null},workers:"opendiscord:autodelete-enable"},
"opendiscord:autoclose-disable":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,reason:string|null},workers:"opendiscord:autoclose-disable"}, "opendiscord:autoclose-disable":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,reason:string|null},workers:"opendiscord:autoclose-disable"},
"opendiscord:autodelete-disable":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,reason:string|null},workers:"opendiscord:autodelete-disable"}, "opendiscord:autodelete-disable":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,reason:string|null},workers:"opendiscord:autodelete-disable"},
"opendiscord:topic-set":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,topic:string},workers:"opendiscord:topic-set"},
"opendiscord:priority-set":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,priority:ODPriority,reason:string|null},workers:"opendiscord:priority-set"}, "opendiscord:priority-set":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,priority:ODPriority,reason:string|null},workers:"opendiscord:priority-set"},
"opendiscord:priority-get":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,priority:ODPriority},workers:"opendiscord:priority-get"}, "opendiscord:priority-get":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,priority:ODPriority},workers:"opendiscord:priority-get"},
} }
@@ -431,6 +433,8 @@ export interface ODMessageManagerIds_Default {
"opendiscord:autodelete-enable":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,time:number,reason:string|null},workers:"opendiscord:autodelete-enable"}, "opendiscord:autodelete-enable":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,time:number,reason:string|null},workers:"opendiscord:autodelete-enable"},
"opendiscord:autoclose-disable":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,reason:string|null},workers:"opendiscord:autoclose-disable"}, "opendiscord:autoclose-disable":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,reason:string|null},workers:"opendiscord:autoclose-disable"},
"opendiscord:autodelete-disable":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,reason:string|null},workers:"opendiscord:autodelete-disable"}, "opendiscord:autodelete-disable":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,reason:string|null},workers:"opendiscord:autodelete-disable"},
"opendiscord:topic-set":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,topic:string},workers:"opendiscord:topic-set"},
"opendiscord:priority-set":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,priority:ODPriority,reason:string|null},workers:"opendiscord:priority-set"}, "opendiscord:priority-set":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,priority:ODPriority,reason:string|null},workers:"opendiscord:priority-set"},
"opendiscord:priority-get":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,priority:ODPriority},workers:"opendiscord:priority-get"}, "opendiscord:priority-get":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,priority:ODPriority},workers:"opendiscord:priority-get"},
} }
+2
View File
@@ -50,6 +50,7 @@ export interface ODSlashCommandManagerIds_Default {
"opendiscord:clear":ODSlashCommand, "opendiscord:clear":ODSlashCommand,
"opendiscord:autoclose":ODSlashCommand, "opendiscord:autoclose":ODSlashCommand,
"opendiscord:autodelete":ODSlashCommand, "opendiscord:autodelete":ODSlashCommand,
"opendiscord:topic":ODSlashCommand,
"opendiscord:priority":ODSlashCommand, "opendiscord:priority":ODSlashCommand,
} }
@@ -121,6 +122,7 @@ export interface ODTextCommandManagerIds_Default {
"opendiscord:autoclose-enable":ODTextCommand, "opendiscord:autoclose-enable":ODTextCommand,
"opendiscord:autodelete-disable":ODTextCommand, "opendiscord:autodelete-disable":ODTextCommand,
"opendiscord:autodelete-enable":ODTextCommand, "opendiscord:autodelete-enable":ODTextCommand,
"opendiscord:topic-set":ODTextCommand,
"opendiscord:priority-set":ODTextCommand, "opendiscord:priority-set":ODTextCommand,
"opendiscord:priority-get":ODTextCommand, "opendiscord:priority-get":ODTextCommand,
} }
+45
View File
@@ -555,6 +555,32 @@ export const loadAllSlashCommands = async () => {
} }
] ]
})) }))
//TOPIC
if (allowedCommands.includes("topic")) commands.add(new api.ODSlashCommand("opendiscord:topic",{
type:act.ChatInput,
name:"topic",
description:"Change the topic of the ticket channel.", //TODO TRANSLATION!!!
contexts:[discord.InteractionContextType.Guild],
integrationTypes:[discord.ApplicationIntegrationType.GuildInstall],
options:[
{
name:"set",
description:"Set the topic of the ticket channel to a specific value.", //TODO TRANSLATION!!!
type:acot.Subcommand,
options:[
{
name:"topic",
description:"The new topic of the channel.",
type:acot.String,
required:true
}
]
},
//TODO: list (v4.2)
]
}))
//PRIORITY //PRIORITY
if (allowedCommands.includes("priority")) commands.add(new api.ODSlashCommand("opendiscord:priority",{ if (allowedCommands.includes("priority")) commands.add(new api.ODSlashCommand("opendiscord:priority",{
type:act.ChatInput, type:act.ChatInput,
@@ -1093,6 +1119,25 @@ export const loadAllTextCommands = async () => {
} }
] ]
})) }))
//TOPIC
//TODO: topic list (v4.2)
if (allowedCommands.includes("topic")) commands.add(new api.ODTextCommand("opendiscord:topic-set",{
name:"topic set",
prefix,
dmPermission:false,
guildPermission:true,
allowBots:false,
options:[
{
name:"topic",
type:"string",
required:true,
allowSpaces:true
}
]
}))
//PRIORITY //PRIORITY
//TODO: priority list (v4.2) //TODO: priority list (v4.2)
if (allowedCommands.includes("priority")) commands.add(new api.ODTextCommand("opendiscord:priority-set",{ if (allowedCommands.includes("priority")) commands.add(new api.ODTextCommand("opendiscord:priority-set",{
+16 -8
View File
@@ -207,13 +207,13 @@ export const loadAllHelpMenuComponents = async () => {
const advanced = helpmenu.get("opendiscord:advanced") const advanced = helpmenu.get("opendiscord:advanced")
if (advanced){ if (advanced){
if (allowedCommands.includes("stats")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:stats-global",5,{ if (allowedCommands.includes("stats")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:stats-global",9,{
textName:prefix+"stats global", textName:prefix+"stats global",
textDescription:lang.getTranslation("commands.statsGlobal"), textDescription:lang.getTranslation("commands.statsGlobal"),
slashName:"/stats global", slashName:"/stats global",
slashDescription:lang.getTranslation("commands.statsGlobal") slashDescription:lang.getTranslation("commands.statsGlobal")
})) }))
if (allowedCommands.includes("stats")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:stats-ticket",4,{ if (allowedCommands.includes("stats")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:stats-ticket",8,{
textName:prefix+"stats ticket", textName:prefix+"stats ticket",
textDescription:lang.getTranslation("commands.statsTicket"), textDescription:lang.getTranslation("commands.statsTicket"),
slashName:"/stats ticket", slashName:"/stats ticket",
@@ -221,7 +221,7 @@ export const loadAllHelpMenuComponents = async () => {
textOptions:[{name:"ticket",optional:false}], textOptions:[{name:"ticket",optional:false}],
slashOptions:[{name:"ticket",optional:false}] slashOptions:[{name:"ticket",optional:false}]
})) }))
if (allowedCommands.includes("stats")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:stats-user",2,{ if (allowedCommands.includes("stats")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:stats-user",7,{
textName:prefix+"stats user", textName:prefix+"stats user",
textDescription:lang.getTranslation("commands.statsUser"), textDescription:lang.getTranslation("commands.statsUser"),
slashName:"/stats user", slashName:"/stats user",
@@ -229,7 +229,7 @@ export const loadAllHelpMenuComponents = async () => {
textOptions:[{name:"user",optional:false}], textOptions:[{name:"user",optional:false}],
slashOptions:[{name:"user",optional:false}] slashOptions:[{name:"user",optional:false}]
})) }))
if (allowedCommands.includes("stats")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:stats-reset",2,{ if (allowedCommands.includes("stats")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:stats-reset",6,{
textName:prefix+"stats reset", textName:prefix+"stats reset",
textDescription:lang.getTranslation("commands.statsReset"), textDescription:lang.getTranslation("commands.statsReset"),
slashName:"/stats reset", slashName:"/stats reset",
@@ -237,7 +237,7 @@ export const loadAllHelpMenuComponents = async () => {
textOptions:[{name:"reason",optional:true}], textOptions:[{name:"reason",optional:true}],
slashOptions:[{name:"reason",optional:true}] slashOptions:[{name:"reason",optional:true}]
})) }))
if (allowedCommands.includes("autoclose")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:autoclose-disable",1,{ if (allowedCommands.includes("autoclose")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:autoclose-disable",5,{
textName:prefix+"autoclose disable", textName:prefix+"autoclose disable",
textDescription:lang.getTranslation("commands.autocloseDisable"), textDescription:lang.getTranslation("commands.autocloseDisable"),
slashName:"/autoclose disable", slashName:"/autoclose disable",
@@ -245,7 +245,7 @@ export const loadAllHelpMenuComponents = async () => {
textOptions:[{name:"reason",optional:true}], textOptions:[{name:"reason",optional:true}],
slashOptions:[{name:"reason",optional:true}] slashOptions:[{name:"reason",optional:true}]
})) }))
if (allowedCommands.includes("autoclose")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:autoclose-enable",0,{ if (allowedCommands.includes("autoclose")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:autoclose-enable",4,{
textName:prefix+"autoclose enable", textName:prefix+"autoclose enable",
textDescription:lang.getTranslation("commands.autocloseEnable"), textDescription:lang.getTranslation("commands.autocloseEnable"),
slashName:"/autoclose enable", slashName:"/autoclose enable",
@@ -253,7 +253,7 @@ export const loadAllHelpMenuComponents = async () => {
textOptions:[{name:"time",optional:false},{name:"reason",optional:true}], textOptions:[{name:"time",optional:false},{name:"reason",optional:true}],
slashOptions:[{name:"time",optional:false},{name:"reason",optional:true}] slashOptions:[{name:"time",optional:false},{name:"reason",optional:true}]
})) }))
if (allowedCommands.includes("autodelete")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:autodelete-disable",1,{ if (allowedCommands.includes("autodelete")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:autodelete-disable",3,{
textName:prefix+"autodelete disable", textName:prefix+"autodelete disable",
textDescription:lang.getTranslation("commands.autodeleteDisable"), textDescription:lang.getTranslation("commands.autodeleteDisable"),
slashName:"/autodelete disable", slashName:"/autodelete disable",
@@ -261,7 +261,7 @@ export const loadAllHelpMenuComponents = async () => {
textOptions:[{name:"reason",optional:true}], textOptions:[{name:"reason",optional:true}],
slashOptions:[{name:"reason",optional:true}] slashOptions:[{name:"reason",optional:true}]
})) }))
if (allowedCommands.includes("autodelete")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:autodelete-enable",0,{ if (allowedCommands.includes("autodelete")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:autodelete-enable",2,{
textName:prefix+"autodelete enable", textName:prefix+"autodelete enable",
textDescription:lang.getTranslation("commands.autodeleteEnable"), textDescription:lang.getTranslation("commands.autodeleteEnable"),
slashName:"/autodelete enable", slashName:"/autodelete enable",
@@ -269,6 +269,14 @@ export const loadAllHelpMenuComponents = async () => {
textOptions:[{name:"time",optional:false},{name:"reason",optional:true}], textOptions:[{name:"time",optional:false},{name:"reason",optional:true}],
slashOptions:[{name:"time",optional:false},{name:"reason",optional:true}] slashOptions:[{name:"time",optional:false},{name:"reason",optional:true}]
})) }))
if (allowedCommands.includes("topic")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:topic-set",1,{
textName:prefix+"topic set",
textDescription:"Change the topic of the ticket channel.", //TODO TRANSLATION!!!
slashName:"/topic set",
slashDescription:"Change the topic of the ticket channel.", //TODO TRANSLATION!!!
textOptions:[{name:"topic",optional:false}],
slashOptions:[{name:"topic",optional:false}]
}))
if (allowedCommands.includes("priority")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:priority-set",0,{ if (allowedCommands.includes("priority")) advanced.add(new api.ODHelpMenuCommandComponent("opendiscord:priority-set",0,{
textName:prefix+"priority set", textName:prefix+"priority set",
textDescription:"Set the priority of the ticket channel.", //TODO TRANSLATION!!! textDescription:"Set the priority of the ticket channel.", //TODO TRANSLATION!!!