diff --git a/package.json b/package.json index 066e1b6..d575f2d 100644 --- a/package.json +++ b/package.json @@ -26,12 +26,12 @@ "license": "GPL-3.0-only", "dependencies": { "@discordjs/rest": "^2.6.1", - "@open-discord-bots/framework": "^0.2.17", + "@open-discord-bots/framework": "^0.3.2", "@types/node": "^22.5.0", "@types/terminal-kit": "^2.5.7", "ansis": "^4.2.0", "discord.js": "^14.26.3", - "formatted-json-stringify": "^1.3.0", + "formatted-json-stringify": "^1.3.1", "terminal-kit": "^3.1.2", "typescript": "^6.0.3" }, diff --git a/src/actions/createTranscript.ts b/src/actions/createTranscript.ts index a1369d5..23c9a90 100644 --- a/src/actions/createTranscript.ts +++ b/src/actions/createTranscript.ts @@ -137,7 +137,7 @@ export const registerActions = async () => { if (transcriptConfig.data.general.enableChannel && channelMessage){ if (instance.pendingMessage && instance.pendingMessage.message && instance.pendingMessage.success){ //edit "pending" message to be the "ready" message - instance.pendingMessage.message.edit(channelMessage.message) + instance.pendingMessage.message.edit(utilities.getMessageFromBuildResult(channelMessage,"message")) }else{ //send ready message to channel const post = opendiscord.posts.get("opendiscord:transcripts") diff --git a/src/core/api/blacklist.ts b/src/core/api/blacklist.ts index ea349b3..391f526 100644 --- a/src/core/api/blacklist.ts +++ b/src/core/api/blacklist.ts @@ -12,20 +12,20 @@ import * as api from "@open-discord-bots/framework/api" */ export class ODBlacklist extends api.ODManagerData { /**The reason why this user got blacklisted. (optional) */ - #reason: string|null + private rawReason: string|null constructor(id:api.ODValidId,reason:string|null){ super(id) - this.#reason = reason + this.rawReason = reason } /**The reason why this user got blacklisted. (optional) */ set reason(reason:string|null) { - this.#reason = reason + this.rawReason = reason this._change() } get reason(){ - return this.#reason + return this.rawReason } } diff --git a/src/core/api/option.ts b/src/core/api/option.ts index db30ba0..6d716ad 100644 --- a/src/core/api/option.ts +++ b/src/core/api/option.ts @@ -15,19 +15,16 @@ import { ODRoleUpdateMode } from "./role.js" * All option types including: tickets, websites & reaction roles are stored here. */ export class ODOptionManager extends api.ODManager { - /**A reference to the Open Ticket debugger. */ - #debug: api.ODDebugger /**The option suffix manager used to generate channel suffixes for ticket names. */ suffix: ODOptionSuffixManager constructor(debug:api.ODDebugger){ super(debug,"option") - this.#debug = debug this.suffix = new ODOptionSuffixManager(debug) } add(data:ODOption, overwrite?:boolean): boolean { - data.useDebug(this.#debug,"option data") + data.useDebug(this.debug,"option data") return super.add(data,overwrite) } } @@ -110,20 +107,20 @@ export class ODOption extends api.ODManager> { */ export class ODOptionData extends api.ODManagerData { /**The value of this property. */ - #value: DataType + private rawValue: DataType constructor(id:api.ODValidId, value:DataType){ super(id) - this.#value = value + this.rawValue = value } /**The value of this property. */ set value(value:DataType){ - this.#value = value + this.rawValue = value this._change() } get value(): DataType { - return this.#value + return this.rawValue } /**Refresh the database. Is only required to be used when updating `ODOptionData` with an object/array as value. */ refreshDatabase(){ @@ -355,7 +352,7 @@ export class ODOptionSuffixManager extends api.ODManager { const suffix = this.getAll().find((suffix) => suffix.option.id.value == option.id.value) if (!suffix) return null try{ - const member = await this.#getMember(guild,user) + const member = await this.getMember(guild,user) if (!member) return null return await suffix.getSuffix(member) }catch(err){ @@ -363,7 +360,7 @@ export class ODOptionSuffixManager extends api.ODManager { return null } } - async #getMember(guild:discord.Guild,user:discord.User){ + private async getMember(guild:discord.Guild,user:discord.User){ try{ return await guild.members.fetch(user.id) }catch{ @@ -447,11 +444,11 @@ export class ODOptionCounterDynamicSuffix extends ODOptionSuffix { constructor(id:api.ODValidId, option:ODTicketOption, database:api.ODDatabase){ super(id,option) this.database = database - this.#init() + this.init() } /**Initialize the database for this suffix. */ - async #init(){ + private async init(){ if (!await this.database.exists("opendiscord:option-suffix-counter",this.option.id.value)) await this.database.set("opendiscord:option-suffix-counter",this.option.id.value,0) } async getSuffix(member:discord.GuildMember): Promise { @@ -477,11 +474,11 @@ export class ODOptionCounterFixedSuffix extends ODOptionSuffix { constructor(id:api.ODValidId, option:ODTicketOption, database:api.ODDatabase){ super(id,option) this.database = database - this.#init() + this.init() } /**Initialize the database for this suffix. */ - async #init(){ + private async init(){ if (!await this.database.exists("opendiscord:option-suffix-counter",this.option.id.value)) await this.database.set("opendiscord:option-suffix-counter",this.option.id.value,0) } async getSuffix(member:discord.GuildMember): Promise { @@ -511,28 +508,28 @@ export class ODOptionRandomNumberSuffix extends ODOptionSuffix { constructor(id:api.ODValidId, option:ODTicketOption, database:api.ODDatabase){ super(id,option) this.database = database - this.#init() + this.init() } /**Initialize the database for this suffix. */ - async #init(){ + private async init(){ if (!await this.database.exists("opendiscord:option-suffix-history",this.option.id.value)) await this.database.set("opendiscord:option-suffix-history",this.option.id.value,[]) } /**Get a unique number for this suffix. */ - #generateUniqueValue(history:string[]): string { + protected generateUniqueValue(history:string[]): string { const rawNumber = Math.round(Math.random()*1000).toString() let number = rawNumber if (rawNumber.length == 1) number = "000"+rawNumber else if (rawNumber.length == 2) number = "00"+rawNumber else if (rawNumber.length == 3) number = "0"+rawNumber - if (history.includes(number)) return this.#generateUniqueValue(history) + if (history.includes(number)) return this.generateUniqueValue(history) else return number } async getSuffix(member:discord.GuildMember): Promise { const rawCurrentValues = await this.database.get("opendiscord:option-suffix-history",this.option.id.value) const currentValues = ((Array.isArray(rawCurrentValues)) ? rawCurrentValues : []) as string[] - const newValue = this.#generateUniqueValue(currentValues) + const newValue = this.generateUniqueValue(currentValues) currentValues.push(newValue) if (currentValues.length > 50) currentValues.shift() await this.database.set("opendiscord:option-suffix-history",this.option.id.value,currentValues) @@ -554,23 +551,23 @@ export class ODOptionRandomHexSuffix extends ODOptionSuffix { constructor(id:api.ODValidId, option:ODTicketOption, database:api.ODDatabase){ super(id,option) this.database = database - this.#init() + this.init() } /**Initialize the database for this suffix. */ - async #init(){ + private async init(){ if (!await this.database.exists("opendiscord:option-suffix-history",this.option.id.value)) await this.database.set("opendiscord:option-suffix-history",this.option.id.value,[]) } /**Get a unique hex-string for this suffix. */ - #generateUniqueValue(history:string[]): string { + protected generateUniqueValue(history:string[]): string { const hex = crypto.randomBytes(2).toString("hex") - if (history.includes(hex)) return this.#generateUniqueValue(history) + if (history.includes(hex)) return this.generateUniqueValue(history) else return hex } async getSuffix(member:discord.GuildMember): Promise { const rawCurrentValues = await this.database.get("opendiscord:option-suffix-history",this.option.id.value) const currentValues = ((Array.isArray(rawCurrentValues)) ? rawCurrentValues : []) as string[] - const newValue = this.#generateUniqueValue(currentValues) + const newValue = this.generateUniqueValue(currentValues) currentValues.push(newValue) if (currentValues.length > 50) currentValues.shift() await this.database.set("opendiscord:option-suffix-history",this.option.id.value,currentValues) diff --git a/src/core/api/panel.ts b/src/core/api/panel.ts index 8501a19..7ace69a 100644 --- a/src/core/api/panel.ts +++ b/src/core/api/panel.ts @@ -12,16 +12,12 @@ import { ODPanelsJsonConfig_PanelEmbedSettings } from "../mappings/config.js" * Panels are not stored in the database and will be parsed from the config every startup. */ export class ODPanelManager extends api.ODManager { - /**A reference to the Open Ticket debugger. */ - #debug: api.ODDebugger - constructor(debug:api.ODDebugger){ super(debug,"option") - this.#debug = debug } add(data:ODPanel, overwrite?:boolean): boolean { - data.useDebug(this.#debug,"option data") + data.useDebug(this.debug,"option data") return super.add(data,overwrite) } } @@ -141,20 +137,20 @@ export class ODPanel extends api.ODManager> { */ export class ODPanelData extends api.ODManagerData { /**The value of this property. */ - #value: DataType + private rawValue: DataType constructor(id:api.ODValidId, value:DataType){ super(id) - this.#value = value + this.rawValue = value } /**The value of this property. */ set value(value:DataType){ - this.#value = value + this.rawValue = value this._change() } get value(): DataType { - return this.#value + return this.rawValue } /**Refresh the database. Is only required to be used when updating `ODPanelData` with an object/array as value. */ refreshDatabase(){ diff --git a/src/core/api/priority.ts b/src/core/api/priority.ts index cddf87e..0ad414b 100644 --- a/src/core/api/priority.ts +++ b/src/core/api/priority.ts @@ -30,12 +30,8 @@ export interface ODPriorityManagerIdMappings extends ODPriorityManagerIdConstrai * Priorities levels can be changed/updated/translated by plugins to allow for more customisability. */ export class ODPriorityManager extends api.ODManager { - /**A reference to the Open Ticket debugger. */ - #debug: api.ODDebugger - constructor(debug:api.ODDebugger){ super(debug,"priority") - this.#debug = debug } /**Get an `ODPriorityLevel` from the priority level value. Returns a dummy value when the level doesn't exist. */ diff --git a/src/core/api/question.ts b/src/core/api/question.ts index 20ff80b..0f39781 100644 --- a/src/core/api/question.ts +++ b/src/core/api/question.ts @@ -11,16 +11,12 @@ import * as api from "@open-discord-bots/framework/api" * Questions are not stored in the database and will be parsed from the config every startup. */ export class ODQuestionManager extends api.ODManager { - /**A reference to the Open Ticket debugger. */ - #debug: api.ODDebugger - constructor(debug:api.ODDebugger){ super(debug,"question") - this.#debug = debug } add(data:ODQuestion, overwrite?:boolean): boolean { - data.useDebug(this.#debug,"question data") + data.useDebug(this.debug,"question data") return super.add(data,overwrite) } } @@ -103,20 +99,20 @@ export class ODQuestion extends api.ODManager extends api.ODManagerData { /**The value of this property. */ - #value: DataType + private rawValue: DataType constructor(id:api.ODValidId, value:DataType){ super(id) - this.#value = value + this.rawValue = value } /**The value of this property. */ set value(value:DataType){ - this.#value = value + this.rawValue = value this._change() } get value(): DataType { - return this.#value + return this.rawValue } /**Refresh the database. Is only required to be used when updating `ODQuestionData` with an object/array as value. */ refreshDatabase(){ diff --git a/src/core/api/role.ts b/src/core/api/role.ts index 4c5ffd7..be75349 100644 --- a/src/core/api/role.ts +++ b/src/core/api/role.ts @@ -12,16 +12,12 @@ import * as discord from "discord.js" * Roles are not stored in the database and will be parsed from the config every startup. */ export class ODRoleManager extends api.ODManager { - /**A reference to the Open Ticket debugger. */ - #debug: api.ODDebugger - constructor(debug:api.ODDebugger){ super(debug,"role") - this.#debug = debug } add(data:ODRole, overwrite?:boolean): boolean { - data.useDebug(this.#debug,"role data") + data.useDebug(this.debug,"role data") return super.add(data,overwrite) } } @@ -130,20 +126,20 @@ export class ODRole extends api.ODManager> { */ export class ODRoleData extends api.ODManagerData { /**The value of this property. */ - #value: DataType + private rawValue: DataType constructor(id:api.ODValidId, value:DataType){ super(id) - this.#value = value + this.rawValue = value } /**The value of this property. */ set value(value:DataType){ - this.#value = value + this.rawValue = value this._change() } get value(): DataType { - return this.#value + return this.rawValue } /**Refresh the database. Is only required to be used when updating `ODRoleData` with an object/array as value. */ refreshDatabase(){ diff --git a/src/core/api/ticket.ts b/src/core/api/ticket.ts index 512d53e..0129c2b 100644 --- a/src/core/api/ticket.ts +++ b/src/core/api/ticket.ts @@ -14,31 +14,28 @@ import * as discord from "discord.js" */ export class ODTicketManager extends api.ODManager { /**A reference to the main server of the bot */ - #guild: discord.Guild|null = null + private guild: discord.Guild|null = null /**A reference to the Open Ticket client manager. */ - #client: api.ODClientManager - /**A reference to the Open Ticket debugger. */ - #debug: api.ODDebugger + private client: api.ODClientManager constructor(debug:api.ODDebugger, client:api.ODClientManager){ super(debug,"ticket") - this.#debug = debug - this.#client = client + this.client = client } add(data:ODTicket, overwrite?:boolean): boolean { - data.useDebug(this.#debug,"ticket data") + data.useDebug(this.debug,"ticket data") return super.add(data,overwrite) } /**Use a specific guild in this class for fetching the channel*/ useGuild(guild:discord.Guild|null){ - this.#guild = guild + this.guild = guild } /**Get the discord channel for a specific ticket. */ async getTicketChannel(ticket:ODTicket): Promise { - if (!this.#guild) return null + if (!this.guild) return null try { - const channel = await this.#guild.channels.fetch(ticket.id.value) + const channel = await this.guild.channels.fetch(ticket.id.value) if (!channel || !channel.isTextBased()) return null return channel }catch{ @@ -48,7 +45,7 @@ export class ODTicketManager extends api.ODManager { /**Get the main ticket message of a ticket channel when found. */ async getTicketMessage(ticket:ODTicket): Promise|null> { const msgId = ticket.get("opendiscord:ticket-message").value - if (!this.#guild || !msgId) return null + if (!this.guild || !msgId) return null try { const channel = await this.getTicketChannel(ticket) if (!channel) return null @@ -59,34 +56,34 @@ export class ODTicketManager extends api.ODManager { } /**Shortcut for getting a discord.js user within a ticket. */ async getTicketUser(ticket:ODTicket, user:"creator"|"closer"|"claimer"|"pinner"): Promise { - if (!this.#guild) return null + if (!this.guild) return null try { if (user == "creator"){ const creatorId = ticket.get("opendiscord:opened-by").value if (!creatorId) return null - else return (await this.#guild.client.users.fetch(creatorId)) + else return (await this.guild.client.users.fetch(creatorId)) }else if (user == "closer"){ const closerId = ticket.get("opendiscord:closed-by").value if (!closerId) return null - else return (await this.#guild.client.users.fetch(closerId)) + else return (await this.guild.client.users.fetch(closerId)) }else if (user == "claimer"){ const claimerId = ticket.get("opendiscord:claimed-by").value if (!claimerId) return null - else return (await this.#guild.client.users.fetch(claimerId)) + else return (await this.guild.client.users.fetch(claimerId)) }else if (user == "pinner"){ const pinnerId = ticket.get("opendiscord:pinned-by").value if (!pinnerId) return null - else return (await this.#guild.client.users.fetch(pinnerId)) + else return (await this.guild.client.users.fetch(pinnerId)) }else return null }catch {return null} } /**Shortcut for getting all users that are able to view a ticket. */ async getAllTicketParticipants(ticket:ODTicket): Promise<{user:discord.User,role:"creator"|"participant"|"admin"}[]|null> { - if (!this.#guild) return null + if (!this.guild) return null const final: {user:discord.User,role:"creator"|"participant"|"admin"}[] = [] const channel = await this.getTicketChannel(ticket) if (!channel) return null @@ -94,7 +91,7 @@ export class ODTicketManager extends api.ODManager { //add creator const creatorId = ticket.get("opendiscord:opened-by").value if (creatorId){ - const creator = await this.#client.fetchUser(creatorId) + const creator = await this.client.fetchUser(creatorId) if (creator) final.push({user:creator,role:"creator"}) } @@ -102,7 +99,7 @@ export class ODTicketManager extends api.ODManager { const participants = ticket.get("opendiscord:participants").value.filter((p) => p.type == "user") for (const p of participants){ if (!final.find((u) => u.user.id == p.id)){ - const participant = await this.#client.fetchUser(p.id) + const participant = await this.client.fetchUser(p.id) if (participant) final.push({user:participant,role:"participant"}) } } @@ -110,7 +107,7 @@ export class ODTicketManager extends api.ODManager { //add admin roles const roles = ticket.get("opendiscord:participants").value.filter((p) => p.type == "role") for (const r of roles){ - const role = await this.#client.fetchGuildRole(channel.guild,r.id) + const role = await this.client.fetchGuildRole(channel.guild,r.id) if (role){ role.members.forEach((member) => { if (final.find((u) => u.user.id == member.id)) return @@ -201,25 +198,25 @@ export interface ODTicketIds { export class ODTicket extends api.ODManager> { /**The id of this ticket. (discord channel id) */ id:api.ODId - /**The option related to this ticket. */ - #option: ODTicketOption + /**The option this ticket is made of. */ + private rawOption: ODTicketOption constructor(id:api.ODValidId, option:ODTicketOption, data:ODTicketData[]){ super() this.id = new api.ODId(id) - this.#option = option + this.rawOption = option data.forEach((data) => { this.add(data) }) } - /**The option related to this ticket. */ + /**The option this ticket is made of. */ set option(option:ODTicketOption){ - this.#option = option + this.rawOption = option this._change() } get option(){ - return this.#option + return this.rawOption } /**Convert this ticket to a JSON object for storing this ticket in the database. */ @@ -275,20 +272,20 @@ export class ODTicket extends api.ODManager> { */ export class ODTicketData extends api.ODManagerData { /**The value of this property. */ - #value: DataType + private rawValue: DataType constructor(id:api.ODValidId, value:DataType){ super(id) - this.#value = value + this.rawValue = value } /**The value of this property. */ set value(value:DataType){ - this.#value = value + this.rawValue = value this._change() } get value(): DataType { - return this.#value + return this.rawValue } /**Refresh the database. Is only required to be used when updating `ODTicketData` with an object/array as value. */ refreshDatabase(){ diff --git a/src/core/api/transcript.ts b/src/core/api/transcript.ts index fff80fa..9e4615b 100644 --- a/src/core/api/transcript.ts +++ b/src/core/api/transcript.ts @@ -30,11 +30,11 @@ export class ODTranscriptManager { /**When not successfull, what was the reason? This will also be shown to the user. */ errorReason:string|null, /**An optional message which will be sent while the transcript is being generated. */ - pendingMessage:api.ODMessageBuildResult|null, + pendingMessage:api.ODMessageBuildResult|api.ODMessageComponentBuildResult|null, /**An optional object containing data from the init() function which can be used in the compiler. */ initData:InitData, } @@ -119,15 +119,15 @@ export interface ODTranscriptCompilerCompileResult { */ export interface ODTranscriptCompilerReadyResult { /**The message to be sent in the specified channel in the server. */ - channelMessage?:api.ODMessageBuildResult, + channelMessage?:api.ODMessageBuildResult|api.ODMessageComponentBuildResult, /**The message to be sent to the DM of the ticket creator. */ - creatorDmMessage?:api.ODMessageBuildResult, + creatorDmMessage?:api.ODMessageBuildResult|api.ODMessageComponentBuildResult, /**The message to be sent to the DM of all participants. */ - participantDmMessage?:api.ODMessageBuildResult, + participantDmMessage?:api.ODMessageBuildResult|api.ODMessageComponentBuildResult, /**The message to be sent to the DM of all admins who actively participated in the ticket. */ - activeAdminDmMessage?:api.ODMessageBuildResult, + activeAdminDmMessage?:api.ODMessageBuildResult|api.ODMessageComponentBuildResult, /**The message to be sent to the DM of all admins who were assigned to this ticket. */ - everyAdminDmMessage?:api.ODMessageBuildResult + everyAdminDmMessage?:api.ODMessageBuildResult|api.ODMessageComponentBuildResult } /**## ODTranscriptCompiler `class` @@ -162,22 +162,22 @@ export class ODTranscriptCompiler[]|null> { const newInclude: ODTranscriptCollectorIncludeSettings = include ?? {users:true,bots:true,client:true} - const channel = await this.#tickets.getTicketChannel(ticket) + const channel = await this.tickets.getTicketChannel(ticket) if (!channel) return null const final: discord.Message[] = [] @@ -213,7 +213,7 @@ export class ODTranscriptCollector { const {guild,channel,id,createdTimestamp} = msg //create message author - const author = this.#handleUserData(msg.author,msg.member) + const author = this.handleUserData(msg.author,msg.member) //create message type let type: ODTranscriptMessageType = "default" @@ -269,8 +269,8 @@ export class ODTranscriptCollector { disabled:component.disabled, type:"button", label:component.label, - emoji:this.#handleComponentEmoji(msg,component.emoji), - color:this.#handleButtonComponentStyle(component.style), + emoji:this.handleComponentEmoji(msg,component.emoji), + color:this.handleButtonComponentStyle(component.style), mode:(component.style == discord.ButtonStyle.Link) ? "url" : "button", url:component.url }) @@ -285,7 +285,7 @@ export class ODTranscriptCollector { id:option.value, label:option.label, description:option.description ?? null, - emoji:this.#handleComponentEmoji(msg,option.emoji ?? null) + emoji:this.handleComponentEmoji(msg,option.emoji ?? null) } }) }) @@ -303,7 +303,7 @@ export class ODTranscriptCollector { if (replyChannel && !replyChannel.isDMBased() && replyChannel.isTextBased()){ const replyMessage = await replyChannel.messages.fetch(msg.reference.messageId) if (replyMessage){ - const replyUser = this.#handleUserData(replyMessage.author,replyMessage.member) + const replyUser = this.handleUserData(replyMessage.author,replyMessage.member) reply = { type:"message", @@ -320,7 +320,7 @@ export class ODTranscriptCollector { }else if (msg.interactionMetadata){ try{ //get slash command name from undocumented property in discord REST API - const restMsg = await this.#client.rest.get(discord.Routes.channelMessage(msg.channelId,msg.id)) as discord.APIMessage & {interaction_metadata:{name:string}} + const restMsg = await this.client.rest.get(discord.Routes.channelMessage(msg.channelId,msg.id)) as discord.APIMessage & {interaction_metadata:{name:string}} const commandName = restMsg.interaction_metadata.name ?? "unknown-command" //slash command reply let member: discord.GuildMember|null = null @@ -330,7 +330,7 @@ export class ODTranscriptCollector { reply = { type:"interaction", name:commandName, - user:this.#handleUserData(msg.interactionMetadata.user,member) + user:this.handleUserData(msg.interactionMetadata.user,member) } }catch(err){ process.emit("uncaughtException",err) @@ -395,7 +395,7 @@ export class ODTranscriptCollector { else return {size:Math.round(bytes/(1024*1024*1024*1024)),unit:"TB"} } /**Get the `ODTranscriptEmojiData` from a discord.js component emoji. */ - #handleComponentEmoji(message:discord.Message, rawEmoji:discord.APIMessageComponentEmoji|null): ODTranscriptEmojiData|null { + private handleComponentEmoji(message:discord.Message, rawEmoji:discord.APIMessageComponentEmoji|null): ODTranscriptEmojiData|null { if (!rawEmoji) return null //return built-in emoji if (rawEmoji.name) return { @@ -418,14 +418,14 @@ export class ODTranscriptCollector { } } /**Create the `ODValidButtonColor` from the discord.js button style. */ - #handleButtonComponentStyle(style:discord.ButtonStyle): api.ODValidButtonColor { + private handleButtonComponentStyle(style:discord.ButtonStyle): api.ODValidButtonColor { if (style == discord.ButtonStyle.Danger) return "red" else if (style == discord.ButtonStyle.Success) return "green" else if (style == discord.ButtonStyle.Primary) return "blue" else return "gray" } /**Create the `ODTranscriptUserData` from a discord.js user. */ - #handleUserData(user:discord.User, member?:discord.GuildMember|null): ODTranscriptUserData { + private handleUserData(user:discord.User, member?:discord.GuildMember|null): ODTranscriptUserData { const userData: ODTranscriptUserData = { id:user.id, username:user.username, @@ -450,10 +450,10 @@ export class ODTranscriptCollector { let adminMessages = 0 for (const msg of parsedMessages){ - if (msg.author.tag || msg.author.id == this.#client.client.user.id) continue - const user = await this.#client.fetchUser(msg.author.id) + if (msg.author.tag || msg.author.id == this.client.client.user.id) continue + const user = await this.client.fetchUser(msg.author.id) if (!user) continue - const isAdmin = this.#permissions.hasPermissions("support",await this.#permissions.getPermissions(user,channel,guild)) + const isAdmin = this.permissions.hasPermissions("support",await this.permissions.getPermissions(user,channel,guild)) if (isAdmin) adminMessages++ else userMessages++ } diff --git a/src/core/main.ts b/src/core/main.ts index ae172e2..086cd1f 100644 --- a/src/core/main.ts +++ b/src/core/main.ts @@ -62,7 +62,7 @@ export class ODOpenTicketMain extends api.ODMain { const debug = new api.ODDebugger(console) const client = new api.ODMappedClientManager(debug) const livestatus = new api.ODMappedLiveStatusManager(debug,console) - const permissions = new api.ODMappedPermissionManager(debug,client) + const permissions = new api.ODMappedPermissionManager(debug,client,true) super({ versions:new api.ODMappedVersionManager(), diff --git a/src/core/mappings/action.ts b/src/core/mappings/action.ts index 313b59e..3ce48d4 100644 --- a/src/core/mappings/action.ts +++ b/src/core/mappings/action.ts @@ -23,7 +23,7 @@ export interface ODActionManagerIdMappings extends api.ODActionManagerIdConstrai "opendiscord:create-transcript":{ origin:"slash"|"text"|"ticket-message"|"reopen-message"|"close-message"|"autoclose-message"|"autodelete"|"clear"|"other", params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket}, - result:{compiler:ODTranscriptCompiler, success:boolean, result:ODTranscriptCompilerCompileResult, errorReason:string|null, pendingMessage:api.ODMessageBuildSentResult|null, initData:object|null, participants:{user:discord.User,role:"creator"|"participant"|"admin"}[]}, + result:{compiler:ODTranscriptCompiler, success:boolean, result:ODTranscriptCompilerCompileResult, errorReason:string|null, pendingMessage:api.ODResponderSendResult|null, initData:object|null, participants:{user:discord.User,role:"creator"|"participant"|"admin"}[]}, workers:"opendiscord:select-compiler"|"opendiscord:init-transcript"|"opendiscord:compile-transcript"|"opendiscord:ready-transcript"|"opendiscord:logs" }, "opendiscord:create-ticket":{ @@ -130,6 +130,10 @@ export interface ODActionManagerIdMappings extends api.ODActionManagerIdConstrai }, } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedActionManager `class * A special class with types for the Open Ticket `ODActionManager` class. */ diff --git a/src/core/mappings/base.ts b/src/core/mappings/base.ts index 0441f69..73eb270 100644 --- a/src/core/mappings/base.ts +++ b/src/core/mappings/base.ts @@ -15,6 +15,10 @@ export interface ODVersionManagerIdMappings extends api.ODVersionManagerIdConstr "opendiscord:livestatus":api.ODVersion } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedVersionManager `class * A special class with types for the Open Ticket `ODVersionManager` class. */ diff --git a/src/core/mappings/builder.ts b/src/core/mappings/builder.ts index accdfe2..67e8b50 100644 --- a/src/core/mappings/builder.ts +++ b/src/core/mappings/builder.ts @@ -253,6 +253,10 @@ export interface ODModalManagerIdMappings extends api.ODModalManagerIdConstraint "opendiscord:unpin-ticket-reason":{origin:"ticket-message"|"pin-message"|"other",params:{guild:discord.Guild,channel:discord.TextBasedChannel,user:discord.User,ticket:ODTicket},workers:"opendiscord:unpin-ticket-reason"} } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedButtonManager `class * A special class with types for the Open Ticket `ODButtonManager` class. */ diff --git a/src/core/mappings/checker.ts b/src/core/mappings/checker.ts index d29beac..a676744 100644 --- a/src/core/mappings/checker.ts +++ b/src/core/mappings/checker.ts @@ -129,6 +129,10 @@ export interface ODCheckerFunctionManagerIdMappings extends api.ODCheckerFunctio "opendiscord:dropdown-options":api.ODCheckerFunction } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedCheckerManager `class * A special class with types for the Open Ticket `ODCheckerManager` class. */ diff --git a/src/core/mappings/client.ts b/src/core/mappings/client.ts index 59a7c46..a325342 100644 --- a/src/core/mappings/client.ts +++ b/src/core/mappings/client.ts @@ -88,6 +88,10 @@ export interface ODContextMenuManagerIdMappings extends api.ODContextMenuManager //"opendiscord:test-menu":ODContextMenu } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedClientManager `class * A special class with types for the Open Ticket `ODClientManager` class. */ diff --git a/src/core/mappings/code.ts b/src/core/mappings/code.ts index 0243a85..c7d5cc1 100644 --- a/src/core/mappings/code.ts +++ b/src/core/mappings/code.ts @@ -26,6 +26,10 @@ export interface ODCodeManagerIdMappings extends api.ODCodeManagerIdConstraint { "opendiscord:ticket-anti-busy":api.ODCode, } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedCodeManager `class * A special class with types for the Open Ticket `ODCodeManager` class. */ diff --git a/src/core/mappings/config.ts b/src/core/mappings/config.ts index 73b7932..5e7718f 100644 --- a/src/core/mappings/config.ts +++ b/src/core/mappings/config.ts @@ -37,36 +37,6 @@ export interface ODConfigManagerIdMappings extends api.ODConfigManagerIdConstrai "opendiscord:transcripts":ODTranscriptsJsonConfig } -/**## ODMappedConfigManager `class - * A special class with types for the Open Ticket `ODConfigManager` class. - */ -export class ODMappedConfigManager extends api.ODConfigManager {} - -/**## ODGeneralJsonConfig `class - * A special class with types for the Open Ticket `config/general.json` config file - */ -export class ODGeneralJsonConfig extends api.ODJsonConfig {} - -/**## ODQuestionsJsonConfig `class - * A special class with types for the Open Ticket `config/questions.json` config file - */ -export class ODQuestionsJsonConfig extends api.ODJsonConfig {} - -/**## ODOptionsJsonConfig `class - * A special class with types for the Open Ticket `config/options.json` config file - */ -export class ODOptionsJsonConfig extends api.ODJsonConfig {} - -/**## ODPanelsJsonConfig `class - * A special class with types for the Open Ticket `config/panels.json` config file - */ -export class ODPanelsJsonConfig extends api.ODJsonConfig {} - -/**## ODTranscriptsJsonConfig `class - * A special class with types for the Open Ticket `config/transcripts.json` config file - */ -export class ODTranscriptsJsonConfig extends api.ODJsonConfig {} - /////////////////////////////////////// // CONFIG STRUCTURES, VALUES & TYPES // --> general.json @@ -799,4 +769,38 @@ export interface ODTranscriptsJsonConfig_TranscriptsData { textTranscriptStyle:ODTranscriptsJsonConfig_TranscriptsTextLayout, /**The layout of the HTML transcripts. */ htmlTranscriptStyle:ODTranscriptsJsonConfig_TranscriptsHtmlLayout -} \ No newline at end of file +} + +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + +/**## ODMappedConfigManager `class + * A special class with types for the Open Ticket `ODConfigManager` class. + */ +export class ODMappedConfigManager extends api.ODConfigManager {} + +/**## ODGeneralJsonConfig `class + * A special class with types for the Open Ticket `config/general.json` config file + */ +export class ODGeneralJsonConfig extends api.ODJsonConfig {} + +/**## ODQuestionsJsonConfig `class + * A special class with types for the Open Ticket `config/questions.json` config file + */ +export class ODQuestionsJsonConfig extends api.ODJsonConfig {} + +/**## ODOptionsJsonConfig `class + * A special class with types for the Open Ticket `config/options.json` config file + */ +export class ODOptionsJsonConfig extends api.ODJsonConfig {} + +/**## ODPanelsJsonConfig `class + * A special class with types for the Open Ticket `config/panels.json` config file + */ +export class ODPanelsJsonConfig extends api.ODJsonConfig {} + +/**## ODTranscriptsJsonConfig `class + * A special class with types for the Open Ticket `config/transcripts.json` config file + */ +export class ODTranscriptsJsonConfig extends api.ODJsonConfig {} \ No newline at end of file diff --git a/src/core/mappings/console.ts b/src/core/mappings/console.ts index bd95af7..362d0bb 100644 --- a/src/core/mappings/console.ts +++ b/src/core/mappings/console.ts @@ -11,6 +11,10 @@ export interface ODLiveStatusManagerIdMappings extends api.ODLiveStatusManagerId "opendiscord:default-djdj-dev":api.ODLiveStatusUrlSource } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedLiveStatusManager `class * A special class with types for the Open Ticket `ODLiveStatusManager` class. */ diff --git a/src/core/mappings/cooldown.ts b/src/core/mappings/cooldown.ts index 4dc9bd0..49cc921 100644 --- a/src/core/mappings/cooldown.ts +++ b/src/core/mappings/cooldown.ts @@ -11,6 +11,10 @@ export interface ODCooldownManagerIdMappings extends api.ODCooldownManagerIdCons //"opendiscord:cooldown":api.ODCooldown } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedCooldownManager `class * A special class with types for the Open Ticket `ODCooldownManager` class. */ diff --git a/src/core/mappings/database.ts b/src/core/mappings/database.ts index b4752fa..0429719 100644 --- a/src/core/mappings/database.ts +++ b/src/core/mappings/database.ts @@ -17,36 +17,6 @@ export interface ODDatabaseManagerIdMappings extends api.ODDatabaseManagerIdCons "opendiscord:options":ODOptionsDatabase, } -/**## ODMappedDatabaseManager `class - * A special class with types for the Open Ticket `ODDatabaseManager` class. - */ -export class ODMappedDatabaseManager extends api.ODDatabaseManager {} - -/**## ODGlobalDatabase `class - * A special class with types for the Open Ticket `database/global.json` database file - */ -export class ODGlobalDatabase extends api.ODFormattedJsonDatabase {} - -/**## ODStatsDatabase `class - * A special class with types for the Open Ticket `database/stats.json` database file - */ -export class ODStatsDatabase extends api.ODFormattedJsonDatabase {} - -/**## ODTicketsDatabase `class - * A special class with types for the Open Ticket `database/tickets.json` database file - */ -export class ODTicketsDatabase extends api.ODFormattedJsonDatabase {} - -/**## ODUsersDatabase `class - * A special class with types for the Open Ticket `database/users.json` database file - */ -export class ODUsersDatabase extends api.ODFormattedJsonDatabase {} - -/**## ODOptionsDatabase `class - * A special class with types for the Open Ticket `database/options.json` database file - */ -export class ODOptionsDatabase extends api.ODFormattedJsonDatabase {} - ///////////////////////////////////////// // DATABASE MAPPINGS, CATEGORIES & TYPES ///////////////////////////////////////// @@ -85,4 +55,38 @@ export interface ODUsersDatabaseIdMappings extends api.ODDatabaseIdConstraint { */ export interface ODOptionsDatabaseIdMappings extends api.ODDatabaseIdConstraint { "opendiscord:used-option":ODOptionJson -} \ No newline at end of file +} + +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + +/**## ODMappedDatabaseManager `class + * A special class with types for the Open Ticket `ODDatabaseManager` class. + */ +export class ODMappedDatabaseManager extends api.ODDatabaseManager {} + +/**## ODGlobalDatabase `class + * A special class with types for the Open Ticket `database/global.json` database file + */ +export class ODGlobalDatabase extends api.ODFormattedJsonDatabase {} + +/**## ODStatsDatabase `class + * A special class with types for the Open Ticket `database/stats.json` database file + */ +export class ODStatsDatabase extends api.ODFormattedJsonDatabase {} + +/**## ODTicketsDatabase `class + * A special class with types for the Open Ticket `database/tickets.json` database file + */ +export class ODTicketsDatabase extends api.ODFormattedJsonDatabase {} + +/**## ODUsersDatabase `class + * A special class with types for the Open Ticket `database/users.json` database file + */ +export class ODUsersDatabase extends api.ODFormattedJsonDatabase {} + +/**## ODOptionsDatabase `class + * A special class with types for the Open Ticket `database/options.json` database file + */ +export class ODOptionsDatabase extends api.ODFormattedJsonDatabase {} \ No newline at end of file diff --git a/src/core/mappings/event.ts b/src/core/mappings/event.ts index 8e5c919..77cac33 100644 --- a/src/core/mappings/event.ts +++ b/src/core/mappings/event.ts @@ -333,6 +333,10 @@ export interface ODEventManagerIdMappings extends api.ODEventManagerIdConstraint "onReadyForUsage": api.ODEvent<() => api.ODPromiseVoid> } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedEventManager `class * A special class with types for the Open Ticket `ODEventManager` class. */ diff --git a/src/core/mappings/flag.ts b/src/core/mappings/flag.ts index ac5600a..47b9bee 100644 --- a/src/core/mappings/flag.ts +++ b/src/core/mappings/flag.ts @@ -26,6 +26,10 @@ export interface ODFlagManagerIdMappings extends api.ODFlagManagerIdConstraint { "opendiscord:cli":api.ODFlag, } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedFlagManager `class * A special class with types for the Open Ticket `ODFlagManager` class. */ diff --git a/src/core/mappings/helpmenu.ts b/src/core/mappings/helpmenu.ts index b537e13..631128b 100644 --- a/src/core/mappings/helpmenu.ts +++ b/src/core/mappings/helpmenu.ts @@ -27,46 +27,6 @@ export interface ODHelpMenuManagerIdMappings extends api.ODHelpMenuManagerIdCons "opendiscord:extra":ODExtraHelpMenuCategory } -/**## ODMappedHelpMenuManager `class - * A special class with types for the Open Ticket `ODHelpMenuManager` class. - */ -export class ODMappedHelpMenuManager extends api.ODHelpMenuManager {} - -/**## ODGeneralHelpMenuCategory `class - * A special class with types for the Open Ticket `General Commands` help menu category. - */ -export class ODGeneralHelpMenuCategory extends api.ODHelpMenuCategory {} - -/**## ODBasicTicketHelpMenuCategory `class - * A special class with types for the Open Ticket `Basic Ticket Commands` help menu category. - */ -export class ODBasicTicketHelpMenuCategory extends api.ODHelpMenuCategory {} - -/**## ODAdvancedTicketHelpMenuCategory `class - * A special class with types for the Open Ticket `Advanced Ticket Commands` help menu category. - */ -export class ODAdvancedTicketHelpMenuCategory extends api.ODHelpMenuCategory {} - -/**## ODUserTicketHelpMenuCategory `class - * A special class with types for the Open Ticket `User ticket Commands` help menu category. - */ -export class ODUserTicketHelpMenuCategory extends api.ODHelpMenuCategory {} - -/**## ODAdminHelpMenuCategory `class - * A special class with types for the Open Ticket `Admin Commands` help menu category. - */ -export class ODAdminHelpMenuCategory extends api.ODHelpMenuCategory {} - -/**## ODAdvancedHelpMenuCategory `class - * A special class with types for the Open Ticket `Advanced Commands` help menu category. - */ -export class ODAdvancedHelpMenuCategory extends api.ODHelpMenuCategory {} - -/**## ODExtraHelpMenuCategory `class - * A special class with types for the Open Ticket `Extra Commands` help menu category. - */ -export class ODExtraHelpMenuCategory extends api.ODHelpMenuCategory {} - ///////////////////////////////////////// // HELP MENU MAPPINGS, CATEGORIES & TYPES ///////////////////////////////////////// @@ -148,4 +108,48 @@ export interface ODAdvancedHelpMenuCategoryIdMappings extends api.ODHelpMenuCate */ export interface ODExtraHelpMenuCategoryIdMappings extends api.ODHelpMenuCategoryIdConstraint { //"opendiscord:help-component":api.ODHelpMenuCommandComponent -} \ No newline at end of file +} + +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + +/**## ODMappedHelpMenuManager `class + * A special class with types for the Open Ticket `ODHelpMenuManager` class. + */ +export class ODMappedHelpMenuManager extends api.ODHelpMenuManager {} + +/**## ODGeneralHelpMenuCategory `class + * A special class with types for the Open Ticket `General Commands` help menu category. + */ +export class ODGeneralHelpMenuCategory extends api.ODHelpMenuCategory {} + +/**## ODBasicTicketHelpMenuCategory `class + * A special class with types for the Open Ticket `Basic Ticket Commands` help menu category. + */ +export class ODBasicTicketHelpMenuCategory extends api.ODHelpMenuCategory {} + +/**## ODAdvancedTicketHelpMenuCategory `class + * A special class with types for the Open Ticket `Advanced Ticket Commands` help menu category. + */ +export class ODAdvancedTicketHelpMenuCategory extends api.ODHelpMenuCategory {} + +/**## ODUserTicketHelpMenuCategory `class + * A special class with types for the Open Ticket `User ticket Commands` help menu category. + */ +export class ODUserTicketHelpMenuCategory extends api.ODHelpMenuCategory {} + +/**## ODAdminHelpMenuCategory `class + * A special class with types for the Open Ticket `Admin Commands` help menu category. + */ +export class ODAdminHelpMenuCategory extends api.ODHelpMenuCategory {} + +/**## ODAdvancedHelpMenuCategory `class + * A special class with types for the Open Ticket `Advanced Commands` help menu category. + */ +export class ODAdvancedHelpMenuCategory extends api.ODHelpMenuCategory {} + +/**## ODExtraHelpMenuCategory `class + * A special class with types for the Open Ticket `Extra Commands` help menu category. + */ +export class ODExtraHelpMenuCategory extends api.ODHelpMenuCategory {} \ No newline at end of file diff --git a/src/core/mappings/language.ts b/src/core/mappings/language.ts index 9f40264..e425a6c 100644 --- a/src/core/mappings/language.ts +++ b/src/core/mappings/language.ts @@ -622,6 +622,10 @@ export type ODLanguageManagerTranslationIdMappings = ( "priorities.none" ) +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedLanguageManager `class * A special class with types for the Open Ticket `ODLanguageManager` class. */ diff --git a/src/core/mappings/permission.ts b/src/core/mappings/permission.ts index 31a5e38..050b225 100644 --- a/src/core/mappings/permission.ts +++ b/src/core/mappings/permission.ts @@ -11,11 +11,6 @@ export interface ODPermissionManagerIdMappings extends api.ODPermissionManagerId //"opendiscord:test-permission":api.ODPermission } -/**## ODMappedPermissionManager `class - * A special class with types for the Open Ticket `ODPermissionManager` class. - */ -export class ODMappedPermissionManager extends api.ODPermissionManager {} - /**## ODPermissionEmbedType `type` * A collection of all types available in the `opendiscord:no-permissions` embed. */ @@ -27,4 +22,13 @@ export type ODPermissionEmbedType = ( "support"| "member"| "discord-administrator" -) \ No newline at end of file +) + +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + +/**## ODMappedPermissionManager `class + * A special class with types for the Open Ticket `ODPermissionManager` class. + */ +export class ODMappedPermissionManager extends api.ODPermissionManager {} \ No newline at end of file diff --git a/src/core/mappings/plugin.ts b/src/core/mappings/plugin.ts index ff61099..ccf204d 100644 --- a/src/core/mappings/plugin.ts +++ b/src/core/mappings/plugin.ts @@ -19,6 +19,10 @@ export interface ODPluginClassManagerIdMappings extends api.ODPluginClassManager //"opendiscord:example-plugin":any } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedPluginManager `class * A special class with types for the Open Ticket `ODPluginManager` class. */ diff --git a/src/core/mappings/post.ts b/src/core/mappings/post.ts index 1498945..a1abe2e 100644 --- a/src/core/mappings/post.ts +++ b/src/core/mappings/post.ts @@ -13,6 +13,10 @@ export interface ODPostManagerIdMappings extends api.ODPostManagerIdConstraint { "opendiscord:transcripts":api.ODPost|null } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedPostManager `class * A special class with types for the Open Ticket `ODPostManager` class. */ diff --git a/src/core/mappings/progressbar.ts b/src/core/mappings/progressbar.ts index cfaa130..68a2a3f 100644 --- a/src/core/mappings/progressbar.ts +++ b/src/core/mappings/progressbar.ts @@ -29,6 +29,10 @@ export interface ODProgressBarRendererManagerIdMappings extends api.ODProgressBa "opendiscord:time-min-renderer":api.ODDefaultProgressBarRenderer, } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedProgressBarManager `class * A special class with types for the Open Ticket `ODProgressBarManager` class. */ diff --git a/src/core/mappings/responder.ts b/src/core/mappings/responder.ts index 521f9b6..65217b8 100644 --- a/src/core/mappings/responder.ts +++ b/src/core/mappings/responder.ts @@ -103,6 +103,10 @@ export interface ODAutocompleteResponderManagerIdMappings extends api.ODAutocomp "opendiscord:option-id":{origin:"autocomplete",params:{},workers:"opendiscord:option-id"} } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedCommandResponderManager `class * A special class with types for the Open Ticket `ODCommandResponderManager` class. */ diff --git a/src/core/mappings/session.ts b/src/core/mappings/session.ts index 16f1fb6..f9a9411 100644 --- a/src/core/mappings/session.ts +++ b/src/core/mappings/session.ts @@ -11,6 +11,10 @@ export interface ODSessionManagerIdMappings extends api.ODSessionManagerIdConstr //"opendiscord:example-session":api.ODSession } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedSessionManager `class * A special class with types for the Open Ticket `ODSessionManager` class. */ diff --git a/src/core/mappings/startscreen.ts b/src/core/mappings/startscreen.ts index a5f6137..1214828 100644 --- a/src/core/mappings/startscreen.ts +++ b/src/core/mappings/startscreen.ts @@ -18,6 +18,10 @@ export interface ODStartScreenManagerIdMappings extends api.ODStartScreenManager "opendiscord:logs":api.ODStartScreenCategoryComponent } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedStartScreenManager `class * A special class with types for the Open Ticket `ODStartScreenManager` class. */ diff --git a/src/core/mappings/statistic.ts b/src/core/mappings/statistic.ts index 8179ed1..51b3f12 100644 --- a/src/core/mappings/statistic.ts +++ b/src/core/mappings/statistic.ts @@ -16,41 +16,6 @@ export interface ODStatisticManagerIdMappings extends api.ODStatisticManagerIdCo "opendiscord:messages":ODMessagesStatisticScope, } -/**## ODMappedStatisticManager `class - * A special class with types for the Open Ticket `ODStatisticManager` class. - */ -export class ODMappedStatisticManager extends api.ODStatisticManager {} - -/**## ODGlobalStatisticScope `class - * A special class with types for the Open Ticket `Global` statistics category/scope. - */ -export class ODGlobalStatisticScope extends api.ODStatisticGlobalScope {} - -/**## ODSystemStatisticScope `class - * A special class with types for the Open Ticket `System` statistics category/scope. - */ -export class ODSystemStatisticScope extends api.ODStatisticGlobalScope {} - -/**## ODUserStatisticScope `class - * A special class with types for the Open Ticket `User` statistics category/scope. - */ -export class ODUserStatisticScope extends api.ODStatisticScope {} - -/**## ODTicketStatisticScope `class - * A special class with types for the Open Ticket `Ticket` statistics category/scope. - */ -export class ODTicketStatisticScope extends api.ODStatisticScope {} - -/**## ODParticipantsStatisticScope `class - * A special class with types for the Open Ticket `Participants` statistics category/scope. - */ -export class ODParticipantsStatisticScope extends api.ODStatisticScope {} - -/**## ODMessagesStatisticScope `class - * A special class with types for the Open Ticket `Messages` statistics category/scope. - */ -export class ODMessagesStatisticScope extends api.ODStatisticScope {} - ///////////////////////////////////////// // STATISTICS MAPPINGS, CATEGORIES & TYPES ///////////////////////////////////////// @@ -136,4 +101,43 @@ export interface ODParticipantsStatisticScopeIdMappings extends api.ODStatisticS */ export interface ODMessagesStatisticScopeIdMappings extends api.ODStatisticScopeIdConstraint { "opendiscord:count":api.ODDynamicStatistic -} \ No newline at end of file +} + +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + +/**## ODMappedStatisticManager `class + * A special class with types for the Open Ticket `ODStatisticManager` class. + */ +export class ODMappedStatisticManager extends api.ODStatisticManager {} + +/**## ODGlobalStatisticScope `class + * A special class with types for the Open Ticket `Global` statistics category/scope. + */ +export class ODGlobalStatisticScope extends api.ODStatisticGlobalScope {} + +/**## ODSystemStatisticScope `class + * A special class with types for the Open Ticket `System` statistics category/scope. + */ +export class ODSystemStatisticScope extends api.ODStatisticGlobalScope {} + +/**## ODUserStatisticScope `class + * A special class with types for the Open Ticket `User` statistics category/scope. + */ +export class ODUserStatisticScope extends api.ODStatisticScope {} + +/**## ODTicketStatisticScope `class + * A special class with types for the Open Ticket `Ticket` statistics category/scope. + */ +export class ODTicketStatisticScope extends api.ODStatisticScope {} + +/**## ODParticipantsStatisticScope `class + * A special class with types for the Open Ticket `Participants` statistics category/scope. + */ +export class ODParticipantsStatisticScope extends api.ODStatisticScope {} + +/**## ODMessagesStatisticScope `class + * A special class with types for the Open Ticket `Messages` statistics category/scope. + */ +export class ODMessagesStatisticScope extends api.ODStatisticScope {} \ No newline at end of file diff --git a/src/core/mappings/verifybar.ts b/src/core/mappings/verifybar.ts index 7ee3637..bb4ea2f 100644 --- a/src/core/mappings/verifybar.ts +++ b/src/core/mappings/verifybar.ts @@ -27,6 +27,10 @@ export interface ODVerifyBarManagerIdMappings extends api.ODVerifyBarManagerIdCo "opendiscord:delete-ticket-autoclose-message":{successWorkerIds:"opendiscord:permissions"|"opendiscord:delete-ticket",failureWorkerIds:"opendiscord:back-to-autoclose-message"} } +///////////////////////////// +////// MAPPED MANAGERS ////// +///////////////////////////// + /**## ODMappedVerifyBarManager `class * A special class with types for the Open Ticket `ODVerifyBarManager` class. */ diff --git a/src/data/framework/codeLoader.ts b/src/data/framework/codeLoader.ts index 25f0a53..ef32ef4 100644 --- a/src/data/framework/codeLoader.ts +++ b/src/data/framework/codeLoader.ts @@ -37,22 +37,21 @@ export const loadCommandErrorHandlingCode = async () => { //responder timeout opendiscord.responders.commands.setTimeoutErrorCallback(async (instance,source) => { - instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(source,{guild:instance.guild,channel:instance.channel,user:instance.user})) + return await instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(source,{guild:instance.guild,channel:instance.channel,user:instance.user})) },null) opendiscord.responders.buttons.setTimeoutErrorCallback(async (instance,source) => { - instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(source,{guild:instance.guild,channel:instance.channel,user:instance.user})) + return await instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(source,{guild:instance.guild,channel:instance.channel,user:instance.user})) },null) opendiscord.responders.dropdowns.setTimeoutErrorCallback(async (instance,source) => { - instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(source,{guild:instance.guild,channel:instance.channel,user:instance.user})) + return await instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(source,{guild:instance.guild,channel:instance.channel,user:instance.user})) },null) opendiscord.responders.modals.setTimeoutErrorCallback(async (instance,source) => { if (!instance.channel){ - instance.reply({id:new api.ODId("looks-like-we-got-an-error-here"), ephemeral:true, message:{ + return await instance.reply({id:new api.ODId("opendiscord:unknown-error"), ephemeral:true, message:{ content:":x: **Something went wrong while replying to this modal!**" }}) - return } - instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(source,{guild:instance.guild,channel:instance.channel,user:instance.user})) + return await instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-responder-timeout").build(source,{guild:instance.guild,channel:instance.channel,user:instance.user})) },null) })) }