Replaced #func() methods with TS: private func()

This commit is contained in:
DJj123dj
2026-05-03 22:04:38 +02:00
parent 10f5ae9d44
commit 4eb9331bf4
35 changed files with 342 additions and 273 deletions
+2 -2
View File
@@ -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"
},
+1 -1
View File
@@ -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")
+4 -4
View File
@@ -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
}
}
+21 -24
View File
@@ -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<ODOption> {
/**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<ODOptionData<api.ODValidJsonType>> {
*/
export class ODOptionData<DataType extends api.ODValidJsonType> 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<ODOptionSuffix> {
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<ODOptionSuffix> {
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<string> {
@@ -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<string> {
@@ -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<string> {
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<string> {
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)
+5 -9
View File
@@ -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<ODPanel> {
/**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<ODPanelData<api.ODValidJsonType>> {
*/
export class ODPanelData<DataType extends api.ODValidJsonType> 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(){
-4
View File
@@ -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<IdList extends ODPriorityManagerIdConstraint = ODPriorityManagerIdConstraint> extends api.ODManager<ODPriorityLevel> {
/**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. */
+5 -9
View File
@@ -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<ODQuestion> {
/**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<ODQuestionData<api.ODValidJsonType
*/
export class ODQuestionData<DataType extends api.ODValidJsonType> 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(){
+5 -9
View File
@@ -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<ODRole> {
/**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<ODRoleData<api.ODValidJsonType>> {
*/
export class ODRoleData<DataType extends api.ODValidJsonType> 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(){
+27 -30
View File
@@ -14,31 +14,28 @@ import * as discord from "discord.js"
*/
export class ODTicketManager extends api.ODManager<ODTicket> {
/**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<discord.GuildTextBasedChannel|null> {
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<ODTicket> {
/**Get the main ticket message of a ticket channel when found. */
async getTicketMessage(ticket:ODTicket): Promise<discord.Message<true>|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<ODTicket> {
}
/**Shortcut for getting a discord.js user within a ticket. */
async getTicketUser(ticket:ODTicket, user:"creator"|"closer"|"claimer"|"pinner"): Promise<discord.User|null> {
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<ODTicket> {
//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<ODTicket> {
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<ODTicket> {
//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<ODTicketData<api.ODValidJsonType>> {
/**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<api.ODValidJsonType>[]){
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<ODTicketData<api.ODValidJsonType>> {
*/
export class ODTicketData<DataType extends api.ODValidJsonType> 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(){
+28 -28
View File
@@ -30,11 +30,11 @@ export class ODTranscriptManager<IdList extends ODTranscriptManagerIdConstraint
/**The manager responsible for collecting all messages in a channel. */
collector: ODTranscriptCollector
/**Alias for the client manager. */
#client: api.ODClientManager
private client: api.ODClientManager
constructor(debug:api.ODDebugger, tickets:ODTicketManager, client:api.ODClientManager, permissions:api.ODPermissionManager){
super(debug,"transcript compiler")
this.#client = client
this.client = client
this.collector = new ODTranscriptCollector(tickets,client,permissions)
}
@@ -89,7 +89,7 @@ export interface ODTranscriptCompilerInitResult<InitData extends object|null> {
/**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<Data extends object> {
*/
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<Data extends object,InitData extends (object|n
*/
export class ODTranscriptCollector {
/**Alias for the ticket manager. */
#tickets: ODTicketManager
private tickets: ODTicketManager
/**Alias for the client manager. */
#client: api.ODClientManager
private client: api.ODClientManager
/**Alias for the permissions manager. */
#permissions: api.ODPermissionManager
private permissions: api.ODPermissionManager
constructor(tickets:ODTicketManager,client:api.ODClientManager,permissions:api.ODPermissionManager){
this.#tickets = tickets
this.#client = client
this.#permissions = permissions
this.tickets = tickets
this.client = client
this.permissions = permissions
}
/**Collect all messages from a given ticket channel. It may not include all messages depending on the ratelimit. */
async collectAllMessages(ticket:ODTicket, include?:ODTranscriptCollectorIncludeSettings): Promise<discord.Message<true>[]|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<true>[] = []
@@ -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<true>, rawEmoji:discord.APIMessageComponentEmoji|null): ODTranscriptEmojiData|null {
private handleComponentEmoji(message:discord.Message<true>, 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++
}
+1 -1
View File
@@ -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(),
+5 -1
View File
@@ -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<any,object|null>, success:boolean, result:ODTranscriptCompilerCompileResult<any>, errorReason:string|null, pendingMessage:api.ODMessageBuildSentResult<true>|null, initData:object|null, participants:{user:discord.User,role:"creator"|"participant"|"admin"}[]},
result:{compiler:ODTranscriptCompiler<any,object|null>, success:boolean, result:ODTranscriptCompilerCompileResult<any>, errorReason:string|null, pendingMessage:api.ODResponderSendResult<true>|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.
*/
+4
View File
@@ -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.
*/
+4
View File
@@ -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.
*/
+4
View File
@@ -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.
*/
+4
View File
@@ -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.
*/
+4
View File
@@ -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.
*/
+34 -30
View File
@@ -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<ODConfigManagerIdMappings> {}
/**## ODGeneralJsonConfig `class
* A special class with types for the Open Ticket `config/general.json` config file
*/
export class ODGeneralJsonConfig extends api.ODJsonConfig<ODGeneralJsonConfig_GeneralData> {}
/**## ODQuestionsJsonConfig `class
* A special class with types for the Open Ticket `config/questions.json` config file
*/
export class ODQuestionsJsonConfig extends api.ODJsonConfig<ODQuestionsJsonConfig_QuestionsData> {}
/**## ODOptionsJsonConfig `class
* A special class with types for the Open Ticket `config/options.json` config file
*/
export class ODOptionsJsonConfig extends api.ODJsonConfig<ODOptionsJsonConfig_OptionsData> {}
/**## ODPanelsJsonConfig `class
* A special class with types for the Open Ticket `config/panels.json` config file
*/
export class ODPanelsJsonConfig extends api.ODJsonConfig<ODPanelsJsonConfig_PanelsData> {}
/**## ODTranscriptsJsonConfig `class
* A special class with types for the Open Ticket `config/transcripts.json` config file
*/
export class ODTranscriptsJsonConfig extends api.ODJsonConfig<ODTranscriptsJsonConfig_TranscriptsData> {}
///////////////////////////////////////
// CONFIG STRUCTURES, VALUES & TYPES
// --> general.json
@@ -800,3 +770,37 @@ export interface ODTranscriptsJsonConfig_TranscriptsData {
/**The layout of the HTML transcripts. */
htmlTranscriptStyle:ODTranscriptsJsonConfig_TranscriptsHtmlLayout
}
/////////////////////////////
////// MAPPED MANAGERS //////
/////////////////////////////
/**## ODMappedConfigManager `class
* A special class with types for the Open Ticket `ODConfigManager` class.
*/
export class ODMappedConfigManager extends api.ODConfigManager<ODConfigManagerIdMappings> {}
/**## ODGeneralJsonConfig `class
* A special class with types for the Open Ticket `config/general.json` config file
*/
export class ODGeneralJsonConfig extends api.ODJsonConfig<ODGeneralJsonConfig_GeneralData> {}
/**## ODQuestionsJsonConfig `class
* A special class with types for the Open Ticket `config/questions.json` config file
*/
export class ODQuestionsJsonConfig extends api.ODJsonConfig<ODQuestionsJsonConfig_QuestionsData> {}
/**## ODOptionsJsonConfig `class
* A special class with types for the Open Ticket `config/options.json` config file
*/
export class ODOptionsJsonConfig extends api.ODJsonConfig<ODOptionsJsonConfig_OptionsData> {}
/**## ODPanelsJsonConfig `class
* A special class with types for the Open Ticket `config/panels.json` config file
*/
export class ODPanelsJsonConfig extends api.ODJsonConfig<ODPanelsJsonConfig_PanelsData> {}
/**## ODTranscriptsJsonConfig `class
* A special class with types for the Open Ticket `config/transcripts.json` config file
*/
export class ODTranscriptsJsonConfig extends api.ODJsonConfig<ODTranscriptsJsonConfig_TranscriptsData> {}
+4
View File
@@ -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.
*/
+4
View File
@@ -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.
*/
+34 -30
View File
@@ -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<ODDatabaseManagerIdMappings> {}
/**## ODGlobalDatabase `class
* A special class with types for the Open Ticket `database/global.json` database file
*/
export class ODGlobalDatabase extends api.ODFormattedJsonDatabase<ODGlobalDatabaseIdMappings> {}
/**## 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<ODTicketsDatabaseIdMappings> {}
/**## ODUsersDatabase `class
* A special class with types for the Open Ticket `database/users.json` database file
*/
export class ODUsersDatabase extends api.ODFormattedJsonDatabase<ODUsersDatabaseIdMappings> {}
/**## ODOptionsDatabase `class
* A special class with types for the Open Ticket `database/options.json` database file
*/
export class ODOptionsDatabase extends api.ODFormattedJsonDatabase<ODOptionsDatabaseIdMappings> {}
/////////////////////////////////////////
// DATABASE MAPPINGS, CATEGORIES & TYPES
/////////////////////////////////////////
@@ -86,3 +56,37 @@ export interface ODUsersDatabaseIdMappings extends api.ODDatabaseIdConstraint {
export interface ODOptionsDatabaseIdMappings extends api.ODDatabaseIdConstraint {
"opendiscord:used-option":ODOptionJson
}
/////////////////////////////
////// MAPPED MANAGERS //////
/////////////////////////////
/**## ODMappedDatabaseManager `class
* A special class with types for the Open Ticket `ODDatabaseManager` class.
*/
export class ODMappedDatabaseManager extends api.ODDatabaseManager<ODDatabaseManagerIdMappings> {}
/**## ODGlobalDatabase `class
* A special class with types for the Open Ticket `database/global.json` database file
*/
export class ODGlobalDatabase extends api.ODFormattedJsonDatabase<ODGlobalDatabaseIdMappings> {}
/**## 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<ODTicketsDatabaseIdMappings> {}
/**## ODUsersDatabase `class
* A special class with types for the Open Ticket `database/users.json` database file
*/
export class ODUsersDatabase extends api.ODFormattedJsonDatabase<ODUsersDatabaseIdMappings> {}
/**## ODOptionsDatabase `class
* A special class with types for the Open Ticket `database/options.json` database file
*/
export class ODOptionsDatabase extends api.ODFormattedJsonDatabase<ODOptionsDatabaseIdMappings> {}
+4
View File
@@ -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.
*/
+4
View File
@@ -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.
*/
+44 -40
View File
@@ -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<ODHelpMenuManagerIdMappings> {}
/**## ODGeneralHelpMenuCategory `class
* A special class with types for the Open Ticket `General Commands` help menu category.
*/
export class ODGeneralHelpMenuCategory extends api.ODHelpMenuCategory<ODGeneralHelpMenuCategoryIdMappings> {}
/**## ODBasicTicketHelpMenuCategory `class
* A special class with types for the Open Ticket `Basic Ticket Commands` help menu category.
*/
export class ODBasicTicketHelpMenuCategory extends api.ODHelpMenuCategory<ODBasicTicketHelpMenuCategoryIdMappings> {}
/**## ODAdvancedTicketHelpMenuCategory `class
* A special class with types for the Open Ticket `Advanced Ticket Commands` help menu category.
*/
export class ODAdvancedTicketHelpMenuCategory extends api.ODHelpMenuCategory<ODAdvancedTicketHelpMenuCategoryIdMappings> {}
/**## ODUserTicketHelpMenuCategory `class
* A special class with types for the Open Ticket `User ticket Commands` help menu category.
*/
export class ODUserTicketHelpMenuCategory extends api.ODHelpMenuCategory<ODUserTicketHelpMenuCategoryIdMappings> {}
/**## ODAdminHelpMenuCategory `class
* A special class with types for the Open Ticket `Admin Commands` help menu category.
*/
export class ODAdminHelpMenuCategory extends api.ODHelpMenuCategory<ODAdminHelpMenuCategoryIdMappings> {}
/**## ODAdvancedHelpMenuCategory `class
* A special class with types for the Open Ticket `Advanced Commands` help menu category.
*/
export class ODAdvancedHelpMenuCategory extends api.ODHelpMenuCategory<ODAdvancedHelpMenuCategoryIdMappings> {}
/**## ODExtraHelpMenuCategory `class
* A special class with types for the Open Ticket `Extra Commands` help menu category.
*/
export class ODExtraHelpMenuCategory extends api.ODHelpMenuCategory<ODExtraHelpMenuCategoryIdMappings> {}
/////////////////////////////////////////
// HELP MENU MAPPINGS, CATEGORIES & TYPES
/////////////////////////////////////////
@@ -149,3 +109,47 @@ export interface ODAdvancedHelpMenuCategoryIdMappings extends api.ODHelpMenuCate
export interface ODExtraHelpMenuCategoryIdMappings extends api.ODHelpMenuCategoryIdConstraint {
//"opendiscord:help-component":api.ODHelpMenuCommandComponent
}
/////////////////////////////
////// MAPPED MANAGERS //////
/////////////////////////////
/**## ODMappedHelpMenuManager `class
* A special class with types for the Open Ticket `ODHelpMenuManager` class.
*/
export class ODMappedHelpMenuManager extends api.ODHelpMenuManager<ODHelpMenuManagerIdMappings> {}
/**## ODGeneralHelpMenuCategory `class
* A special class with types for the Open Ticket `General Commands` help menu category.
*/
export class ODGeneralHelpMenuCategory extends api.ODHelpMenuCategory<ODGeneralHelpMenuCategoryIdMappings> {}
/**## ODBasicTicketHelpMenuCategory `class
* A special class with types for the Open Ticket `Basic Ticket Commands` help menu category.
*/
export class ODBasicTicketHelpMenuCategory extends api.ODHelpMenuCategory<ODBasicTicketHelpMenuCategoryIdMappings> {}
/**## ODAdvancedTicketHelpMenuCategory `class
* A special class with types for the Open Ticket `Advanced Ticket Commands` help menu category.
*/
export class ODAdvancedTicketHelpMenuCategory extends api.ODHelpMenuCategory<ODAdvancedTicketHelpMenuCategoryIdMappings> {}
/**## ODUserTicketHelpMenuCategory `class
* A special class with types for the Open Ticket `User ticket Commands` help menu category.
*/
export class ODUserTicketHelpMenuCategory extends api.ODHelpMenuCategory<ODUserTicketHelpMenuCategoryIdMappings> {}
/**## ODAdminHelpMenuCategory `class
* A special class with types for the Open Ticket `Admin Commands` help menu category.
*/
export class ODAdminHelpMenuCategory extends api.ODHelpMenuCategory<ODAdminHelpMenuCategoryIdMappings> {}
/**## ODAdvancedHelpMenuCategory `class
* A special class with types for the Open Ticket `Advanced Commands` help menu category.
*/
export class ODAdvancedHelpMenuCategory extends api.ODHelpMenuCategory<ODAdvancedHelpMenuCategoryIdMappings> {}
/**## ODExtraHelpMenuCategory `class
* A special class with types for the Open Ticket `Extra Commands` help menu category.
*/
export class ODExtraHelpMenuCategory extends api.ODHelpMenuCategory<ODExtraHelpMenuCategoryIdMappings> {}
+4
View File
@@ -622,6 +622,10 @@ export type ODLanguageManagerTranslationIdMappings = (
"priorities.none"
)
/////////////////////////////
////// MAPPED MANAGERS //////
/////////////////////////////
/**## ODMappedLanguageManager `class
* A special class with types for the Open Ticket `ODLanguageManager` class.
*/
+9 -5
View File
@@ -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<ODPermissionManagerIdMappings> {}
/**## ODPermissionEmbedType `type`
* A collection of all types available in the `opendiscord:no-permissions` embed.
*/
@@ -28,3 +23,12 @@ export type ODPermissionEmbedType = (
"member"|
"discord-administrator"
)
/////////////////////////////
////// MAPPED MANAGERS //////
/////////////////////////////
/**## ODMappedPermissionManager `class
* A special class with types for the Open Ticket `ODPermissionManager` class.
*/
export class ODMappedPermissionManager extends api.ODPermissionManager<ODPermissionManagerIdMappings> {}
+4
View File
@@ -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.
*/
+4
View File
@@ -13,6 +13,10 @@ export interface ODPostManagerIdMappings extends api.ODPostManagerIdConstraint {
"opendiscord:transcripts":api.ODPost<discord.GuildTextBasedChannel>|null
}
/////////////////////////////
////// MAPPED MANAGERS //////
/////////////////////////////
/**## ODMappedPostManager `class
* A special class with types for the Open Ticket `ODPostManager` class.
*/
+4
View File
@@ -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.
*/
+4
View File
@@ -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.
*/
+4
View File
@@ -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.
*/
+4
View File
@@ -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.
*/
+39 -35
View File
@@ -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<ODStatisticManagerIdMappings> {}
/**## ODGlobalStatisticScope `class
* A special class with types for the Open Ticket `Global` statistics category/scope.
*/
export class ODGlobalStatisticScope extends api.ODStatisticGlobalScope<ODGlobalStatisticScopeIdMappings> {}
/**## ODSystemStatisticScope `class
* A special class with types for the Open Ticket `System` statistics category/scope.
*/
export class ODSystemStatisticScope extends api.ODStatisticGlobalScope<ODSystemStatisticScopeIdMappings> {}
/**## ODUserStatisticScope `class
* A special class with types for the Open Ticket `User` statistics category/scope.
*/
export class ODUserStatisticScope extends api.ODStatisticScope<ODUserStatisticScopeIdMappings> {}
/**## ODTicketStatisticScope `class
* A special class with types for the Open Ticket `Ticket` statistics category/scope.
*/
export class ODTicketStatisticScope extends api.ODStatisticScope<ODTicketStatisticScopeIdMappings> {}
/**## ODParticipantsStatisticScope `class
* A special class with types for the Open Ticket `Participants` statistics category/scope.
*/
export class ODParticipantsStatisticScope extends api.ODStatisticScope<ODParticipantsStatisticScopeIdMappings> {}
/**## ODMessagesStatisticScope `class
* A special class with types for the Open Ticket `Messages` statistics category/scope.
*/
export class ODMessagesStatisticScope extends api.ODStatisticScope<ODMessagesStatisticScopeIdMappings> {}
/////////////////////////////////////////
// STATISTICS MAPPINGS, CATEGORIES & TYPES
/////////////////////////////////////////
@@ -137,3 +102,42 @@ export interface ODParticipantsStatisticScopeIdMappings extends api.ODStatisticS
export interface ODMessagesStatisticScopeIdMappings extends api.ODStatisticScopeIdConstraint {
"opendiscord:count":api.ODDynamicStatistic
}
/////////////////////////////
////// MAPPED MANAGERS //////
/////////////////////////////
/**## ODMappedStatisticManager `class
* A special class with types for the Open Ticket `ODStatisticManager` class.
*/
export class ODMappedStatisticManager extends api.ODStatisticManager<ODStatisticManagerIdMappings> {}
/**## ODGlobalStatisticScope `class
* A special class with types for the Open Ticket `Global` statistics category/scope.
*/
export class ODGlobalStatisticScope extends api.ODStatisticGlobalScope<ODGlobalStatisticScopeIdMappings> {}
/**## ODSystemStatisticScope `class
* A special class with types for the Open Ticket `System` statistics category/scope.
*/
export class ODSystemStatisticScope extends api.ODStatisticGlobalScope<ODSystemStatisticScopeIdMappings> {}
/**## ODUserStatisticScope `class
* A special class with types for the Open Ticket `User` statistics category/scope.
*/
export class ODUserStatisticScope extends api.ODStatisticScope<ODUserStatisticScopeIdMappings> {}
/**## ODTicketStatisticScope `class
* A special class with types for the Open Ticket `Ticket` statistics category/scope.
*/
export class ODTicketStatisticScope extends api.ODStatisticScope<ODTicketStatisticScopeIdMappings> {}
/**## ODParticipantsStatisticScope `class
* A special class with types for the Open Ticket `Participants` statistics category/scope.
*/
export class ODParticipantsStatisticScope extends api.ODStatisticScope<ODParticipantsStatisticScopeIdMappings> {}
/**## ODMessagesStatisticScope `class
* A special class with types for the Open Ticket `Messages` statistics category/scope.
*/
export class ODMessagesStatisticScope extends api.ODStatisticScope<ODMessagesStatisticScopeIdMappings> {}
+4
View File
@@ -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.
*/
+5 -6
View File
@@ -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)
}))
}