Fixed stats not displaying with SQLite plugin

Lot's of stats were hidden in the embed when using the ot-sqlite-database plugin. This was caused by a recent API breaking-change that made everything async.

The problem wasn't related to the plugin itself, but the Open Ticket api. Updating the plugin is not required.
This commit is contained in:
DJj123dj
2024-12-05 22:10:02 +01:00
parent 42ff447a94
commit 5d86269743
12 changed files with 88 additions and 88 deletions
+2 -2
View File
@@ -22,8 +22,8 @@ export const registerActions = async () => {
ticket.get("openticket:busy").value = true ticket.get("openticket:busy").value = true
//update stats //update stats
openticket.stats.get("openticket:global").setStat("openticket:tickets-claimed",1,"increase") await openticket.stats.get("openticket:global").setStat("openticket:tickets-claimed",1,"increase")
openticket.stats.get("openticket:user").setStat("openticket:tickets-claimed",user.id,1,"increase") await openticket.stats.get("openticket:user").setStat("openticket:tickets-claimed",user.id,1,"increase")
//update category //update category
const rawClaimCategory = ticket.option.get("openticket:channel-categories-claimed").value.find((c) => c.user == user.id) const rawClaimCategory = ticket.option.get("openticket:channel-categories-claimed").value.find((c) => c.user == user.id)
+2 -2
View File
@@ -24,8 +24,8 @@ export const registerActions = async () => {
ticket.get("openticket:busy").value = true ticket.get("openticket:busy").value = true
//update stats //update stats
openticket.stats.get("openticket:global").setStat("openticket:tickets-closed",1,"increase") await openticket.stats.get("openticket:global").setStat("openticket:tickets-closed",1,"increase")
openticket.stats.get("openticket:user").setStat("openticket:tickets-closed",user.id,1,"increase") await openticket.stats.get("openticket:user").setStat("openticket:tickets-closed",user.id,1,"increase")
//update category //update category
const closeCategory = ticket.option.get("openticket:channel-category-closed").value const closeCategory = ticket.option.get("openticket:channel-category-closed").value
+3 -3
View File
@@ -159,8 +159,8 @@ export const registerActions = async () => {
]) ])
//manage stats //manage stats
openticket.stats.get("openticket:global").setStat("openticket:tickets-created",1,"increase") await openticket.stats.get("openticket:global").setStat("openticket:tickets-created",1,"increase")
openticket.stats.get("openticket:user").setStat("openticket:tickets-created",user.id,1,"increase") await openticket.stats.get("openticket:user").setStat("openticket:tickets-created",user.id,1,"increase")
//manage bot permissions //manage bot permissions
await openticket.events.get("onTicketPermissionsCreated").emit([option,openticket.permissions,channel,user]) await openticket.events.get("onTicketPermissionsCreated").emit([option,openticket.permissions,channel,user])
@@ -187,7 +187,7 @@ export const registerActions = async () => {
ticket.get("openticket:ticket-message").value = msg.id ticket.get("openticket:ticket-message").value = msg.id
//manage stats //manage stats
openticket.stats.get("openticket:ticket").setStat("openticket:messages-sent",ticket.id.value,1,"increase") await openticket.stats.get("openticket:ticket").setStat("openticket:messages-sent",ticket.id.value,1,"increase")
await openticket.events.get("afterTicketMainMessageCreated").emit([ticket,msg,channel,user]) await openticket.events.get("afterTicketMainMessageCreated").emit([ticket,msg,channel,user])
}catch(err){ }catch(err){
+2 -2
View File
@@ -145,8 +145,8 @@ export const registerActions = async () => {
}) })
//update stats //update stats
openticket.stats.get("openticket:global").setStat("openticket:transcripts-created",1,"increase") await openticket.stats.get("openticket:global").setStat("openticket:transcripts-created",1,"increase")
openticket.stats.get("openticket:user").setStat("openticket:transcripts-created",params.user.id,1,"increase") await openticket.stats.get("openticket:user").setStat("openticket:transcripts-created",params.user.id,1,"increase")
await openticket.events.get("afterTranscriptCreated").emit([openticket.transcripts,instance.result.ticket,instance.result.channel,instance.result.user]) await openticket.events.get("afterTranscriptCreated").emit([openticket.transcripts,instance.result.ticket,instance.result.channel,instance.result.user])
}), }),
new api.ODWorker("openticket:logs",0,(instance,params,source,cancel) => { new api.ODWorker("openticket:logs",0,(instance,params,source,cancel) => {
+2 -2
View File
@@ -56,8 +56,8 @@ export const registerActions = async () => {
} }
//update stats //update stats
openticket.stats.get("openticket:global").setStat("openticket:tickets-deleted",1,"increase") await openticket.stats.get("openticket:global").setStat("openticket:tickets-deleted",1,"increase")
openticket.stats.get("openticket:user").setStat("openticket:tickets-deleted",user.id,1,"increase") await openticket.stats.get("openticket:user").setStat("openticket:tickets-deleted",user.id,1,"increase")
//delete ticket from manager //delete ticket from manager
openticket.tickets.remove(ticket.id) openticket.tickets.remove(ticket.id)
+2 -2
View File
@@ -17,8 +17,8 @@ export const registerActions = async () => {
ticket.option = data ticket.option = data
//update stats //update stats
openticket.stats.get("openticket:global").setStat("openticket:tickets-moved",1,"increase") await openticket.stats.get("openticket:global").setStat("openticket:tickets-moved",1,"increase")
openticket.stats.get("openticket:user").setStat("openticket:tickets-moved",user.id,1,"increase") await openticket.stats.get("openticket:user").setStat("openticket:tickets-moved",user.id,1,"increase")
//get new channel properties //get new channel properties
const channelPrefix = ticket.option.get("openticket:channel-prefix").value const channelPrefix = ticket.option.get("openticket:channel-prefix").value
+2 -2
View File
@@ -22,8 +22,8 @@ export const registerActions = async () => {
ticket.get("openticket:busy").value = true ticket.get("openticket:busy").value = true
//update stats //update stats
openticket.stats.get("openticket:global").setStat("openticket:tickets-pinned",1,"increase") await openticket.stats.get("openticket:global").setStat("openticket:tickets-pinned",1,"increase")
openticket.stats.get("openticket:user").setStat("openticket:tickets-pinned",user.id,1,"increase") await openticket.stats.get("openticket:user").setStat("openticket:tickets-pinned",user.id,1,"increase")
//move to top of category //move to top of category
if (channel.parent){ if (channel.parent){
+2 -2
View File
@@ -24,8 +24,8 @@ export const registerActions = async () => {
ticket.get("openticket:busy").value = true ticket.get("openticket:busy").value = true
//update stats //update stats
openticket.stats.get("openticket:global").setStat("openticket:tickets-reopened",1,"increase") await openticket.stats.get("openticket:global").setStat("openticket:tickets-reopened",1,"increase")
openticket.stats.get("openticket:user").setStat("openticket:tickets-reopened",user.id,1,"increase") await openticket.stats.get("openticket:user").setStat("openticket:tickets-reopened",user.id,1,"increase")
//update category //update category
const channelCategory = ticket.option.get("openticket:channel-category").value const channelCategory = ticket.option.get("openticket:channel-category").value
+2 -2
View File
@@ -74,8 +74,8 @@ export const registerCommandResponders = async () => {
]) ])
//manage stats //manage stats
openticket.stats.get("openticket:global").setStat("openticket:users-blacklisted",1,"increase") await openticket.stats.get("openticket:global").setStat("openticket:users-blacklisted",1,"increase")
openticket.stats.get("openticket:user").setStat("openticket:users-blacklisted",user.id,1,"increase") await openticket.stats.get("openticket:user").setStat("openticket:users-blacklisted",user.id,1,"increase")
await instance.reply(await openticket.builders.messages.getSafe("openticket:blacklist-add").build(source,{guild,channel,user,data,reason})) await instance.reply(await openticket.builders.messages.getSafe("openticket:blacklist-add").build(source,{guild,channel,user,data,reason}))
+45 -45
View File
@@ -92,24 +92,24 @@ export class ODStatGlobalScope_DefaultGlobal extends ODStatGlobalScope {
return super.exists(id) return super.exists(id)
} }
getStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:StatsId): ODValidStatValue|null getStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:StatsId): Promise<ODValidStatValue|null>
getStat(id:ODValidId): ODValidStatValue|null getStat(id:ODValidId): Promise<ODValidStatValue|null>
getStat(id:ODValidId): ODValidStatValue|null { getStat(id:ODValidId): Promise<ODValidStatValue|null> {
return super.getStat(id) return super.getStat(id)
} }
setStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:StatsId, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean setStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:StatsId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean { setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
return super.setStat(id,value,mode) return super.setStat(id,value,mode)
} }
resetStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:ODValidId): ODValidStatValue|null resetStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:ODValidId): Promise<ODValidStatValue|null>
resetStat(id:ODValidId): ODValidStatValue|null resetStat(id:ODValidId): Promise<ODValidStatValue|null>
resetStat(id:ODValidId): ODValidStatValue|null { resetStat(id:ODValidId): Promise<ODValidStatValue|null> {
return super.resetStat(id) return super.resetStat(id)
} }
} }
@@ -151,24 +151,24 @@ export class ODStatGlobalScope_DefaultSystem extends ODStatGlobalScope {
return super.exists(id) return super.exists(id)
} }
getStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:StatsId): ODValidStatValue|null getStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:StatsId): Promise<ODValidStatValue|null>
getStat(id:ODValidId): ODValidStatValue|null getStat(id:ODValidId): Promise<ODValidStatValue|null>
getStat(id:ODValidId): ODValidStatValue|null { getStat(id:ODValidId): Promise<ODValidStatValue|null> {
return super.getStat(id) return super.getStat(id)
} }
setStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:StatsId, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean setStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:StatsId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean { setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
return super.setStat(id,value,mode) return super.setStat(id,value,mode)
} }
resetStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:ODValidId): ODValidStatValue|null resetStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:ODValidId): Promise<ODValidStatValue|null>
resetStat(id:ODValidId): ODValidStatValue|null resetStat(id:ODValidId): Promise<ODValidStatValue|null>
resetStat(id:ODValidId): ODValidStatValue|null { resetStat(id:ODValidId): Promise<ODValidStatValue|null> {
return super.resetStat(id) return super.resetStat(id)
} }
} }
@@ -219,24 +219,24 @@ export class ODStatScope_DefaultUser extends ODStatScope {
return super.exists(id) return super.exists(id)
} }
getStat<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:StatsId, scopeId:string): ODValidStatValue|null getStat<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:StatsId, scopeId:string): Promise<ODValidStatValue|null>
getStat(id:ODValidId, scopeId:string): ODValidStatValue|null getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
getStat(id:ODValidId, scopeId:string): ODValidStatValue|null { getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
return super.getStat(id,scopeId) return super.getStat(id,scopeId)
} }
setStat<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:StatsId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean setStat<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:StatsId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean { setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
return super.setStat(id,scopeId,value,mode) return super.setStat(id,scopeId,value,mode)
} }
resetStat<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:ODValidId, scopeId:string): ODValidStatValue|null resetStat<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
resetStat(id:ODValidId, scopeId:string): ODValidStatValue|null resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
resetStat(id:ODValidId, scopeId:string): ODValidStatValue|null { resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
return super.resetStat(id,scopeId) return super.resetStat(id,scopeId)
} }
} }
@@ -282,24 +282,24 @@ export class ODStatScope_DefaultTicket extends ODStatScope {
return super.exists(id) return super.exists(id)
} }
getStat<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:StatsId, scopeId:string): ODValidStatValue|null getStat<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:StatsId, scopeId:string): Promise<ODValidStatValue|null>
getStat(id:ODValidId, scopeId:string): ODValidStatValue|null getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
getStat(id:ODValidId, scopeId:string): ODValidStatValue|null { getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
return super.getStat(id,scopeId) return super.getStat(id,scopeId)
} }
setStat<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:StatsId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean setStat<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:StatsId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean { setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
return super.setStat(id,scopeId,value,mode) return super.setStat(id,scopeId,value,mode)
} }
resetStat<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:ODValidId, scopeId:string): ODValidStatValue|null resetStat<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
resetStat(id:ODValidId, scopeId:string): ODValidStatValue|null resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
resetStat(id:ODValidId, scopeId:string): ODValidStatValue|null { resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
return super.resetStat(id,scopeId) return super.resetStat(id,scopeId)
} }
} }
@@ -340,24 +340,24 @@ export class ODStatScope_DefaultParticipants extends ODStatScope {
return super.exists(id) return super.exists(id)
} }
getStat<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:StatsId, scopeId:string): ODValidStatValue|null getStat<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:StatsId, scopeId:string): Promise<ODValidStatValue|null>
getStat(id:ODValidId, scopeId:string): ODValidStatValue|null getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
getStat(id:ODValidId, scopeId:string): ODValidStatValue|null { getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
return super.getStat(id,scopeId) return super.getStat(id,scopeId)
} }
setStat<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:StatsId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean setStat<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:StatsId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean { setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
return super.setStat(id,scopeId,value,mode) return super.setStat(id,scopeId,value,mode)
} }
resetStat<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:ODValidId, scopeId:string): ODValidStatValue|null resetStat<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
resetStat(id:ODValidId, scopeId:string): ODValidStatValue|null resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
resetStat(id:ODValidId, scopeId:string): ODValidStatValue|null { resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
return super.resetStat(id,scopeId) return super.resetStat(id,scopeId)
} }
} }
+20 -20
View File
@@ -53,18 +53,18 @@ export class ODStatsManager extends ODManager<ODStatScope> {
} }
//delete all deletable stats //delete all deletable stats
deletableStats.forEach((data) => { for (const data of deletableStats){
if (!this.database) return if (!this.database) return
this.database.delete(data.category,data.key) await this.database.delete(data.category,data.key)
}) }
} }
async reset(){ async reset(){
if (!this.database) return if (!this.database) return
const data = await this.database.getAll() const data = await this.database.getAll()
data.forEach((data) => { for (const d of data){
if (!this.database) return if (!this.database) return
this.database.delete(data.category,data.key) await this.database.delete(d.category,d.key)
}) }
} }
onInit(callback:ODStatsManagerInitCallback){ onInit(callback:ODStatsManagerInitCallback){
this.#initListeners.push(callback) this.#initListeners.push(callback)
@@ -90,10 +90,10 @@ export class ODStatScope extends ODManager<ODStat> {
useDatabase(database:ODDatabase){ useDatabase(database:ODDatabase){
this.database = database this.database = database
} }
getStat(id:ODValidId, scopeId:string): ODValidStatValue|null { async getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
if (!this.database) return null if (!this.database) return null
const newId = new ODId(id) const newId = new ODId(id)
const data = this.database.get(this.id.value+"_"+newId.value,scopeId) const data = await this.database.get(this.id.value+"_"+newId.value,scopeId)
if (typeof data == "undefined"){ if (typeof data == "undefined"){
//set stats to default value & return //set stats to default value & return
@@ -105,28 +105,28 @@ export class ODStatScope extends ODManager<ODStat> {
//return null on error //return null on error
return null return null
} }
setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean { async setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
if (!this.database) return false if (!this.database) return false
const stat = this.get(id) const stat = this.get(id)
if (!stat) return false if (!stat) return false
if (mode == "set" || typeof value != "number"){ if (mode == "set" || typeof value != "number"){
this.database.set(this.id.value+"_"+stat.id.value,scopeId,value) await this.database.set(this.id.value+"_"+stat.id.value,scopeId,value)
}else if (mode == "increase"){ }else if (mode == "increase"){
const currentValue = this.getStat(id,scopeId) const currentValue = this.getStat(id,scopeId)
if (typeof currentValue != "number") this.database.set(this.id.value+"_"+stat.id.value,scopeId,0) if (typeof currentValue != "number") await this.database.set(this.id.value+"_"+stat.id.value,scopeId,0)
else this.database.set(this.id.value+"_"+stat.id.value,scopeId,currentValue+value) else await this.database.set(this.id.value+"_"+stat.id.value,scopeId,currentValue+value)
}else if (mode == "decrease"){ }else if (mode == "decrease"){
const currentValue = this.getStat(id,scopeId) const currentValue = this.getStat(id,scopeId)
if (typeof currentValue != "number") this.database.set(this.id.value+"_"+stat.id.value,scopeId,0) if (typeof currentValue != "number") await this.database.set(this.id.value+"_"+stat.id.value,scopeId,0)
else this.database.set(this.id.value+"_"+stat.id.value,scopeId,currentValue-value) else await this.database.set(this.id.value+"_"+stat.id.value,scopeId,currentValue-value)
} }
return true return true
} }
resetStat(id:ODValidId, scopeId:string): ODValidStatValue|null { async resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
if (!this.database) return null if (!this.database) return null
const stat = this.get(id) const stat = this.get(id)
if (!stat) return null if (!stat) return null
if (stat.value != null) this.database.set(this.id.value+"_"+stat.id.value,scopeId,stat.value) if (stat.value != null) await this.database.set(this.id.value+"_"+stat.id.value,scopeId,stat.value)
return stat.value return stat.value
} }
init(): string[] { init(): string[] {
@@ -149,7 +149,7 @@ export class ODStatScope extends ODManager<ODStat> {
result.push(await stat.render("",scopeId,guild,channel,user)) result.push(await stat.render("",scopeId,guild,channel,user))
}else{ }else{
//normal render (with value) //normal render (with value)
const value = this.getStat(stat.id,scopeId) const value = await this.getStat(stat.id,scopeId)
if (value != null) result.push(await stat.render(value,scopeId,guild,channel,user)) if (value != null) result.push(await stat.render(value,scopeId,guild,channel,user))
} }
@@ -163,13 +163,13 @@ export class ODStatScope extends ODManager<ODStat> {
} }
export class ODStatGlobalScope extends ODStatScope { export class ODStatGlobalScope extends ODStatScope {
getStat(id:ODValidId): ODValidStatValue|null { getStat(id:ODValidId): Promise<ODValidStatValue|null> {
return super.getStat(id,"GLOBAL") return super.getStat(id,"GLOBAL")
} }
setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): boolean { setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
return super.setStat(id,"GLOBAL",value,mode) return super.setStat(id,"GLOBAL",value,mode)
} }
resetStat(id:ODValidId): ODValidStatValue|null { resetStat(id:ODValidId): Promise<ODValidStatValue|null> {
return super.resetStat(id,"GLOBAL") return super.resetStat(id,"GLOBAL")
} }
render(scopeId:"GLOBAL", guild:discord.Guild, channel:discord.TextBasedChannel, user: discord.User): Promise<string> { render(scopeId:"GLOBAL", guild:discord.Guild, channel:discord.TextBasedChannel, user: discord.User): Promise<string> {
+4 -4
View File
@@ -394,7 +394,7 @@ const loadAutoCode = () => {
await openticket.actions.get("openticket:close-ticket").run("autoclose",{guild:channel.guild,channel,user:openticket.client.client.user,ticket,reason:"Autoclose",sendMessage:false}) await openticket.actions.get("openticket:close-ticket").run("autoclose",{guild:channel.guild,channel,user:openticket.client.client.user,ticket,reason:"Autoclose",sendMessage:false})
await channel.send((await openticket.builders.messages.getSafe("openticket:autoclose-message").build("timeout",{guild:channel.guild,channel,user:openticket.client.client.user,ticket})).message) await channel.send((await openticket.builders.messages.getSafe("openticket:autoclose-message").build("timeout",{guild:channel.guild,channel,user:openticket.client.client.user,ticket})).message)
count++ count++
openticket.stats.get("openticket:global").setStat("openticket:tickets-autoclosed",1,"increase") await openticket.stats.get("openticket:global").setStat("openticket:tickets-autoclosed",1,"increase")
} }
} }
} }
@@ -420,7 +420,7 @@ const loadAutoCode = () => {
//autoclose ticket //autoclose ticket
await openticket.actions.get("openticket:close-ticket").run("autoclose",{guild:channel.guild,channel,user:openticket.client.client.user,ticket,reason:"Autoclose",sendMessage:false}) await openticket.actions.get("openticket:close-ticket").run("autoclose",{guild:channel.guild,channel,user:openticket.client.client.user,ticket,reason:"Autoclose",sendMessage:false})
await channel.send((await openticket.builders.messages.getSafe("openticket:autoclose-message").build("leave",{guild:channel.guild,channel,user:openticket.client.client.user,ticket})).message) await channel.send((await openticket.builders.messages.getSafe("openticket:autoclose-message").build("leave",{guild:channel.guild,channel,user:openticket.client.client.user,ticket})).message)
openticket.stats.get("openticket:global").setStat("openticket:tickets-autoclosed",1,"increase") await openticket.stats.get("openticket:global").setStat("openticket:tickets-autoclosed",1,"increase")
} }
} }
} }
@@ -447,7 +447,7 @@ const loadAutoCode = () => {
await channel.send((await openticket.builders.messages.getSafe("openticket:autodelete-message").build("timeout",{guild:channel.guild,channel,user:openticket.client.client.user,ticket})).message) await channel.send((await openticket.builders.messages.getSafe("openticket:autodelete-message").build("timeout",{guild:channel.guild,channel,user:openticket.client.client.user,ticket})).message)
await openticket.actions.get("openticket:delete-ticket").run("autodelete",{guild:channel.guild,channel,user:openticket.client.client.user,ticket,reason:"Autodelete",sendMessage:false,withoutTranscript:false}) await openticket.actions.get("openticket:delete-ticket").run("autodelete",{guild:channel.guild,channel,user:openticket.client.client.user,ticket,reason:"Autodelete",sendMessage:false,withoutTranscript:false})
count++ count++
openticket.stats.get("openticket:global").setStat("openticket:tickets-autodeleted",1,"increase") await openticket.stats.get("openticket:global").setStat("openticket:tickets-autodeleted",1,"increase")
} }
} }
} }
@@ -473,7 +473,7 @@ const loadAutoCode = () => {
//autodelete ticket //autodelete ticket
await channel.send((await openticket.builders.messages.getSafe("openticket:autodelete-message").build("leave",{guild:channel.guild,channel,user:openticket.client.client.user,ticket})).message) await channel.send((await openticket.builders.messages.getSafe("openticket:autodelete-message").build("leave",{guild:channel.guild,channel,user:openticket.client.client.user,ticket})).message)
await openticket.actions.get("openticket:delete-ticket").run("autodelete",{guild:channel.guild,channel,user:openticket.client.client.user,ticket,reason:"Autodelete",sendMessage:false,withoutTranscript:false}) await openticket.actions.get("openticket:delete-ticket").run("autodelete",{guild:channel.guild,channel,user:openticket.client.client.user,ticket,reason:"Autodelete",sendMessage:false,withoutTranscript:false})
openticket.stats.get("openticket:global").setStat("openticket:tickets-autodeleted",1,"increase") await openticket.stats.get("openticket:global").setStat("openticket:tickets-autodeleted",1,"increase")
} }
} }
} }