BREAKING: changed openticket to opendiscord in API

This commit is contained in:
DJj123dj
2025-02-01 10:22:27 +01:00
parent ce242741cd
commit 29f8e1452c
103 changed files with 2160 additions and 2175 deletions
+10 -10
View File
@@ -1,41 +1,41 @@
///////////////////////////////////////
//ROLE BUTTON (not command)
///////////////////////////////////////
import {openticket, api, utilities} from "../index"
import {opendiscord, api, utilities} from "../index"
import * as discord from "discord.js"
const generalConfig = openticket.configs.get("openticket:general")
const generalConfig = opendiscord.configs.get("openticket:general")
export const registerButtonResponders = async () => {
//ROLE OPTION BUTTON RESPONDER
openticket.responders.buttons.add(new api.ODButtonResponder("openticket:role-option",/^od:role-option_/))
openticket.responders.buttons.get("openticket:role-option").workers.add(
opendiscord.responders.buttons.add(new api.ODButtonResponder("openticket:role-option",/^od:role-option_/))
opendiscord.responders.buttons.get("openticket:role-option").workers.add(
new api.ODWorker("openticket:role-option",0,async (instance,params,source,cancel) => {
const {guild,channel,user} = instance
if (!guild){
//error
instance.reply(await openticket.builders.messages.getSafe("openticket:error-not-in-guild").build(source,{channel:instance.channel,user:instance.user}))
instance.reply(await opendiscord.builders.messages.getSafe("openticket:error-not-in-guild").build(source,{channel:instance.channel,user:instance.user}))
return cancel()
}
//get option
const optionId = instance.interaction.customId.split("_")[2]
const option = openticket.options.get(optionId)
const option = opendiscord.options.get(optionId)
if (!option || !(option instanceof api.ODRoleOption)){
//error
instance.reply(await openticket.builders.messages.getSafe("openticket:error-option-unknown").build(source,{guild:instance.guild,channel:instance.channel,user:instance.user}))
instance.reply(await opendiscord.builders.messages.getSafe("openticket:error-option-unknown").build(source,{guild:instance.guild,channel:instance.channel,user:instance.user}))
return cancel()
}
//reaction role
await instance.defer("reply",true)
const res = await openticket.actions.get("openticket:reaction-role").run("panel-button",{guild,user,option,overwriteMode:null})
const res = await opendiscord.actions.get("openticket:reaction-role").run("panel-button",{guild,user,option,overwriteMode:null})
if (!res.result || !res.role){
//error
await instance.reply(await openticket.builders.messages.getSafe("openticket:error").build(source,{guild,channel:instance.channel,user,error:"Unable to receive role update data from worker!",layout:"advanced"}))
await instance.reply(await opendiscord.builders.messages.getSafe("openticket:error").build(source,{guild,channel:instance.channel,user,error:"Unable to receive role update data from worker!",layout:"advanced"}))
return cancel()
}
if (generalConfig.data.system.replyOnReactionRole) await instance.reply(await openticket.builders.messages.getSafe("openticket:reaction-role").build("panel-button",{guild,user,role:res.role,result:res.result}))
if (generalConfig.data.system.replyOnReactionRole) await instance.reply(await opendiscord.builders.messages.getSafe("openticket:reaction-role").build("panel-button",{guild,user,role:res.role,result:res.result}))
})
)
}