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
+49 -49
View File
@@ -4,22 +4,22 @@
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:create-ticket"))
opendiscord.actions.get("openticket:create-ticket").workers.add([
new api.ODWorker("openticket:create-ticket",3,async (instance,params,source,cancel) => {
opendiscord.actions.add(new api.ODAction("opendiscord:create-ticket"))
opendiscord.actions.get("opendiscord:create-ticket").workers.add([
new api.ODWorker("opendiscord:create-ticket",3,async (instance,params,source,cancel) => {
const {guild,user,answers,option} = params
await opendiscord.events.get("onTicketCreate").emit([user])
await opendiscord.events.get("onTicketChannelCreation").emit([option,user])
//get channel properties
const channelPrefix = option.get("openticket:channel-prefix").value
const channelCategory = option.get("openticket:channel-category").value
const channelBackupCategory = option.get("openticket:channel-category-backup").value
const channelDescription = option.get("openticket:channel-description").value
const channelPrefix = option.get("opendiscord:channel-prefix").value
const channelCategory = option.get("opendiscord:channel-category").value
const channelBackupCategory = option.get("opendiscord:channel-category-backup").value
const channelDescription = option.get("opendiscord:channel-description").value
const channelSuffix = opendiscord.options.suffix.getSuffixFromOption(option,user)
const channelName = channelPrefix+channelSuffix
@@ -65,9 +65,9 @@ export const registerActions = async () => {
allow:[],
deny:["ViewChannel","SendMessages","ReadMessageHistory"]
}]
const globalAdmins = opendiscord.configs.get("openticket:general").data.globalAdmins
const optionAdmins = option.get("openticket:admins").value
const readonlyAdmins = option.get("openticket:admins-readonly").value
const globalAdmins = opendiscord.configs.get("opendiscord:general").data.globalAdmins
const optionAdmins = option.get("opendiscord:admins").value
const readonlyAdmins = option.get("opendiscord:admins-readonly").value
globalAdmins.forEach((admin) => {
permissions.push({
@@ -127,40 +127,40 @@ export const registerActions = async () => {
//create ticket
const ticket = new api.ODTicket(channel.id,option,[
new api.ODTicketData("openticket:busy",false),
new api.ODTicketData("openticket:ticket-message",null),
new api.ODTicketData("openticket:participants",participants),
new api.ODTicketData("openticket:channel-suffix",channelSuffix),
new api.ODTicketData("opendiscord:busy",false),
new api.ODTicketData("opendiscord:ticket-message",null),
new api.ODTicketData("opendiscord:participants",participants),
new api.ODTicketData("opendiscord:channel-suffix",channelSuffix),
new api.ODTicketData("openticket:open",true),
new api.ODTicketData("openticket:opened-by",user.id),
new api.ODTicketData("openticket:opened-on",new Date().getTime()),
new api.ODTicketData("openticket:closed",false),
new api.ODTicketData("openticket:closed-by",null),
new api.ODTicketData("openticket:closed-on",null),
new api.ODTicketData("openticket:claimed",false),
new api.ODTicketData("openticket:claimed-by",null),
new api.ODTicketData("openticket:claimed-on",null),
new api.ODTicketData("openticket:pinned",false),
new api.ODTicketData("openticket:pinned-by",null),
new api.ODTicketData("openticket:pinned-on",null),
new api.ODTicketData("openticket:for-deletion",false),
new api.ODTicketData("opendiscord:open",true),
new api.ODTicketData("opendiscord:opened-by",user.id),
new api.ODTicketData("opendiscord:opened-on",new Date().getTime()),
new api.ODTicketData("opendiscord:closed",false),
new api.ODTicketData("opendiscord:closed-by",null),
new api.ODTicketData("opendiscord:closed-on",null),
new api.ODTicketData("opendiscord:claimed",false),
new api.ODTicketData("opendiscord:claimed-by",null),
new api.ODTicketData("opendiscord:claimed-on",null),
new api.ODTicketData("opendiscord:pinned",false),
new api.ODTicketData("opendiscord:pinned-by",null),
new api.ODTicketData("opendiscord:pinned-on",null),
new api.ODTicketData("opendiscord:for-deletion",false),
new api.ODTicketData("openticket:category",category),
new api.ODTicketData("openticket:category-mode",categoryMode),
new api.ODTicketData("opendiscord:category",category),
new api.ODTicketData("opendiscord:category-mode",categoryMode),
new api.ODTicketData("openticket:autoclose-enabled",option.get("openticket:autoclose-enable-hours").value),
new api.ODTicketData("openticket:autoclose-hours",(option.get("openticket:autoclose-enable-hours").value ? option.get("openticket:autoclose-hours").value : 0)),
new api.ODTicketData("openticket:autoclosed",false),
new api.ODTicketData("openticket:autodelete-enabled",option.get("openticket:autodelete-enable-days").value),
new api.ODTicketData("openticket:autodelete-days",(option.get("openticket:autodelete-enable-days").value ? option.get("openticket:autodelete-days").value : 0)),
new api.ODTicketData("opendiscord:autoclose-enabled",option.get("opendiscord:autoclose-enable-hours").value),
new api.ODTicketData("opendiscord:autoclose-hours",(option.get("opendiscord:autoclose-enable-hours").value ? option.get("opendiscord:autoclose-hours").value : 0)),
new api.ODTicketData("opendiscord:autoclosed",false),
new api.ODTicketData("opendiscord:autodelete-enabled",option.get("opendiscord:autodelete-enable-days").value),
new api.ODTicketData("opendiscord:autodelete-days",(option.get("opendiscord:autodelete-enable-days").value ? option.get("opendiscord:autodelete-days").value : 0)),
new api.ODTicketData("openticket:answers",answers)
new api.ODTicketData("opendiscord:answers",answers)
])
//manage stats
await opendiscord.stats.get("openticket:global").setStat("openticket:tickets-created",1,"increase")
await opendiscord.stats.get("openticket:user").setStat("openticket:tickets-created",user.id,1,"increase")
await opendiscord.stats.get("opendiscord:global").setStat("opendiscord:tickets-created",1,"increase")
await opendiscord.stats.get("opendiscord:user").setStat("opendiscord:tickets-created",user.id,1,"increase")
//manage bot permissions
await opendiscord.events.get("onTicketPermissionsCreated").emit([option,opendiscord.permissions,channel,user])
@@ -172,7 +172,7 @@ export const registerActions = async () => {
instance.ticket = ticket
opendiscord.tickets.add(ticket)
}),
new api.ODWorker("openticket:send-ticket-message",2,async (instance,params,source,cancel) => {
new api.ODWorker("opendiscord:send-ticket-message",2,async (instance,params,source,cancel) => {
const {guild,user,answers,option} = params
const {ticket,channel} = instance
@@ -180,37 +180,37 @@ export const registerActions = async () => {
await opendiscord.events.get("onTicketMainMessageCreated").emit([ticket,channel,user])
//check if ticket message is enabled
if (!option.get("openticket:ticket-message-enabled").value) return
if (!option.get("opendiscord:ticket-message-enabled").value) return
try {
const msg = await channel.send((await opendiscord.builders.messages.getSafe("openticket:ticket-message").build(source,{guild,channel,user,ticket})).message)
const msg = await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build(source,{guild,channel,user,ticket})).message)
ticket.get("openticket:ticket-message").value = msg.id
ticket.get("opendiscord:ticket-message").value = msg.id
//manage stats
await opendiscord.stats.get("openticket:ticket").setStat("openticket:messages-sent",ticket.id.value,1,"increase")
await opendiscord.stats.get("opendiscord:ticket").setStat("opendiscord:messages-sent",ticket.id.value,1,"increase")
await opendiscord.events.get("afterTicketMainMessageCreated").emit([ticket,msg,channel,user])
}catch(err){
process.emit("uncaughtException",err)
//something went wrong while sending the ticket message
channel.send((await opendiscord.builders.messages.getSafe("openticket:error").build("other",{guild,channel,user,error:"Ticket Message: Creation Error!\n=> Ticket Is Still Created Succesfully",layout:"advanced"})).message)
channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error").build("other",{guild,channel,user,error:"Ticket Message: Creation Error!\n=> Ticket Is Still Created Succesfully",layout:"advanced"})).message)
}
await opendiscord.events.get("afterTicketCreated").emit([ticket,user,channel])
}),
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,user,answers,option} = params
const {ticket,channel} = instance
//to logs
if (generalConfig.data.system.logs.enabled && generalConfig.data.system.messages.creation.logs){
const logChannel = opendiscord.posts.get("openticket:logs")
if (logChannel) logChannel.send(await opendiscord.builders.messages.getSafe("openticket:ticket-created-logs").build(source,{guild,channel,user,ticket}))
const logChannel = opendiscord.posts.get("opendiscord:logs")
if (logChannel) logChannel.send(await opendiscord.builders.messages.getSafe("opendiscord:ticket-created-logs").build(source,{guild,channel,user,ticket}))
}
//to dm
if (generalConfig.data.system.messages.creation.dm) await opendiscord.client.sendUserDm(user,await opendiscord.builders.messages.getSafe("openticket:ticket-created-dm").build(source,{guild,channel,user,ticket}))
if (generalConfig.data.system.messages.creation.dm) await opendiscord.client.sendUserDm(user,await opendiscord.builders.messages.getSafe("opendiscord:ticket-created-dm").build(source,{guild,channel,user,ticket}))
}),
new api.ODWorker("openticket:logs",0,(instance,params,source,cancel) => {
new api.ODWorker("opendiscord:logs",0,(instance,params,source,cancel) => {
const {guild,user,answers,option} = params
const {ticket,channel} = instance