Replaced #func() methods with TS: private func()
This commit is contained in:
+2
-2
@@ -26,12 +26,12 @@
|
|||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/rest": "^2.6.1",
|
"@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/node": "^22.5.0",
|
||||||
"@types/terminal-kit": "^2.5.7",
|
"@types/terminal-kit": "^2.5.7",
|
||||||
"ansis": "^4.2.0",
|
"ansis": "^4.2.0",
|
||||||
"discord.js": "^14.26.3",
|
"discord.js": "^14.26.3",
|
||||||
"formatted-json-stringify": "^1.3.0",
|
"formatted-json-stringify": "^1.3.1",
|
||||||
"terminal-kit": "^3.1.2",
|
"terminal-kit": "^3.1.2",
|
||||||
"typescript": "^6.0.3"
|
"typescript": "^6.0.3"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ export const registerActions = async () => {
|
|||||||
if (transcriptConfig.data.general.enableChannel && channelMessage){
|
if (transcriptConfig.data.general.enableChannel && channelMessage){
|
||||||
if (instance.pendingMessage && instance.pendingMessage.message && instance.pendingMessage.success){
|
if (instance.pendingMessage && instance.pendingMessage.message && instance.pendingMessage.success){
|
||||||
//edit "pending" message to be the "ready" message
|
//edit "pending" message to be the "ready" message
|
||||||
instance.pendingMessage.message.edit(channelMessage.message)
|
instance.pendingMessage.message.edit(utilities.getMessageFromBuildResult(channelMessage,"message"))
|
||||||
}else{
|
}else{
|
||||||
//send ready message to channel
|
//send ready message to channel
|
||||||
const post = opendiscord.posts.get("opendiscord:transcripts")
|
const post = opendiscord.posts.get("opendiscord:transcripts")
|
||||||
|
|||||||
@@ -12,20 +12,20 @@ import * as api from "@open-discord-bots/framework/api"
|
|||||||
*/
|
*/
|
||||||
export class ODBlacklist extends api.ODManagerData {
|
export class ODBlacklist extends api.ODManagerData {
|
||||||
/**The reason why this user got blacklisted. (optional) */
|
/**The reason why this user got blacklisted. (optional) */
|
||||||
#reason: string|null
|
private rawReason: string|null
|
||||||
|
|
||||||
constructor(id:api.ODValidId,reason:string|null){
|
constructor(id:api.ODValidId,reason:string|null){
|
||||||
super(id)
|
super(id)
|
||||||
this.#reason = reason
|
this.rawReason = reason
|
||||||
}
|
}
|
||||||
|
|
||||||
/**The reason why this user got blacklisted. (optional) */
|
/**The reason why this user got blacklisted. (optional) */
|
||||||
set reason(reason:string|null) {
|
set reason(reason:string|null) {
|
||||||
this.#reason = reason
|
this.rawReason = reason
|
||||||
this._change()
|
this._change()
|
||||||
}
|
}
|
||||||
get reason(){
|
get reason(){
|
||||||
return this.#reason
|
return this.rawReason
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+21
-24
@@ -15,19 +15,16 @@ import { ODRoleUpdateMode } from "./role.js"
|
|||||||
* All option types including: tickets, websites & reaction roles are stored here.
|
* All option types including: tickets, websites & reaction roles are stored here.
|
||||||
*/
|
*/
|
||||||
export class ODOptionManager extends api.ODManager<ODOption> {
|
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. */
|
/**The option suffix manager used to generate channel suffixes for ticket names. */
|
||||||
suffix: ODOptionSuffixManager
|
suffix: ODOptionSuffixManager
|
||||||
|
|
||||||
constructor(debug:api.ODDebugger){
|
constructor(debug:api.ODDebugger){
|
||||||
super(debug,"option")
|
super(debug,"option")
|
||||||
this.#debug = debug
|
|
||||||
this.suffix = new ODOptionSuffixManager(debug)
|
this.suffix = new ODOptionSuffixManager(debug)
|
||||||
}
|
}
|
||||||
|
|
||||||
add(data:ODOption, overwrite?:boolean): boolean {
|
add(data:ODOption, overwrite?:boolean): boolean {
|
||||||
data.useDebug(this.#debug,"option data")
|
data.useDebug(this.debug,"option data")
|
||||||
return super.add(data,overwrite)
|
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 {
|
export class ODOptionData<DataType extends api.ODValidJsonType> extends api.ODManagerData {
|
||||||
/**The value of this property. */
|
/**The value of this property. */
|
||||||
#value: DataType
|
private rawValue: DataType
|
||||||
|
|
||||||
constructor(id:api.ODValidId, value:DataType){
|
constructor(id:api.ODValidId, value:DataType){
|
||||||
super(id)
|
super(id)
|
||||||
this.#value = value
|
this.rawValue = value
|
||||||
}
|
}
|
||||||
|
|
||||||
/**The value of this property. */
|
/**The value of this property. */
|
||||||
set value(value:DataType){
|
set value(value:DataType){
|
||||||
this.#value = value
|
this.rawValue = value
|
||||||
this._change()
|
this._change()
|
||||||
}
|
}
|
||||||
get value(): DataType {
|
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. */
|
/**Refresh the database. Is only required to be used when updating `ODOptionData` with an object/array as value. */
|
||||||
refreshDatabase(){
|
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)
|
const suffix = this.getAll().find((suffix) => suffix.option.id.value == option.id.value)
|
||||||
if (!suffix) return null
|
if (!suffix) return null
|
||||||
try{
|
try{
|
||||||
const member = await this.#getMember(guild,user)
|
const member = await this.getMember(guild,user)
|
||||||
if (!member) return null
|
if (!member) return null
|
||||||
return await suffix.getSuffix(member)
|
return await suffix.getSuffix(member)
|
||||||
}catch(err){
|
}catch(err){
|
||||||
@@ -363,7 +360,7 @@ export class ODOptionSuffixManager extends api.ODManager<ODOptionSuffix> {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async #getMember(guild:discord.Guild,user:discord.User){
|
private async getMember(guild:discord.Guild,user:discord.User){
|
||||||
try{
|
try{
|
||||||
return await guild.members.fetch(user.id)
|
return await guild.members.fetch(user.id)
|
||||||
}catch{
|
}catch{
|
||||||
@@ -447,11 +444,11 @@ export class ODOptionCounterDynamicSuffix extends ODOptionSuffix {
|
|||||||
constructor(id:api.ODValidId, option:ODTicketOption, database:api.ODDatabase){
|
constructor(id:api.ODValidId, option:ODTicketOption, database:api.ODDatabase){
|
||||||
super(id,option)
|
super(id,option)
|
||||||
this.database = database
|
this.database = database
|
||||||
this.#init()
|
this.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Initialize the database for this suffix. */
|
/**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)
|
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> {
|
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){
|
constructor(id:api.ODValidId, option:ODTicketOption, database:api.ODDatabase){
|
||||||
super(id,option)
|
super(id,option)
|
||||||
this.database = database
|
this.database = database
|
||||||
this.#init()
|
this.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Initialize the database for this suffix. */
|
/**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)
|
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> {
|
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){
|
constructor(id:api.ODValidId, option:ODTicketOption, database:api.ODDatabase){
|
||||||
super(id,option)
|
super(id,option)
|
||||||
this.database = database
|
this.database = database
|
||||||
this.#init()
|
this.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Initialize the database for this suffix. */
|
/**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,[])
|
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. */
|
/**Get a unique number for this suffix. */
|
||||||
#generateUniqueValue(history:string[]): string {
|
protected generateUniqueValue(history:string[]): string {
|
||||||
const rawNumber = Math.round(Math.random()*1000).toString()
|
const rawNumber = Math.round(Math.random()*1000).toString()
|
||||||
let number = rawNumber
|
let number = rawNumber
|
||||||
if (rawNumber.length == 1) number = "000"+rawNumber
|
if (rawNumber.length == 1) number = "000"+rawNumber
|
||||||
else if (rawNumber.length == 2) number = "00"+rawNumber
|
else if (rawNumber.length == 2) number = "00"+rawNumber
|
||||||
else if (rawNumber.length == 3) number = "0"+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
|
else return number
|
||||||
}
|
}
|
||||||
async getSuffix(member:discord.GuildMember): Promise<string> {
|
async getSuffix(member:discord.GuildMember): Promise<string> {
|
||||||
const rawCurrentValues = await this.database.get("opendiscord:option-suffix-history",this.option.id.value)
|
const rawCurrentValues = await this.database.get("opendiscord:option-suffix-history",this.option.id.value)
|
||||||
const currentValues = ((Array.isArray(rawCurrentValues)) ? rawCurrentValues : []) as string[]
|
const currentValues = ((Array.isArray(rawCurrentValues)) ? rawCurrentValues : []) as string[]
|
||||||
const newValue = this.#generateUniqueValue(currentValues)
|
const newValue = this.generateUniqueValue(currentValues)
|
||||||
currentValues.push(newValue)
|
currentValues.push(newValue)
|
||||||
if (currentValues.length > 50) currentValues.shift()
|
if (currentValues.length > 50) currentValues.shift()
|
||||||
await this.database.set("opendiscord:option-suffix-history",this.option.id.value,currentValues)
|
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){
|
constructor(id:api.ODValidId, option:ODTicketOption, database:api.ODDatabase){
|
||||||
super(id,option)
|
super(id,option)
|
||||||
this.database = database
|
this.database = database
|
||||||
this.#init()
|
this.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Initialize the database for this suffix. */
|
/**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,[])
|
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. */
|
/**Get a unique hex-string for this suffix. */
|
||||||
#generateUniqueValue(history:string[]): string {
|
protected generateUniqueValue(history:string[]): string {
|
||||||
const hex = crypto.randomBytes(2).toString("hex")
|
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
|
else return hex
|
||||||
}
|
}
|
||||||
async getSuffix(member:discord.GuildMember): Promise<string> {
|
async getSuffix(member:discord.GuildMember): Promise<string> {
|
||||||
const rawCurrentValues = await this.database.get("opendiscord:option-suffix-history",this.option.id.value)
|
const rawCurrentValues = await this.database.get("opendiscord:option-suffix-history",this.option.id.value)
|
||||||
const currentValues = ((Array.isArray(rawCurrentValues)) ? rawCurrentValues : []) as string[]
|
const currentValues = ((Array.isArray(rawCurrentValues)) ? rawCurrentValues : []) as string[]
|
||||||
const newValue = this.#generateUniqueValue(currentValues)
|
const newValue = this.generateUniqueValue(currentValues)
|
||||||
currentValues.push(newValue)
|
currentValues.push(newValue)
|
||||||
if (currentValues.length > 50) currentValues.shift()
|
if (currentValues.length > 50) currentValues.shift()
|
||||||
await this.database.set("opendiscord:option-suffix-history",this.option.id.value,currentValues)
|
await this.database.set("opendiscord:option-suffix-history",this.option.id.value,currentValues)
|
||||||
|
|||||||
@@ -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.
|
* Panels are not stored in the database and will be parsed from the config every startup.
|
||||||
*/
|
*/
|
||||||
export class ODPanelManager extends api.ODManager<ODPanel> {
|
export class ODPanelManager extends api.ODManager<ODPanel> {
|
||||||
/**A reference to the Open Ticket debugger. */
|
|
||||||
#debug: api.ODDebugger
|
|
||||||
|
|
||||||
constructor(debug:api.ODDebugger){
|
constructor(debug:api.ODDebugger){
|
||||||
super(debug,"option")
|
super(debug,"option")
|
||||||
this.#debug = debug
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add(data:ODPanel, overwrite?:boolean): boolean {
|
add(data:ODPanel, overwrite?:boolean): boolean {
|
||||||
data.useDebug(this.#debug,"option data")
|
data.useDebug(this.debug,"option data")
|
||||||
return super.add(data,overwrite)
|
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 {
|
export class ODPanelData<DataType extends api.ODValidJsonType> extends api.ODManagerData {
|
||||||
/**The value of this property. */
|
/**The value of this property. */
|
||||||
#value: DataType
|
private rawValue: DataType
|
||||||
|
|
||||||
constructor(id:api.ODValidId, value:DataType){
|
constructor(id:api.ODValidId, value:DataType){
|
||||||
super(id)
|
super(id)
|
||||||
this.#value = value
|
this.rawValue = value
|
||||||
}
|
}
|
||||||
|
|
||||||
/**The value of this property. */
|
/**The value of this property. */
|
||||||
set value(value:DataType){
|
set value(value:DataType){
|
||||||
this.#value = value
|
this.rawValue = value
|
||||||
this._change()
|
this._change()
|
||||||
}
|
}
|
||||||
get value(): DataType {
|
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. */
|
/**Refresh the database. Is only required to be used when updating `ODPanelData` with an object/array as value. */
|
||||||
refreshDatabase(){
|
refreshDatabase(){
|
||||||
|
|||||||
@@ -30,12 +30,8 @@ export interface ODPriorityManagerIdMappings extends ODPriorityManagerIdConstrai
|
|||||||
* Priorities levels can be changed/updated/translated by plugins to allow for more customisability.
|
* 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> {
|
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){
|
constructor(debug:api.ODDebugger){
|
||||||
super(debug,"priority")
|
super(debug,"priority")
|
||||||
this.#debug = debug
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Get an `ODPriorityLevel` from the priority level value. Returns a dummy value when the level doesn't exist. */
|
/**Get an `ODPriorityLevel` from the priority level value. Returns a dummy value when the level doesn't exist. */
|
||||||
|
|||||||
@@ -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.
|
* Questions are not stored in the database and will be parsed from the config every startup.
|
||||||
*/
|
*/
|
||||||
export class ODQuestionManager extends api.ODManager<ODQuestion> {
|
export class ODQuestionManager extends api.ODManager<ODQuestion> {
|
||||||
/**A reference to the Open Ticket debugger. */
|
|
||||||
#debug: api.ODDebugger
|
|
||||||
|
|
||||||
constructor(debug:api.ODDebugger){
|
constructor(debug:api.ODDebugger){
|
||||||
super(debug,"question")
|
super(debug,"question")
|
||||||
this.#debug = debug
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add(data:ODQuestion, overwrite?:boolean): boolean {
|
add(data:ODQuestion, overwrite?:boolean): boolean {
|
||||||
data.useDebug(this.#debug,"question data")
|
data.useDebug(this.debug,"question data")
|
||||||
return super.add(data,overwrite)
|
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 {
|
export class ODQuestionData<DataType extends api.ODValidJsonType> extends api.ODManagerData {
|
||||||
/**The value of this property. */
|
/**The value of this property. */
|
||||||
#value: DataType
|
private rawValue: DataType
|
||||||
|
|
||||||
constructor(id:api.ODValidId, value:DataType){
|
constructor(id:api.ODValidId, value:DataType){
|
||||||
super(id)
|
super(id)
|
||||||
this.#value = value
|
this.rawValue = value
|
||||||
}
|
}
|
||||||
|
|
||||||
/**The value of this property. */
|
/**The value of this property. */
|
||||||
set value(value:DataType){
|
set value(value:DataType){
|
||||||
this.#value = value
|
this.rawValue = value
|
||||||
this._change()
|
this._change()
|
||||||
}
|
}
|
||||||
get value(): DataType {
|
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. */
|
/**Refresh the database. Is only required to be used when updating `ODQuestionData` with an object/array as value. */
|
||||||
refreshDatabase(){
|
refreshDatabase(){
|
||||||
|
|||||||
@@ -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.
|
* Roles are not stored in the database and will be parsed from the config every startup.
|
||||||
*/
|
*/
|
||||||
export class ODRoleManager extends api.ODManager<ODRole> {
|
export class ODRoleManager extends api.ODManager<ODRole> {
|
||||||
/**A reference to the Open Ticket debugger. */
|
|
||||||
#debug: api.ODDebugger
|
|
||||||
|
|
||||||
constructor(debug:api.ODDebugger){
|
constructor(debug:api.ODDebugger){
|
||||||
super(debug,"role")
|
super(debug,"role")
|
||||||
this.#debug = debug
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add(data:ODRole, overwrite?:boolean): boolean {
|
add(data:ODRole, overwrite?:boolean): boolean {
|
||||||
data.useDebug(this.#debug,"role data")
|
data.useDebug(this.debug,"role data")
|
||||||
return super.add(data,overwrite)
|
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 {
|
export class ODRoleData<DataType extends api.ODValidJsonType> extends api.ODManagerData {
|
||||||
/**The value of this property. */
|
/**The value of this property. */
|
||||||
#value: DataType
|
private rawValue: DataType
|
||||||
|
|
||||||
constructor(id:api.ODValidId, value:DataType){
|
constructor(id:api.ODValidId, value:DataType){
|
||||||
super(id)
|
super(id)
|
||||||
this.#value = value
|
this.rawValue = value
|
||||||
}
|
}
|
||||||
|
|
||||||
/**The value of this property. */
|
/**The value of this property. */
|
||||||
set value(value:DataType){
|
set value(value:DataType){
|
||||||
this.#value = value
|
this.rawValue = value
|
||||||
this._change()
|
this._change()
|
||||||
}
|
}
|
||||||
get value(): DataType {
|
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. */
|
/**Refresh the database. Is only required to be used when updating `ODRoleData` with an object/array as value. */
|
||||||
refreshDatabase(){
|
refreshDatabase(){
|
||||||
|
|||||||
+27
-30
@@ -14,31 +14,28 @@ import * as discord from "discord.js"
|
|||||||
*/
|
*/
|
||||||
export class ODTicketManager extends api.ODManager<ODTicket> {
|
export class ODTicketManager extends api.ODManager<ODTicket> {
|
||||||
/**A reference to the main server of the bot */
|
/**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. */
|
/**A reference to the Open Ticket client manager. */
|
||||||
#client: api.ODClientManager
|
private client: api.ODClientManager
|
||||||
/**A reference to the Open Ticket debugger. */
|
|
||||||
#debug: api.ODDebugger
|
|
||||||
|
|
||||||
constructor(debug:api.ODDebugger, client:api.ODClientManager){
|
constructor(debug:api.ODDebugger, client:api.ODClientManager){
|
||||||
super(debug,"ticket")
|
super(debug,"ticket")
|
||||||
this.#debug = debug
|
this.client = client
|
||||||
this.#client = client
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add(data:ODTicket, overwrite?:boolean): boolean {
|
add(data:ODTicket, overwrite?:boolean): boolean {
|
||||||
data.useDebug(this.#debug,"ticket data")
|
data.useDebug(this.debug,"ticket data")
|
||||||
return super.add(data,overwrite)
|
return super.add(data,overwrite)
|
||||||
}
|
}
|
||||||
/**Use a specific guild in this class for fetching the channel*/
|
/**Use a specific guild in this class for fetching the channel*/
|
||||||
useGuild(guild:discord.Guild|null){
|
useGuild(guild:discord.Guild|null){
|
||||||
this.#guild = guild
|
this.guild = guild
|
||||||
}
|
}
|
||||||
/**Get the discord channel for a specific ticket. */
|
/**Get the discord channel for a specific ticket. */
|
||||||
async getTicketChannel(ticket:ODTicket): Promise<discord.GuildTextBasedChannel|null> {
|
async getTicketChannel(ticket:ODTicket): Promise<discord.GuildTextBasedChannel|null> {
|
||||||
if (!this.#guild) return null
|
if (!this.guild) return null
|
||||||
try {
|
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
|
if (!channel || !channel.isTextBased()) return null
|
||||||
return channel
|
return channel
|
||||||
}catch{
|
}catch{
|
||||||
@@ -48,7 +45,7 @@ export class ODTicketManager extends api.ODManager<ODTicket> {
|
|||||||
/**Get the main ticket message of a ticket channel when found. */
|
/**Get the main ticket message of a ticket channel when found. */
|
||||||
async getTicketMessage(ticket:ODTicket): Promise<discord.Message<true>|null> {
|
async getTicketMessage(ticket:ODTicket): Promise<discord.Message<true>|null> {
|
||||||
const msgId = ticket.get("opendiscord:ticket-message").value
|
const msgId = ticket.get("opendiscord:ticket-message").value
|
||||||
if (!this.#guild || !msgId) return null
|
if (!this.guild || !msgId) return null
|
||||||
try {
|
try {
|
||||||
const channel = await this.getTicketChannel(ticket)
|
const channel = await this.getTicketChannel(ticket)
|
||||||
if (!channel) return null
|
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. */
|
/**Shortcut for getting a discord.js user within a ticket. */
|
||||||
async getTicketUser(ticket:ODTicket, user:"creator"|"closer"|"claimer"|"pinner"): Promise<discord.User|null> {
|
async getTicketUser(ticket:ODTicket, user:"creator"|"closer"|"claimer"|"pinner"): Promise<discord.User|null> {
|
||||||
if (!this.#guild) return null
|
if (!this.guild) return null
|
||||||
try {
|
try {
|
||||||
if (user == "creator"){
|
if (user == "creator"){
|
||||||
const creatorId = ticket.get("opendiscord:opened-by").value
|
const creatorId = ticket.get("opendiscord:opened-by").value
|
||||||
if (!creatorId) return null
|
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"){
|
}else if (user == "closer"){
|
||||||
const closerId = ticket.get("opendiscord:closed-by").value
|
const closerId = ticket.get("opendiscord:closed-by").value
|
||||||
if (!closerId) return null
|
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"){
|
}else if (user == "claimer"){
|
||||||
const claimerId = ticket.get("opendiscord:claimed-by").value
|
const claimerId = ticket.get("opendiscord:claimed-by").value
|
||||||
if (!claimerId) return null
|
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"){
|
}else if (user == "pinner"){
|
||||||
const pinnerId = ticket.get("opendiscord:pinned-by").value
|
const pinnerId = ticket.get("opendiscord:pinned-by").value
|
||||||
if (!pinnerId) return null
|
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
|
}else return null
|
||||||
}catch {return null}
|
}catch {return null}
|
||||||
}
|
}
|
||||||
/**Shortcut for getting all users that are able to view a ticket. */
|
/**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> {
|
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 final: {user:discord.User,role:"creator"|"participant"|"admin"}[] = []
|
||||||
const channel = await this.getTicketChannel(ticket)
|
const channel = await this.getTicketChannel(ticket)
|
||||||
if (!channel) return null
|
if (!channel) return null
|
||||||
@@ -94,7 +91,7 @@ export class ODTicketManager extends api.ODManager<ODTicket> {
|
|||||||
//add creator
|
//add creator
|
||||||
const creatorId = ticket.get("opendiscord:opened-by").value
|
const creatorId = ticket.get("opendiscord:opened-by").value
|
||||||
if (creatorId){
|
if (creatorId){
|
||||||
const creator = await this.#client.fetchUser(creatorId)
|
const creator = await this.client.fetchUser(creatorId)
|
||||||
if (creator) final.push({user:creator,role:"creator"})
|
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")
|
const participants = ticket.get("opendiscord:participants").value.filter((p) => p.type == "user")
|
||||||
for (const p of participants){
|
for (const p of participants){
|
||||||
if (!final.find((u) => u.user.id == p.id)){
|
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"})
|
if (participant) final.push({user:participant,role:"participant"})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,7 +107,7 @@ export class ODTicketManager extends api.ODManager<ODTicket> {
|
|||||||
//add admin roles
|
//add admin roles
|
||||||
const roles = ticket.get("opendiscord:participants").value.filter((p) => p.type == "role")
|
const roles = ticket.get("opendiscord:participants").value.filter((p) => p.type == "role")
|
||||||
for (const r of roles){
|
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){
|
if (role){
|
||||||
role.members.forEach((member) => {
|
role.members.forEach((member) => {
|
||||||
if (final.find((u) => u.user.id == member.id)) return
|
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>> {
|
export class ODTicket extends api.ODManager<ODTicketData<api.ODValidJsonType>> {
|
||||||
/**The id of this ticket. (discord channel id) */
|
/**The id of this ticket. (discord channel id) */
|
||||||
id:api.ODId
|
id:api.ODId
|
||||||
/**The option related to this ticket. */
|
/**The option this ticket is made of. */
|
||||||
#option: ODTicketOption
|
private rawOption: ODTicketOption
|
||||||
|
|
||||||
constructor(id:api.ODValidId, option:ODTicketOption, data:ODTicketData<api.ODValidJsonType>[]){
|
constructor(id:api.ODValidId, option:ODTicketOption, data:ODTicketData<api.ODValidJsonType>[]){
|
||||||
super()
|
super()
|
||||||
this.id = new api.ODId(id)
|
this.id = new api.ODId(id)
|
||||||
this.#option = option
|
this.rawOption = option
|
||||||
data.forEach((data) => {
|
data.forEach((data) => {
|
||||||
this.add(data)
|
this.add(data)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**The option related to this ticket. */
|
/**The option this ticket is made of. */
|
||||||
set option(option:ODTicketOption){
|
set option(option:ODTicketOption){
|
||||||
this.#option = option
|
this.rawOption = option
|
||||||
this._change()
|
this._change()
|
||||||
}
|
}
|
||||||
get option(){
|
get option(){
|
||||||
return this.#option
|
return this.rawOption
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Convert this ticket to a JSON object for storing this ticket in the database. */
|
/**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 {
|
export class ODTicketData<DataType extends api.ODValidJsonType> extends api.ODManagerData {
|
||||||
/**The value of this property. */
|
/**The value of this property. */
|
||||||
#value: DataType
|
private rawValue: DataType
|
||||||
|
|
||||||
constructor(id:api.ODValidId, value:DataType){
|
constructor(id:api.ODValidId, value:DataType){
|
||||||
super(id)
|
super(id)
|
||||||
this.#value = value
|
this.rawValue = value
|
||||||
}
|
}
|
||||||
|
|
||||||
/**The value of this property. */
|
/**The value of this property. */
|
||||||
set value(value:DataType){
|
set value(value:DataType){
|
||||||
this.#value = value
|
this.rawValue = value
|
||||||
this._change()
|
this._change()
|
||||||
}
|
}
|
||||||
get value(): DataType {
|
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. */
|
/**Refresh the database. Is only required to be used when updating `ODTicketData` with an object/array as value. */
|
||||||
refreshDatabase(){
|
refreshDatabase(){
|
||||||
|
|||||||
+28
-28
@@ -30,11 +30,11 @@ export class ODTranscriptManager<IdList extends ODTranscriptManagerIdConstraint
|
|||||||
/**The manager responsible for collecting all messages in a channel. */
|
/**The manager responsible for collecting all messages in a channel. */
|
||||||
collector: ODTranscriptCollector
|
collector: ODTranscriptCollector
|
||||||
/**Alias for the client manager. */
|
/**Alias for the client manager. */
|
||||||
#client: api.ODClientManager
|
private client: api.ODClientManager
|
||||||
|
|
||||||
constructor(debug:api.ODDebugger, tickets:ODTicketManager, client:api.ODClientManager, permissions:api.ODPermissionManager){
|
constructor(debug:api.ODDebugger, tickets:ODTicketManager, client:api.ODClientManager, permissions:api.ODPermissionManager){
|
||||||
super(debug,"transcript compiler")
|
super(debug,"transcript compiler")
|
||||||
this.#client = client
|
this.client = client
|
||||||
this.collector = new ODTranscriptCollector(tickets,client,permissions)
|
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. */
|
/**When not successfull, what was the reason? This will also be shown to the user. */
|
||||||
errorReason:string|null,
|
errorReason:string|null,
|
||||||
/**An optional message which will be sent while the transcript is being generated. */
|
/**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. */
|
/**An optional object containing data from the init() function which can be used in the compiler. */
|
||||||
initData:InitData,
|
initData:InitData,
|
||||||
}
|
}
|
||||||
@@ -119,15 +119,15 @@ export interface ODTranscriptCompilerCompileResult<Data extends object> {
|
|||||||
*/
|
*/
|
||||||
export interface ODTranscriptCompilerReadyResult {
|
export interface ODTranscriptCompilerReadyResult {
|
||||||
/**The message to be sent in the specified channel in the server. */
|
/**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. */
|
/**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. */
|
/**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. */
|
/**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. */
|
/**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`
|
/**## ODTranscriptCompiler `class`
|
||||||
@@ -162,22 +162,22 @@ export class ODTranscriptCompiler<Data extends object,InitData extends (object|n
|
|||||||
*/
|
*/
|
||||||
export class ODTranscriptCollector {
|
export class ODTranscriptCollector {
|
||||||
/**Alias for the ticket manager. */
|
/**Alias for the ticket manager. */
|
||||||
#tickets: ODTicketManager
|
private tickets: ODTicketManager
|
||||||
/**Alias for the client manager. */
|
/**Alias for the client manager. */
|
||||||
#client: api.ODClientManager
|
private client: api.ODClientManager
|
||||||
/**Alias for the permissions manager. */
|
/**Alias for the permissions manager. */
|
||||||
#permissions: api.ODPermissionManager
|
private permissions: api.ODPermissionManager
|
||||||
|
|
||||||
constructor(tickets:ODTicketManager,client:api.ODClientManager,permissions:api.ODPermissionManager){
|
constructor(tickets:ODTicketManager,client:api.ODClientManager,permissions:api.ODPermissionManager){
|
||||||
this.#tickets = tickets
|
this.tickets = tickets
|
||||||
this.#client = client
|
this.client = client
|
||||||
this.#permissions = permissions
|
this.permissions = permissions
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Collect all messages from a given ticket channel. It may not include all messages depending on the ratelimit. */
|
/**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> {
|
async collectAllMessages(ticket:ODTicket, include?:ODTranscriptCollectorIncludeSettings): Promise<discord.Message<true>[]|null> {
|
||||||
const newInclude: ODTranscriptCollectorIncludeSettings = include ?? {users:true,bots:true,client:true}
|
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
|
if (!channel) return null
|
||||||
|
|
||||||
const final: discord.Message<true>[] = []
|
const final: discord.Message<true>[] = []
|
||||||
@@ -213,7 +213,7 @@ export class ODTranscriptCollector {
|
|||||||
const {guild,channel,id,createdTimestamp} = msg
|
const {guild,channel,id,createdTimestamp} = msg
|
||||||
|
|
||||||
//create message author
|
//create message author
|
||||||
const author = this.#handleUserData(msg.author,msg.member)
|
const author = this.handleUserData(msg.author,msg.member)
|
||||||
|
|
||||||
//create message type
|
//create message type
|
||||||
let type: ODTranscriptMessageType = "default"
|
let type: ODTranscriptMessageType = "default"
|
||||||
@@ -269,8 +269,8 @@ export class ODTranscriptCollector {
|
|||||||
disabled:component.disabled,
|
disabled:component.disabled,
|
||||||
type:"button",
|
type:"button",
|
||||||
label:component.label,
|
label:component.label,
|
||||||
emoji:this.#handleComponentEmoji(msg,component.emoji),
|
emoji:this.handleComponentEmoji(msg,component.emoji),
|
||||||
color:this.#handleButtonComponentStyle(component.style),
|
color:this.handleButtonComponentStyle(component.style),
|
||||||
mode:(component.style == discord.ButtonStyle.Link) ? "url" : "button",
|
mode:(component.style == discord.ButtonStyle.Link) ? "url" : "button",
|
||||||
url:component.url
|
url:component.url
|
||||||
})
|
})
|
||||||
@@ -285,7 +285,7 @@ export class ODTranscriptCollector {
|
|||||||
id:option.value,
|
id:option.value,
|
||||||
label:option.label,
|
label:option.label,
|
||||||
description:option.description ?? null,
|
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()){
|
if (replyChannel && !replyChannel.isDMBased() && replyChannel.isTextBased()){
|
||||||
const replyMessage = await replyChannel.messages.fetch(msg.reference.messageId)
|
const replyMessage = await replyChannel.messages.fetch(msg.reference.messageId)
|
||||||
if (replyMessage){
|
if (replyMessage){
|
||||||
const replyUser = this.#handleUserData(replyMessage.author,replyMessage.member)
|
const replyUser = this.handleUserData(replyMessage.author,replyMessage.member)
|
||||||
|
|
||||||
reply = {
|
reply = {
|
||||||
type:"message",
|
type:"message",
|
||||||
@@ -320,7 +320,7 @@ export class ODTranscriptCollector {
|
|||||||
}else if (msg.interactionMetadata){
|
}else if (msg.interactionMetadata){
|
||||||
try{
|
try{
|
||||||
//get slash command name from undocumented property in discord REST API
|
//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"
|
const commandName = restMsg.interaction_metadata.name ?? "unknown-command"
|
||||||
//slash command reply
|
//slash command reply
|
||||||
let member: discord.GuildMember|null = null
|
let member: discord.GuildMember|null = null
|
||||||
@@ -330,7 +330,7 @@ export class ODTranscriptCollector {
|
|||||||
reply = {
|
reply = {
|
||||||
type:"interaction",
|
type:"interaction",
|
||||||
name:commandName,
|
name:commandName,
|
||||||
user:this.#handleUserData(msg.interactionMetadata.user,member)
|
user:this.handleUserData(msg.interactionMetadata.user,member)
|
||||||
}
|
}
|
||||||
}catch(err){
|
}catch(err){
|
||||||
process.emit("uncaughtException",err)
|
process.emit("uncaughtException",err)
|
||||||
@@ -395,7 +395,7 @@ export class ODTranscriptCollector {
|
|||||||
else return {size:Math.round(bytes/(1024*1024*1024*1024)),unit:"TB"}
|
else return {size:Math.round(bytes/(1024*1024*1024*1024)),unit:"TB"}
|
||||||
}
|
}
|
||||||
/**Get the `ODTranscriptEmojiData` from a discord.js component emoji. */
|
/**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
|
if (!rawEmoji) return null
|
||||||
//return built-in emoji
|
//return built-in emoji
|
||||||
if (rawEmoji.name) return {
|
if (rawEmoji.name) return {
|
||||||
@@ -418,14 +418,14 @@ export class ODTranscriptCollector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**Create the `ODValidButtonColor` from the discord.js button style. */
|
/**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"
|
if (style == discord.ButtonStyle.Danger) return "red"
|
||||||
else if (style == discord.ButtonStyle.Success) return "green"
|
else if (style == discord.ButtonStyle.Success) return "green"
|
||||||
else if (style == discord.ButtonStyle.Primary) return "blue"
|
else if (style == discord.ButtonStyle.Primary) return "blue"
|
||||||
else return "gray"
|
else return "gray"
|
||||||
}
|
}
|
||||||
/**Create the `ODTranscriptUserData` from a discord.js user. */
|
/**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 = {
|
const userData: ODTranscriptUserData = {
|
||||||
id:user.id,
|
id:user.id,
|
||||||
username:user.username,
|
username:user.username,
|
||||||
@@ -450,10 +450,10 @@ export class ODTranscriptCollector {
|
|||||||
let adminMessages = 0
|
let adminMessages = 0
|
||||||
|
|
||||||
for (const msg of parsedMessages){
|
for (const msg of parsedMessages){
|
||||||
if (msg.author.tag || msg.author.id == this.#client.client.user.id) continue
|
if (msg.author.tag || msg.author.id == this.client.client.user.id) continue
|
||||||
const user = await this.#client.fetchUser(msg.author.id)
|
const user = await this.client.fetchUser(msg.author.id)
|
||||||
if (!user) continue
|
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++
|
if (isAdmin) adminMessages++
|
||||||
else userMessages++
|
else userMessages++
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ export class ODOpenTicketMain extends api.ODMain {
|
|||||||
const debug = new api.ODDebugger(console)
|
const debug = new api.ODDebugger(console)
|
||||||
const client = new api.ODMappedClientManager(debug)
|
const client = new api.ODMappedClientManager(debug)
|
||||||
const livestatus = new api.ODMappedLiveStatusManager(debug,console)
|
const livestatus = new api.ODMappedLiveStatusManager(debug,console)
|
||||||
const permissions = new api.ODMappedPermissionManager(debug,client)
|
const permissions = new api.ODMappedPermissionManager(debug,client,true)
|
||||||
|
|
||||||
super({
|
super({
|
||||||
versions:new api.ODMappedVersionManager(),
|
versions:new api.ODMappedVersionManager(),
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export interface ODActionManagerIdMappings extends api.ODActionManagerIdConstrai
|
|||||||
"opendiscord:create-transcript":{
|
"opendiscord:create-transcript":{
|
||||||
origin:"slash"|"text"|"ticket-message"|"reopen-message"|"close-message"|"autoclose-message"|"autodelete"|"clear"|"other",
|
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},
|
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"
|
workers:"opendiscord:select-compiler"|"opendiscord:init-transcript"|"opendiscord:compile-transcript"|"opendiscord:ready-transcript"|"opendiscord:logs"
|
||||||
},
|
},
|
||||||
"opendiscord:create-ticket":{
|
"opendiscord:create-ticket":{
|
||||||
@@ -130,6 +130,10 @@ export interface ODActionManagerIdMappings extends api.ODActionManagerIdConstrai
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedActionManager `class
|
/**## ODMappedActionManager `class
|
||||||
* A special class with types for the Open Ticket `ODActionManager` class.
|
* A special class with types for the Open Ticket `ODActionManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ export interface ODVersionManagerIdMappings extends api.ODVersionManagerIdConstr
|
|||||||
"opendiscord:livestatus":api.ODVersion
|
"opendiscord:livestatus":api.ODVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedVersionManager `class
|
/**## ODMappedVersionManager `class
|
||||||
* A special class with types for the Open Ticket `ODVersionManager` class.
|
* A special class with types for the Open Ticket `ODVersionManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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"}
|
"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
|
/**## ODMappedButtonManager `class
|
||||||
* A special class with types for the Open Ticket `ODButtonManager` class.
|
* A special class with types for the Open Ticket `ODButtonManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -129,6 +129,10 @@ export interface ODCheckerFunctionManagerIdMappings extends api.ODCheckerFunctio
|
|||||||
"opendiscord:dropdown-options":api.ODCheckerFunction
|
"opendiscord:dropdown-options":api.ODCheckerFunction
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedCheckerManager `class
|
/**## ODMappedCheckerManager `class
|
||||||
* A special class with types for the Open Ticket `ODCheckerManager` class.
|
* A special class with types for the Open Ticket `ODCheckerManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -88,6 +88,10 @@ export interface ODContextMenuManagerIdMappings extends api.ODContextMenuManager
|
|||||||
//"opendiscord:test-menu":ODContextMenu
|
//"opendiscord:test-menu":ODContextMenu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedClientManager `class
|
/**## ODMappedClientManager `class
|
||||||
* A special class with types for the Open Ticket `ODClientManager` class.
|
* A special class with types for the Open Ticket `ODClientManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ export interface ODCodeManagerIdMappings extends api.ODCodeManagerIdConstraint {
|
|||||||
"opendiscord:ticket-anti-busy":api.ODCode,
|
"opendiscord:ticket-anti-busy":api.ODCode,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedCodeManager `class
|
/**## ODMappedCodeManager `class
|
||||||
* A special class with types for the Open Ticket `ODCodeManager` class.
|
* A special class with types for the Open Ticket `ODCodeManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
+34
-30
@@ -37,36 +37,6 @@ export interface ODConfigManagerIdMappings extends api.ODConfigManagerIdConstrai
|
|||||||
"opendiscord:transcripts":ODTranscriptsJsonConfig
|
"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
|
// CONFIG STRUCTURES, VALUES & TYPES
|
||||||
// --> general.json
|
// --> general.json
|
||||||
@@ -800,3 +770,37 @@ export interface ODTranscriptsJsonConfig_TranscriptsData {
|
|||||||
/**The layout of the HTML transcripts. */
|
/**The layout of the HTML transcripts. */
|
||||||
htmlTranscriptStyle:ODTranscriptsJsonConfig_TranscriptsHtmlLayout
|
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> {}
|
||||||
@@ -11,6 +11,10 @@ export interface ODLiveStatusManagerIdMappings extends api.ODLiveStatusManagerId
|
|||||||
"opendiscord:default-djdj-dev":api.ODLiveStatusUrlSource
|
"opendiscord:default-djdj-dev":api.ODLiveStatusUrlSource
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedLiveStatusManager `class
|
/**## ODMappedLiveStatusManager `class
|
||||||
* A special class with types for the Open Ticket `ODLiveStatusManager` class.
|
* A special class with types for the Open Ticket `ODLiveStatusManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ export interface ODCooldownManagerIdMappings extends api.ODCooldownManagerIdCons
|
|||||||
//"opendiscord:cooldown":api.ODCooldown
|
//"opendiscord:cooldown":api.ODCooldown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedCooldownManager `class
|
/**## ODMappedCooldownManager `class
|
||||||
* A special class with types for the Open Ticket `ODCooldownManager` class.
|
* A special class with types for the Open Ticket `ODCooldownManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,36 +17,6 @@ export interface ODDatabaseManagerIdMappings extends api.ODDatabaseManagerIdCons
|
|||||||
"opendiscord:options":ODOptionsDatabase,
|
"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
|
// DATABASE MAPPINGS, CATEGORIES & TYPES
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
@@ -86,3 +56,37 @@ export interface ODUsersDatabaseIdMappings extends api.ODDatabaseIdConstraint {
|
|||||||
export interface ODOptionsDatabaseIdMappings extends api.ODDatabaseIdConstraint {
|
export interface ODOptionsDatabaseIdMappings extends api.ODDatabaseIdConstraint {
|
||||||
"opendiscord:used-option":ODOptionJson
|
"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> {}
|
||||||
@@ -333,6 +333,10 @@ export interface ODEventManagerIdMappings extends api.ODEventManagerIdConstraint
|
|||||||
"onReadyForUsage": api.ODEvent<() => api.ODPromiseVoid>
|
"onReadyForUsage": api.ODEvent<() => api.ODPromiseVoid>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedEventManager `class
|
/**## ODMappedEventManager `class
|
||||||
* A special class with types for the Open Ticket `ODEventManager` class.
|
* A special class with types for the Open Ticket `ODEventManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ export interface ODFlagManagerIdMappings extends api.ODFlagManagerIdConstraint {
|
|||||||
"opendiscord:cli":api.ODFlag,
|
"opendiscord:cli":api.ODFlag,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedFlagManager `class
|
/**## ODMappedFlagManager `class
|
||||||
* A special class with types for the Open Ticket `ODFlagManager` class.
|
* A special class with types for the Open Ticket `ODFlagManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -27,46 +27,6 @@ export interface ODHelpMenuManagerIdMappings extends api.ODHelpMenuManagerIdCons
|
|||||||
"opendiscord:extra":ODExtraHelpMenuCategory
|
"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
|
// HELP MENU MAPPINGS, CATEGORIES & TYPES
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
@@ -149,3 +109,47 @@ export interface ODAdvancedHelpMenuCategoryIdMappings extends api.ODHelpMenuCate
|
|||||||
export interface ODExtraHelpMenuCategoryIdMappings extends api.ODHelpMenuCategoryIdConstraint {
|
export interface ODExtraHelpMenuCategoryIdMappings extends api.ODHelpMenuCategoryIdConstraint {
|
||||||
//"opendiscord:help-component":api.ODHelpMenuCommandComponent
|
//"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> {}
|
||||||
@@ -622,6 +622,10 @@ export type ODLanguageManagerTranslationIdMappings = (
|
|||||||
"priorities.none"
|
"priorities.none"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedLanguageManager `class
|
/**## ODMappedLanguageManager `class
|
||||||
* A special class with types for the Open Ticket `ODLanguageManager` class.
|
* A special class with types for the Open Ticket `ODLanguageManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,11 +11,6 @@ export interface ODPermissionManagerIdMappings extends api.ODPermissionManagerId
|
|||||||
//"opendiscord:test-permission":api.ODPermission
|
//"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`
|
/**## ODPermissionEmbedType `type`
|
||||||
* A collection of all types available in the `opendiscord:no-permissions` embed.
|
* A collection of all types available in the `opendiscord:no-permissions` embed.
|
||||||
*/
|
*/
|
||||||
@@ -28,3 +23,12 @@ export type ODPermissionEmbedType = (
|
|||||||
"member"|
|
"member"|
|
||||||
"discord-administrator"
|
"discord-administrator"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
|
/**## ODMappedPermissionManager `class
|
||||||
|
* A special class with types for the Open Ticket `ODPermissionManager` class.
|
||||||
|
*/
|
||||||
|
export class ODMappedPermissionManager extends api.ODPermissionManager<ODPermissionManagerIdMappings> {}
|
||||||
@@ -19,6 +19,10 @@ export interface ODPluginClassManagerIdMappings extends api.ODPluginClassManager
|
|||||||
//"opendiscord:example-plugin":any
|
//"opendiscord:example-plugin":any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedPluginManager `class
|
/**## ODMappedPluginManager `class
|
||||||
* A special class with types for the Open Ticket `ODPluginManager` class.
|
* A special class with types for the Open Ticket `ODPluginManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ export interface ODPostManagerIdMappings extends api.ODPostManagerIdConstraint {
|
|||||||
"opendiscord:transcripts":api.ODPost<discord.GuildTextBasedChannel>|null
|
"opendiscord:transcripts":api.ODPost<discord.GuildTextBasedChannel>|null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedPostManager `class
|
/**## ODMappedPostManager `class
|
||||||
* A special class with types for the Open Ticket `ODPostManager` class.
|
* A special class with types for the Open Ticket `ODPostManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ export interface ODProgressBarRendererManagerIdMappings extends api.ODProgressBa
|
|||||||
"opendiscord:time-min-renderer":api.ODDefaultProgressBarRenderer,
|
"opendiscord:time-min-renderer":api.ODDefaultProgressBarRenderer,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedProgressBarManager `class
|
/**## ODMappedProgressBarManager `class
|
||||||
* A special class with types for the Open Ticket `ODProgressBarManager` class.
|
* A special class with types for the Open Ticket `ODProgressBarManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -103,6 +103,10 @@ export interface ODAutocompleteResponderManagerIdMappings extends api.ODAutocomp
|
|||||||
"opendiscord:option-id":{origin:"autocomplete",params:{},workers:"opendiscord:option-id"}
|
"opendiscord:option-id":{origin:"autocomplete",params:{},workers:"opendiscord:option-id"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedCommandResponderManager `class
|
/**## ODMappedCommandResponderManager `class
|
||||||
* A special class with types for the Open Ticket `ODCommandResponderManager` class.
|
* A special class with types for the Open Ticket `ODCommandResponderManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ export interface ODSessionManagerIdMappings extends api.ODSessionManagerIdConstr
|
|||||||
//"opendiscord:example-session":api.ODSession
|
//"opendiscord:example-session":api.ODSession
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedSessionManager `class
|
/**## ODMappedSessionManager `class
|
||||||
* A special class with types for the Open Ticket `ODSessionManager` class.
|
* A special class with types for the Open Ticket `ODSessionManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ export interface ODStartScreenManagerIdMappings extends api.ODStartScreenManager
|
|||||||
"opendiscord:logs":api.ODStartScreenCategoryComponent
|
"opendiscord:logs":api.ODStartScreenCategoryComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedStartScreenManager `class
|
/**## ODMappedStartScreenManager `class
|
||||||
* A special class with types for the Open Ticket `ODStartScreenManager` class.
|
* A special class with types for the Open Ticket `ODStartScreenManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,41 +16,6 @@ export interface ODStatisticManagerIdMappings extends api.ODStatisticManagerIdCo
|
|||||||
"opendiscord:messages":ODMessagesStatisticScope,
|
"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
|
// STATISTICS MAPPINGS, CATEGORIES & TYPES
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
@@ -137,3 +102,42 @@ export interface ODParticipantsStatisticScopeIdMappings extends api.ODStatisticS
|
|||||||
export interface ODMessagesStatisticScopeIdMappings extends api.ODStatisticScopeIdConstraint {
|
export interface ODMessagesStatisticScopeIdMappings extends api.ODStatisticScopeIdConstraint {
|
||||||
"opendiscord:count":api.ODDynamicStatistic
|
"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> {}
|
||||||
@@ -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"}
|
"opendiscord:delete-ticket-autoclose-message":{successWorkerIds:"opendiscord:permissions"|"opendiscord:delete-ticket",failureWorkerIds:"opendiscord:back-to-autoclose-message"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
////// MAPPED MANAGERS //////
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
/**## ODMappedVerifyBarManager `class
|
/**## ODMappedVerifyBarManager `class
|
||||||
* A special class with types for the Open Ticket `ODVerifyBarManager` class.
|
* A special class with types for the Open Ticket `ODVerifyBarManager` class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -37,22 +37,21 @@ export const loadCommandErrorHandlingCode = async () => {
|
|||||||
|
|
||||||
//responder timeout
|
//responder timeout
|
||||||
opendiscord.responders.commands.setTimeoutErrorCallback(async (instance,source) => {
|
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)
|
},null)
|
||||||
opendiscord.responders.buttons.setTimeoutErrorCallback(async (instance,source) => {
|
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)
|
},null)
|
||||||
opendiscord.responders.dropdowns.setTimeoutErrorCallback(async (instance,source) => {
|
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)
|
},null)
|
||||||
opendiscord.responders.modals.setTimeoutErrorCallback(async (instance,source) => {
|
opendiscord.responders.modals.setTimeoutErrorCallback(async (instance,source) => {
|
||||||
if (!instance.channel){
|
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!**"
|
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)
|
},null)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user