BREAKING: changed all ids to "opendiscord:"

This commit is contained in:
DJj123dj
2025-02-01 10:29:35 +01:00
parent 29f8e1452c
commit 6acbf74846
101 changed files with 3736 additions and 3739 deletions
+17 -17
View File
@@ -4,21 +4,21 @@
import {opendiscord, api, utilities} from "../index"
import * as discord from "discord.js"
const generalConfig = opendiscord.configs.get("openticket:general")
const generalConfig = opendiscord.configs.get("opendiscord:general")
export const registerActions = async () => {
opendiscord.actions.add(new api.ODAction("openticket:add-ticket-user"))
opendiscord.actions.get("openticket:add-ticket-user").workers.add([
new api.ODWorker("openticket:add-ticket-user",2,async (instance,params,source,cancel) => {
opendiscord.actions.add(new api.ODAction("opendiscord:add-ticket-user"))
opendiscord.actions.get("opendiscord:add-ticket-user").workers.add([
new api.ODWorker("opendiscord:add-ticket-user",2,async (instance,params,source,cancel) => {
const {guild,channel,user,ticket,reason,data} = params
if (channel.isThread()) throw new api.ODSystemError("Unable to add user to ticket! Open Ticket doesn't support threads!")
await opendiscord.events.get("onTicketUserAdd").emit([ticket,user,data,channel,reason])
//update ticket
ticket.get("openticket:participants").value.push({type:"user",id:data.id})
ticket.get("openticket:participants").refreshDatabase()
ticket.get("openticket:busy").value = true
ticket.get("opendiscord:participants").value.push({type:"user",id:data.id})
ticket.get("opendiscord:participants").refreshDatabase()
ticket.get("opendiscord:busy").value = true
//update channel permissions
try{
@@ -38,7 +38,7 @@ export const registerActions = async () => {
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
if (ticketMessage){
try{
ticketMessage.edit((await opendiscord.builders.messages.getSafe("openticket:ticket-message").build("other",{guild,channel,user,ticket})).message)
ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
}catch(e){
opendiscord.log("Unable to edit ticket message on ticket user adding!","error",[
{key:"channel",value:"#"+channel.name},
@@ -51,24 +51,24 @@ export const registerActions = async () => {
}
//reply with new message
if (params.sendMessage) await channel.send((await opendiscord.builders.messages.getSafe("openticket:add-message").build(source,{guild,channel,user,ticket,reason,data})).message)
ticket.get("openticket:busy").value = false
if (params.sendMessage) await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:add-message").build(source,{guild,channel,user,ticket,reason,data})).message)
ticket.get("opendiscord:busy").value = false
await opendiscord.events.get("afterTicketUserAdded").emit([ticket,user,data,channel,reason])
}),
new api.ODWorker("openticket:discord-logs",1,async (instance,params,source,cancel) => {
new api.ODWorker("opendiscord:discord-logs",1,async (instance,params,source,cancel) => {
const {guild,channel,user,ticket,reason,data} = params
//to logs
if (generalConfig.data.system.logs.enabled && generalConfig.data.system.messages.adding.logs){
const logChannel = opendiscord.posts.get("openticket:logs")
if (logChannel) logChannel.send(await opendiscord.builders.messages.getSafe("openticket:ticket-action-logs").build(source,{guild,channel,user,ticket,mode:"add",reason,additionalData:data}))
const logChannel = opendiscord.posts.get("opendiscord:logs")
if (logChannel) logChannel.send(await opendiscord.builders.messages.getSafe("opendiscord:ticket-action-logs").build(source,{guild,channel,user,ticket,mode:"add",reason,additionalData:data}))
}
//to dm
const creator = await opendiscord.tickets.getTicketUser(ticket,"creator")
if (creator && generalConfig.data.system.messages.adding.dm) await opendiscord.client.sendUserDm(creator,await opendiscord.builders.messages.getSafe("openticket:ticket-action-dm").build(source,{guild,channel,user,ticket,mode:"add",reason,additionalData:data}))
if (creator && generalConfig.data.system.messages.adding.dm) await opendiscord.client.sendUserDm(creator,await opendiscord.builders.messages.getSafe("opendiscord:ticket-action-dm").build(source,{guild,channel,user,ticket,mode:"add",reason,additionalData:data}))
}),
new api.ODWorker("openticket:logs",0,(instance,params,source,cancel) => {
new api.ODWorker("opendiscord:logs",0,(instance,params,source,cancel) => {
const {guild,channel,user,ticket,data} = params
opendiscord.log(user.displayName+" added "+data.displayName+" to a ticket!","info",[
@@ -81,8 +81,8 @@ export const registerActions = async () => {
])
})
])
opendiscord.actions.get("openticket:add-ticket-user").workers.backupWorker = new api.ODWorker("openticket:cancel-busy",0,(instance,params) => {
opendiscord.actions.get("opendiscord:add-ticket-user").workers.backupWorker = new api.ODWorker("opendiscord:cancel-busy",0,(instance,params) => {
//set busy to false in case of crash or cancel
params.ticket.get("openticket:busy").value = false
params.ticket.get("opendiscord:busy").value = false
})
}