(v4.2) Open Discord Framework Update (Part 2)
Replaced all "Default" classes & types with ID mappings & improved types. Updated Interactive Setup CLI & certain events, renamed ODStat's to ODStatistics. Moved many classes, types & interfaces to the framework
This commit is contained in:
@@ -45,7 +45,7 @@ export const loadAllConfigCheckerTranslations = async () => {
|
||||
}
|
||||
|
||||
//GLOBAL FUNCTIONS
|
||||
export const registerDefaultCheckerSystemTranslations = (tm:api.ODCheckerTranslationRegister_Default,lm:api.ODLanguageManager_Default) => {
|
||||
export const registerDefaultCheckerSystemTranslations = (tm:api.ODMappedCheckerTranslationRegister,lm:api.ODMappedLanguageManager) => {
|
||||
//SYSTEM
|
||||
//tm.quickTranslate(lm,"checker.system.headerOpenTicket","other","opendiscord:header-openticket") //OPEN TICKET (ignore)
|
||||
tm.quickTranslate(lm,"checker.system.typeError","other","opendiscord:type-error") // [ERROR] (ignore)
|
||||
@@ -62,7 +62,7 @@ export const registerDefaultCheckerSystemTranslations = (tm:api.ODCheckerTransla
|
||||
tm.quickTranslate(lm,"checker.system.dataMessages","other","opendiscord:data-message") // message
|
||||
}
|
||||
|
||||
export const registerDefaultCheckerMessageTranslations = (tm:api.ODCheckerTranslationRegister_Default,lm:api.ODLanguageManager_Default) => {
|
||||
export const registerDefaultCheckerMessageTranslations = (tm:api.ODMappedCheckerTranslationRegister,lm:api.ODMappedLanguageManager) => {
|
||||
//STRUCTURES
|
||||
tm.quickTranslate(lm,"checker.messages.invalidType","message","opendiscord:invalid-type") // This property needs to be the type: {0}!
|
||||
tm.quickTranslate(lm,"checker.messages.propertyMissing","message","opendiscord:property-missing") // The property {0} is missing from this object!
|
||||
@@ -137,7 +137,7 @@ export const registerDefaultCheckerMessageTranslations = (tm:api.ODCheckerTransl
|
||||
tm.quickTranslate(lm,"checker.messages.idNonExistent","message","opendiscord:id-non-existent") // The id {0} doesn't exist!
|
||||
}
|
||||
|
||||
export const registerDefaultCheckerCustomTranslations = (tm:api.ODCheckerTranslationRegister_Default,lm:api.ODLanguageManager_Default) => {
|
||||
export const registerDefaultCheckerCustomTranslations = (tm:api.ODMappedCheckerTranslationRegister,lm:api.ODMappedLanguageManager) => {
|
||||
//CUSTOM
|
||||
tm.quickTranslate(lm,"checker.messages.invalidLanguage","message","opendiscord:invalid-language") // This is an invalid language!
|
||||
tm.quickTranslate(lm,"checker.messages.invalidButton","message","opendiscord:invalid-button") // This button needs to have at least an {0} or {1}!
|
||||
|
||||
@@ -402,7 +402,7 @@ const loadAutoCode = () => {
|
||||
await opendiscord.actions.get("opendiscord:close-ticket").run("autoclose",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket,reason:"Autoclose",sendMessage:false})
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:autoclose-message").build("timeout",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket})).message)
|
||||
count++
|
||||
await opendiscord.stats.get("opendiscord:global").setStat("opendiscord:tickets-autoclosed",1,"increase")
|
||||
await opendiscord.statistics.get("opendiscord:global").setStat("opendiscord:tickets-autoclosed",1,"increase")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -428,7 +428,7 @@ const loadAutoCode = () => {
|
||||
//autoclose ticket
|
||||
await opendiscord.actions.get("opendiscord:close-ticket").run("autoclose",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket,reason:"Autoclose",sendMessage:false})
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:autoclose-message").build("leave",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket})).message)
|
||||
await opendiscord.stats.get("opendiscord:global").setStat("opendiscord:tickets-autoclosed",1,"increase")
|
||||
await opendiscord.statistics.get("opendiscord:global").setStat("opendiscord:tickets-autoclosed",1,"increase")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -457,7 +457,7 @@ const loadAutoCode = () => {
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:autodelete-message").build("timeout",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket})).message)
|
||||
await opendiscord.actions.get("opendiscord:delete-ticket").run("autodelete",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket,reason:"Autodelete",sendMessage:false,withoutTranscript:false})
|
||||
count++
|
||||
await opendiscord.stats.get("opendiscord:global").setStat("opendiscord:tickets-autodeleted",1,"increase")
|
||||
await opendiscord.statistics.get("opendiscord:global").setStat("opendiscord:tickets-autodeleted",1,"increase")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -484,7 +484,7 @@ const loadAutoCode = () => {
|
||||
//autodelete ticket
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:autodelete-message").build("leave",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket})).message)
|
||||
await opendiscord.actions.get("opendiscord:delete-ticket").run("autodelete",{guild:channel.guild,channel,user:opendiscord.client.client.user,ticket,reason:"Autodelete",sendMessage:false,withoutTranscript:false})
|
||||
await opendiscord.stats.get("opendiscord:global").setStat("opendiscord:tickets-autodeleted",1,"increase")
|
||||
await opendiscord.statistics.get("opendiscord:global").setStat("opendiscord:tickets-autodeleted",1,"increase")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
|
||||
export const loadAllEvents = () => {
|
||||
const eventList: (keyof api.ODEventIds_Default)[] = [
|
||||
const eventList: (keyof api.ODNoGeneric<api.ODEventManagerIdMappings>)[] = [
|
||||
//error handling
|
||||
"onErrorHandling",
|
||||
"afterErrorHandling",
|
||||
@@ -258,13 +258,13 @@ export const loadAllEvents = () => {
|
||||
"onHelpMenuComponentLoad",
|
||||
"afterHelpMenuComponentsLoaded",
|
||||
|
||||
//stats
|
||||
"onStatScopeLoad",
|
||||
"afterStatScopesLoaded",
|
||||
"onStatLoad",
|
||||
"afterStatsLoaded",
|
||||
"onStatInit",
|
||||
"afterStatsInitiated",
|
||||
//statistics
|
||||
"onStatisticScopeLoad",
|
||||
"afterStatisticScopesLoaded",
|
||||
"onStatisticLoad",
|
||||
"afterStatisticsLoaded",
|
||||
"onStatisticInit",
|
||||
"afterStatisticsInitiated",
|
||||
|
||||
//plugin loading before code
|
||||
"onPluginBeforeCodeLoad",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
|
||||
export const loadAllProgressBarRenderers = async () => {
|
||||
const defaultSettings: api.ODProgressBarRenderer_DefaultSettings = {
|
||||
const defaultSettings: api.ODDefaultProgressBarRendererSettings = {
|
||||
borderColor:"gray",
|
||||
filledBarColor:"openticket",
|
||||
emptyBarColor:"gray",
|
||||
@@ -23,34 +23,34 @@ export const loadAllProgressBarRenderers = async () => {
|
||||
}
|
||||
|
||||
//VALUE RENDERER
|
||||
const valueRendererSettings: api.ODProgressBarRenderer_DefaultSettings = {...defaultSettings}
|
||||
const valueRendererSettings: api.ODDefaultProgressBarRendererSettings = {...defaultSettings}
|
||||
valueRendererSettings.labelType = "value"
|
||||
opendiscord.progressbars.renderers.add(new api.ODProgressBarRenderer_Default("opendiscord:value-renderer",valueRendererSettings))
|
||||
opendiscord.progressbars.renderers.add(new api.ODDefaultProgressBarRenderer("opendiscord:value-renderer",valueRendererSettings))
|
||||
|
||||
//FRACTION RENDERER
|
||||
const fractionRendererSettings: api.ODProgressBarRenderer_DefaultSettings = {...defaultSettings}
|
||||
const fractionRendererSettings: api.ODDefaultProgressBarRendererSettings = {...defaultSettings}
|
||||
fractionRendererSettings.labelType = "fraction"
|
||||
opendiscord.progressbars.renderers.add(new api.ODProgressBarRenderer_Default("opendiscord:fraction-renderer",fractionRendererSettings))
|
||||
opendiscord.progressbars.renderers.add(new api.ODDefaultProgressBarRenderer("opendiscord:fraction-renderer",fractionRendererSettings))
|
||||
|
||||
//PERCENTAGE RENDERER
|
||||
const percentageRendererSettings: api.ODProgressBarRenderer_DefaultSettings = {...defaultSettings}
|
||||
const percentageRendererSettings: api.ODDefaultProgressBarRendererSettings = {...defaultSettings}
|
||||
percentageRendererSettings.labelType = "percentage"
|
||||
opendiscord.progressbars.renderers.add(new api.ODProgressBarRenderer_Default("opendiscord:percentage-renderer",percentageRendererSettings))
|
||||
opendiscord.progressbars.renderers.add(new api.ODDefaultProgressBarRenderer("opendiscord:percentage-renderer",percentageRendererSettings))
|
||||
|
||||
//TIME MS RENDERER
|
||||
const timeMsRendererSettings: api.ODProgressBarRenderer_DefaultSettings = {...defaultSettings}
|
||||
const timeMsRendererSettings: api.ODDefaultProgressBarRendererSettings = {...defaultSettings}
|
||||
timeMsRendererSettings.labelType = "time-ms"
|
||||
opendiscord.progressbars.renderers.add(new api.ODProgressBarRenderer_Default("opendiscord:time-ms-renderer",timeMsRendererSettings))
|
||||
opendiscord.progressbars.renderers.add(new api.ODDefaultProgressBarRenderer("opendiscord:time-ms-renderer",timeMsRendererSettings))
|
||||
|
||||
//TIME SEC RENDERER
|
||||
const timeSecRendererSettings: api.ODProgressBarRenderer_DefaultSettings = {...defaultSettings}
|
||||
const timeSecRendererSettings: api.ODDefaultProgressBarRendererSettings = {...defaultSettings}
|
||||
timeSecRendererSettings.labelType = "time-sec"
|
||||
opendiscord.progressbars.renderers.add(new api.ODProgressBarRenderer_Default("opendiscord:time-sec-renderer",timeSecRendererSettings))
|
||||
opendiscord.progressbars.renderers.add(new api.ODDefaultProgressBarRenderer("opendiscord:time-sec-renderer",timeSecRendererSettings))
|
||||
|
||||
//TIME MIN RENDERER
|
||||
const timeMinRendererSettings: api.ODProgressBarRenderer_DefaultSettings = {...defaultSettings}
|
||||
const timeMinRendererSettings: api.ODDefaultProgressBarRendererSettings = {...defaultSettings}
|
||||
timeMinRendererSettings.labelType = "time-min"
|
||||
opendiscord.progressbars.renderers.add(new api.ODProgressBarRenderer_Default("opendiscord:time-min-renderer",timeMinRendererSettings))
|
||||
opendiscord.progressbars.renderers.add(new api.ODDefaultProgressBarRenderer("opendiscord:time-min-renderer",timeMinRendererSettings))
|
||||
}
|
||||
|
||||
export const loadAllProgressBars = async () => {
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const stats = opendiscord.stats
|
||||
const stats = opendiscord.statistics
|
||||
const lang = opendiscord.languages
|
||||
|
||||
export const loadAllStatScopes = async () => {
|
||||
stats.add(new api.ODStatGlobalScope("opendiscord:global",utilities.emojiTitle("📊",lang.getTranslation("stats.scopes.global"))))
|
||||
stats.add(new api.ODStatGlobalScope("opendiscord:system",utilities.emojiTitle("⚙️",lang.getTranslation("stats.scopes.system"))))
|
||||
stats.add(new api.ODStatScope("opendiscord:user",utilities.emojiTitle("📊",lang.getTranslation("stats.scopes.user"))))
|
||||
stats.add(new api.ODStatScope("opendiscord:ticket",utilities.emojiTitle("📊",lang.getTranslation("stats.scopes.ticket"))))
|
||||
stats.add(new api.ODStatScope("opendiscord:participants",utilities.emojiTitle("👥",lang.getTranslation("stats.scopes.participants"))))
|
||||
stats.add(new api.ODStatScope("opendiscord:messages",utilities.emojiTitle("💬",lang.getTranslation("stats.scopes.messages"))))
|
||||
export const loadAllStatisticScopes = async () => {
|
||||
stats.add(new api.ODStatisticGlobalScope("opendiscord:global",utilities.emojiTitle("📊",lang.getTranslation("stats.scopes.global"))))
|
||||
stats.add(new api.ODStatisticGlobalScope("opendiscord:system",utilities.emojiTitle("⚙️",lang.getTranslation("stats.scopes.system"))))
|
||||
stats.add(new api.ODStatisticScope("opendiscord:user",utilities.emojiTitle("📊",lang.getTranslation("stats.scopes.user"))))
|
||||
stats.add(new api.ODStatisticScope("opendiscord:ticket",utilities.emojiTitle("📊",lang.getTranslation("stats.scopes.ticket"))))
|
||||
stats.add(new api.ODStatisticScope("opendiscord:participants",utilities.emojiTitle("👥",lang.getTranslation("stats.scopes.participants"))))
|
||||
stats.add(new api.ODStatisticScope("opendiscord:messages",utilities.emojiTitle("💬",lang.getTranslation("stats.scopes.messages"))))
|
||||
}
|
||||
|
||||
export const loadAllStats = async () => {
|
||||
export const loadAllStatistics = async () => {
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
if (!generalConfig) return
|
||||
|
||||
const global = stats.get("opendiscord:global")
|
||||
if (global){
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-created",13,lang.getTranslation("stats.properties.ticketsCreated"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-closed",12,lang.getTranslation("stats.properties.ticketsClosed"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-deleted",11,lang.getTranslation("stats.properties.ticketsDeleted"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-reopened",10,lang.getTranslation("stats.properties.ticketsReopened"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-autoclosed",9,lang.getTranslation("stats.properties.ticketsAutoclosed"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-autodeleted",8,lang.getTranslation("stats.properties.ticketsAutodeleted"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-claimed",7,lang.getTranslation("stats.properties.ticketsClaimed"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-pinned",6,lang.getTranslation("stats.properties.ticketsPinned"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-moved",5,lang.getTranslation("stats.properties.ticketsMoved"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:tickets-transferred",4,lang.getTranslation("stats.properties.ticketsTransferred"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:users-blacklisted",3,lang.getTranslation("stats.properties.usersBlacklisted"),0))
|
||||
global.add(new api.ODBasicStat("opendiscord:transcripts-created",2,lang.getTranslation("stats.properties.transcriptsCreated"),0))
|
||||
global.add(new api.ODDynamicStat("opendiscord:ticket-volume",1,() => {
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-created",13,lang.getTranslation("stats.properties.ticketsCreated"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-closed",12,lang.getTranslation("stats.properties.ticketsClosed"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-deleted",11,lang.getTranslation("stats.properties.ticketsDeleted"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-reopened",10,lang.getTranslation("stats.properties.ticketsReopened"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-autoclosed",9,lang.getTranslation("stats.properties.ticketsAutoclosed"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-autodeleted",8,lang.getTranslation("stats.properties.ticketsAutodeleted"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-claimed",7,lang.getTranslation("stats.properties.ticketsClaimed"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-pinned",6,lang.getTranslation("stats.properties.ticketsPinned"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-moved",5,lang.getTranslation("stats.properties.ticketsMoved"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:tickets-transferred",4,lang.getTranslation("stats.properties.ticketsTransferred"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:users-blacklisted",3,lang.getTranslation("stats.properties.usersBlacklisted"),0))
|
||||
global.add(new api.ODBaseStatistic("opendiscord:transcripts-created",2,lang.getTranslation("stats.properties.transcriptsCreated"),0))
|
||||
global.add(new api.ODDynamicStatistic("opendiscord:ticket-volume",1,() => {
|
||||
return lang.getTranslation("stats.properties.ticketVolume")+": `"+opendiscord.tickets.getLength()+"`"
|
||||
}))
|
||||
global.add(new api.ODDynamicStat("opendiscord:average-tickets",0,async () => {
|
||||
const userTicketsCreated = await opendiscord.stats.get("opendiscord:user").getAllStats("opendiscord:tickets-created")
|
||||
global.add(new api.ODDynamicStatistic("opendiscord:average-tickets",0,async () => {
|
||||
const userTicketsCreated = await opendiscord.statistics.get("opendiscord:user").getAllStats("opendiscord:tickets-created")
|
||||
const average = userTicketsCreated.map((s) => s.value as number).filter((t) => t > 0).reduce((prev,curr) => prev+curr,0)/userTicketsCreated.length
|
||||
const roundedAverage = Math.round(average*1000)/1000
|
||||
return lang.getTranslation("stats.properties.averageTickets")+": `"+roundedAverage+"`"
|
||||
@@ -44,23 +44,23 @@ export const loadAllStats = async () => {
|
||||
|
||||
const system = stats.get("opendiscord:system")
|
||||
if (system){
|
||||
system.add(new api.ODDynamicStat("opendiscord:startup-date",2,() => {
|
||||
system.add(new api.ODDynamicStatistic("opendiscord:startup-date",2,() => {
|
||||
return lang.getTranslation("params.uppercase.startupDate")+": "+discord.time(opendiscord.processStartupDate,"f")
|
||||
}))
|
||||
system.add(new api.ODDynamicStat("opendiscord:system-uptime",1,() => {
|
||||
system.add(new api.ODDynamicStatistic("opendiscord:system-uptime",1,() => {
|
||||
return lang.getTranslation("params.uppercase.uptime")+": "+discord.time(opendiscord.processStartupDate,"R")
|
||||
}))
|
||||
system.add(new api.ODDynamicStat("opendiscord:version",0,() => {
|
||||
system.add(new api.ODDynamicStatistic("opendiscord:version",0,() => {
|
||||
return lang.getTranslation("params.uppercase.version")+": `"+opendiscord.versions.get("opendiscord:version").toString()+"`"
|
||||
}))
|
||||
}
|
||||
|
||||
const user = stats.get("opendiscord:user")
|
||||
if (user){
|
||||
user.add(new api.ODDynamicStat("opendiscord:name",11,async (scopeId,guild,channel,user) => {
|
||||
user.add(new api.ODDynamicStatistic("opendiscord:name",11,async (scopeId,guild,channel,user) => {
|
||||
return lang.getTranslation("params.uppercase.name")+": "+discord.userMention(scopeId)
|
||||
}))
|
||||
user.add(new api.ODDynamicStat("opendiscord:role",10,async (scopeId,guild,channel,user) => {
|
||||
user.add(new api.ODDynamicStatistic("opendiscord:role",10,async (scopeId,guild,channel,user) => {
|
||||
const scopeMember = await opendiscord.client.fetchGuildMember(guild,scopeId)
|
||||
if (!scopeMember) return ""
|
||||
|
||||
@@ -72,27 +72,27 @@ export const loadAllStats = async () => {
|
||||
if (permissions.type == "support") return lang.getTranslation("params.uppercase.role")+": 💬 `"+lang.getTranslation("stats.roles.support")+"`"
|
||||
else return lang.getTranslation("params.uppercase.role")+": 👤 `"+lang.getTranslation("stats.roles.member")+"`"
|
||||
}))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-created",10,lang.getTranslation("stats.properties.ticketsCreated"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-closed",9,lang.getTranslation("stats.properties.ticketsClosed"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-deleted",8,lang.getTranslation("stats.properties.ticketsDeleted"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-reopened",7,lang.getTranslation("stats.properties.ticketsReopened"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-claimed",6,lang.getTranslation("stats.properties.ticketsClaimed"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-pinned",5,lang.getTranslation("stats.properties.ticketsPinned"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-moved",4,lang.getTranslation("stats.properties.ticketsMoved"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:tickets-transferred",3,lang.getTranslation("stats.properties.ticketsTransferred"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:users-blacklisted",2,lang.getTranslation("stats.properties.usersBlacklisted"),0))
|
||||
user.add(new api.ODBasicStat("opendiscord:transcripts-created",1,lang.getTranslation("stats.properties.transcriptsCreated"),0))
|
||||
user.add(new api.ODDynamicStat("opendiscord:current-tickets",0,async (scopeId,guild,channel,user) => {
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-created",10,lang.getTranslation("stats.properties.ticketsCreated"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-closed",9,lang.getTranslation("stats.properties.ticketsClosed"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-deleted",8,lang.getTranslation("stats.properties.ticketsDeleted"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-reopened",7,lang.getTranslation("stats.properties.ticketsReopened"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-claimed",6,lang.getTranslation("stats.properties.ticketsClaimed"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-pinned",5,lang.getTranslation("stats.properties.ticketsPinned"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-moved",4,lang.getTranslation("stats.properties.ticketsMoved"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:tickets-transferred",3,lang.getTranslation("stats.properties.ticketsTransferred"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:users-blacklisted",2,lang.getTranslation("stats.properties.usersBlacklisted"),0))
|
||||
user.add(new api.ODBaseStatistic("opendiscord:transcripts-created",1,lang.getTranslation("stats.properties.transcriptsCreated"),0))
|
||||
user.add(new api.ODDynamicStatistic("opendiscord:current-tickets",0,async (scopeId,guild,channel,user) => {
|
||||
return lang.getTranslation("stats.properties.currentTickets")+": `"+opendiscord.tickets.getFiltered((t) => t.get("opendiscord:opened-by").value === scopeId).length+"`"
|
||||
}))
|
||||
}
|
||||
|
||||
const ticket = stats.get("opendiscord:ticket")
|
||||
if (ticket){
|
||||
ticket.add(new api.ODDynamicStat("opendiscord:name",5,async (scopeId,guild,channel,user) => {
|
||||
ticket.add(new api.ODDynamicStatistic("opendiscord:name",5,async (scopeId,guild,channel,user) => {
|
||||
return lang.getTranslation("params.uppercase.ticket")+": "+discord.channelMention(scopeId)
|
||||
}))
|
||||
ticket.add(new api.ODDynamicStat("opendiscord:status",4,async (scopeId,guild,channel,user) => {
|
||||
ticket.add(new api.ODDynamicStatistic("opendiscord:status",4,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
@@ -100,35 +100,35 @@ export const loadAllStats = async () => {
|
||||
|
||||
return closed ? lang.getTranslation("params.uppercase.status")+": 🔒 `"+lang.getTranslation("params.uppercase.closed")+"`" : lang.getTranslation("params.uppercase.status")+": 🔓 `"+lang.getTranslation("params.uppercase.open")+"`"
|
||||
}))
|
||||
ticket.add(new api.ODDynamicStat("opendiscord:claimed",3,async (scopeId,guild,channel,user) => {
|
||||
ticket.add(new api.ODDynamicStatistic("opendiscord:claimed",3,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
const claimed = ticket.exists("opendiscord:claimed") ? ticket.get("opendiscord:claimed").value : false
|
||||
return claimed ? lang.getTranslation("params.uppercase.claimed")+": 🟢 `"+lang.getTranslation("params.uppercase.yes")+"`" : lang.getTranslation("params.uppercase.claimed")+": 🔴 `"+lang.getTranslation("params.uppercase.no")+"`"
|
||||
}))
|
||||
ticket.add(new api.ODDynamicStat("opendiscord:pinned",2,async (scopeId,guild,channel,user) => {
|
||||
ticket.add(new api.ODDynamicStatistic("opendiscord:pinned",2,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
const pinned = ticket.exists("opendiscord:pinned") ? ticket.get("opendiscord:pinned").value : false
|
||||
return pinned ? lang.getTranslation("params.uppercase.pinned")+": 🟢 `"+lang.getTranslation("params.uppercase.yes")+"`" : lang.getTranslation("params.uppercase.pinned")+": 🔴 `"+lang.getTranslation("params.uppercase.no")+"`"
|
||||
}))
|
||||
ticket.add(new api.ODDynamicStat("opendiscord:creation-date",1,async (scopeId,guild,channel,user) => {
|
||||
ticket.add(new api.ODDynamicStatistic("opendiscord:creation-date",1,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
const rawDate = ticket.get("opendiscord:opened-on").value ?? new Date().getTime()
|
||||
return lang.getTranslation("params.uppercase.creationDate")+": "+discord.time(new Date(rawDate),"f")
|
||||
}))
|
||||
ticket.add(new api.ODDynamicStat("opendiscord:creator",0,async (scopeId,guild,channel,user) => {
|
||||
ticket.add(new api.ODDynamicStatistic("opendiscord:creator",0,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
const creator = ticket.get("opendiscord:opened-by").value
|
||||
return lang.getTranslation("params.uppercase.creator")+": "+ (creator ? discord.userMention(creator) : "`unknown`")
|
||||
}))
|
||||
ticket.add(new api.ODDynamicStat("opendiscord:ticket-age",-1,async (scopeId,guild,channel,user) => {
|
||||
ticket.add(new api.ODDynamicStatistic("opendiscord:ticket-age",-1,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
@@ -142,7 +142,7 @@ export const loadAllStats = async () => {
|
||||
|
||||
const participants = stats.get("opendiscord:participants")
|
||||
if (participants){
|
||||
participants.add(new api.ODDynamicStat("opendiscord:participants",0,async (scopeId,guild,channel,user) => {
|
||||
participants.add(new api.ODDynamicStatistic("opendiscord:participants",0,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
@@ -157,7 +157,7 @@ export const loadAllStats = async () => {
|
||||
|
||||
const messages = stats.get("opendiscord:messages")
|
||||
if (messages){
|
||||
messages.add(new api.ODDynamicStat("opendiscord:count",0,async (scopeId,guild,channel,user) => {
|
||||
messages.add(new api.ODDynamicStatistic("opendiscord:count",0,async (scopeId,guild,channel,user) => {
|
||||
const ticket = opendiscord.tickets.get(scopeId)
|
||||
if (!ticket) return ""
|
||||
|
||||
Reference in New Issue
Block a user