@open-discord-bots/framework 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/api/main.ts CHANGED
@@ -1,26 +1,26 @@
1
1
  //BASE MODULES
2
- import { ODEnvHelper, ODProjectType, ODVersion, ODVersionManager, ODVersionManagerIdConstraint } from "./modules/base"
3
- import { ODConsoleManager, ODConsoleMessage, ODConsoleMessageParam, ODConsoleMessageTypes, ODDebugFileManager, ODDebugger, ODError, ODLiveStatusManager, ODLiveStatusManagerIdConstraint } from "./modules/console"
4
- import { ODCheckerFunctionManagerIdConstraint, ODCheckerManager, ODCheckerManagerIdConstraint, ODCheckerRenderer } from "./modules/checker"
2
+ import { ODEnvHelper, ODProjectType, ODVersion, ODVersionManager } from "./modules/base"
3
+ import { ODConsoleManager, ODConsoleMessage, ODConsoleMessageParam, ODConsoleMessageTypes, ODDebugFileManager, ODDebugger, ODError, ODLiveStatusManager } from "./modules/console"
4
+ import { ODCheckerManager } from "./modules/checker"
5
5
  import { ODEventManager } from "./modules/event"
6
6
  import { ODPluginManager } from "./modules/plugin"
7
7
  import { ODFlagManager } from "./modules/flag"
8
8
  import { ODProgressBarManager } from "./modules/progressbar"
9
- import { ODConfigManager, ODConfigManagerIdConstraint } from "./modules/config"
10
- import { ODDatabaseManager, ODDatabaseManagerIdConstraint } from "./modules/database"
9
+ import { ODConfigManager } from "./modules/config"
10
+ import { ODDatabaseManager } from "./modules/database"
11
11
  import { ODSessionManager } from "./modules/session"
12
12
  import { ODLanguageManager } from "./modules/language"
13
- import { ODBuilderManager, ODButtonManagerIdConstraint, ODDropdownManagerIdConstraint, ODEmbedManagerIdConstraint, ODFileManagerIdConstraint, ODMessageManagerIdConstraint, ODModalManagerIdConstraint } from "./modules/builder"
13
+ import { ODBuilderManager } from "./modules/builder"
14
14
  import { ODResponderManager } from "./modules/responder"
15
- import { ODActionManager, ODActionManagerIdConstraint } from "./modules/action"
15
+ import { ODActionManager } from "./modules/action"
16
16
  import { ODVerifyBarManager } from "./modules/verifybar"
17
17
  import { ODPermissionManager } from "./modules/permission"
18
- import { ODCooldownManager, ODCooldownManagerIdConstraint } from "./modules/cooldown"
18
+ import { ODCooldownManager } from "./modules/cooldown"
19
19
  import { ODHelpMenuManager } from "./modules/helpmenu"
20
- import { ODStatsManager } from "./modules/stat"
21
- import { ODCodeManager, ODCodeManagerIdConstraint } from "./modules/code"
20
+ import { ODStatisticManager } from "./modules/statistic"
21
+ import { ODCodeManager } from "./modules/code"
22
22
  import { ODPostManager } from "./modules/post"
23
- import { ODClientManager, ODContextMenuManagerIdConstraint, ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint } from "./modules/client"
23
+ import { ODClientManager } from "./modules/client"
24
24
  import { ODSharedFuseManager } from "./modules/fuse"
25
25
  import { ODStartScreenManager } from "./modules/startscreen"
26
26
 
@@ -77,7 +77,7 @@ export interface ODMainManagers {
77
77
  /**The manager that manages & renders the Open Discord help menu. (not the embed, but the text) */
78
78
  helpmenu: ODHelpMenuManager
79
79
  /**The manager that manages, saves & renders the Open Discord statistics. (not the embed, but the text & database) */
80
- stats: ODStatsManager
80
+ statistics: ODStatisticManager
81
81
  /**This manager is a place where you can put code that executes when the bot almost finishes the setup. (can be used for less important stuff that doesn't require an exact time-order) */
82
82
  code: ODCodeManager
83
83
  /**The manager that manages all posts (static discord channels) in the bot. (e.g. transcripts, logs, etc) */
@@ -129,7 +129,7 @@ export class ODMain implements ODMainManagers {
129
129
  readonly permissions: ODPermissionManager
130
130
  readonly cooldowns: ODCooldownManager
131
131
  readonly helpmenu: ODHelpMenuManager
132
- readonly stats: ODStatsManager
132
+ readonly statistics: ODStatisticManager
133
133
  readonly code: ODCodeManager
134
134
  readonly posts: ODPostManager
135
135
 
@@ -167,7 +167,7 @@ export class ODMain implements ODMainManagers {
167
167
  this.permissions = managers.permissions
168
168
  this.cooldowns = managers.cooldowns
169
169
  this.helpmenu = managers.helpmenu
170
- this.stats = managers.stats
170
+ this.statistics = managers.statistics
171
171
  this.code = managers.code
172
172
  this.posts = managers.posts
173
173
 
@@ -12,7 +12,7 @@ import { ODDebugger } from "./console"
12
12
  * You can also specify a priority to change the execution order.
13
13
  * In Open Discord, this is used for the following processes:
14
14
  * - Autoclose/delete
15
- * - Database syncronisation (with tickets, stats & used options)
15
+ * - Database syncronisation (with tickets, statistics & used options)
16
16
  * - Panel auto-update
17
17
  * - Database Garbage Collection (removing tickets that don't exist anymore)
18
18
  * - And more!
@@ -347,7 +347,7 @@ export class ODDebugFileManager {
347
347
  fs.writeFileSync(this.path,newtext)
348
348
  }
349
349
  }
350
- /**Generate the stats/header of the debug file (containing the version) */
350
+ /**Generate the statistics/header of the debug file (containing the version) */
351
351
  #createStatsText(){
352
352
  const date = new Date()
353
353
  const dstring = `${date.getDate()}/${date.getMonth()+1}/${date.getFullYear()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`
@@ -359,7 +359,7 @@ export class ODDebugFileManager {
359
359
  "=========================\n\n"
360
360
  ].join("\n")
361
361
  }
362
- /**Write the stats/header to the debug file on startup */
362
+ /**Write the statistics/header to the debug file on startup */
363
363
  #writeStartupStats(){
364
364
  const currenttext = this.#readDebugFile()
365
365
  if (currenttext){
@@ -212,12 +212,12 @@ export interface ODSharedFuseList {
212
212
  /**Load the default Open Discord help menu components. */
213
213
  helpMenuComponentLoading:boolean,
214
214
 
215
- /**Load the default Open Discord stat scopes. */
216
- statScopesLoading:boolean,
217
- /**Load the default Open Discord stats. */
218
- statLoading:boolean,
219
- /**Initiate the default Open Discord stats. */
220
- statInitiating:boolean,
215
+ /**Load the default Open Discord statistic scopes. */
216
+ statisticScopesLoading:boolean,
217
+ /**Load the default Open Discord statistics. */
218
+ statisticLoading:boolean,
219
+ /**Initiate the default Open Discord statistics. */
220
+ statisticInitiating:boolean,
221
221
 
222
222
  /**Load the default Open Discord code/functions. */
223
223
  codeLoading:boolean,
@@ -329,9 +329,9 @@ export class ODSharedFuseManager extends ODFuseManager<ODSharedFuseList> {
329
329
  helpMenuCategoryLoading:true,
330
330
  helpMenuComponentLoading:true,
331
331
 
332
- statScopesLoading:true,
333
- statLoading:true,
334
- statInitiating:true,
332
+ statisticScopesLoading:true,
333
+ statisticLoading:true,
334
+ statisticInitiating:true,
335
335
 
336
336
  codeLoading:true,
337
337
  codeExecution:true,
@@ -1,66 +1,66 @@
1
1
  ///////////////////////////////////////
2
- //STAT MODULE
2
+ //STATISTIC MODULE
3
3
  ///////////////////////////////////////
4
4
  import { ODId, ODManager, ODManagerData, ODSystemError, ODValidId } from "./base"
5
5
  import { ODDebugger } from "./console"
6
6
  import { ODDatabase, ODDatabaseIdConstraint, ODJsonDatabaseStructure } from "./database"
7
7
  import * as discord from "discord.js"
8
8
 
9
- /**## ODValidStatValue `type`
10
- * These are the only allowed types for a stat value to improve compatibility with different database systems.
9
+ /**## ODValidStatisticValue `type`
10
+ * These are the only allowed types for a statistic value to improve compatibility with different database systems.
11
11
  */
12
- export type ODValidStatValue = string|number|boolean
12
+ export type ODValidStatisticValue = string|number|boolean
13
13
 
14
- /**## ODStatsManagerInitCallback `type`
15
- * This callback can be used to execute something when the stats have been initiated.
14
+ /**## ODStatisticManagerInitCallback `type`
15
+ * This callback can be used to execute something when the statistics have been initiated.
16
16
  *
17
- * By default this is used to clear stats from users that left the server or tickets which don't exist anymore.
17
+ * By default this is used to clear statistics from users that left the server or tickets which don't exist anymore.
18
18
  */
19
- export type ODStatsManagerInitCallback = (database:ODJsonDatabaseStructure, deletables:ODJsonDatabaseStructure) => void|Promise<void>
19
+ export type ODStatisticManagerInitCallback = (database:ODJsonDatabaseStructure, deletables:ODJsonDatabaseStructure) => void|Promise<void>
20
20
 
21
- /**## ODStatScopeSetMode `type`
22
- * This type contains all valid methods for changing the value of a stat.
21
+ /**## ODStatisticScopeSetMode `type`
22
+ * This type contains all valid methods for changing the value of a statistic.
23
23
  */
24
- export type ODStatScopeSetMode = "set"|"increase"|"decrease"
24
+ export type ODStatisticScopeSetMode = "set"|"increase"|"decrease"
25
25
 
26
- /**## ODStatsManagerIdConstraint `type`
27
- * The constraint/layout for id mappings/interfaces of the `ODStatsManager` class.
26
+ /**## ODStatisticManagerIdConstraint `type`
27
+ * The constraint/layout for id mappings/interfaces of the `ODStatisticManager` class.
28
28
  */
29
- export type ODStatsManagerIdConstraint = Record<string,ODStatScope>
29
+ export type ODStatisticManagerIdConstraint = Record<string,ODStatisticScope>
30
30
 
31
- /**## ODStatsManager `class`
32
- * This is an Open Discord stats manager.
31
+ /**## ODStatisticManager `class`
32
+ * This is an Open Discord statistics manager.
33
33
  *
34
- * This class is responsible for managing all stats of the bot.
35
- * Stats are categorized in "scopes" which can be accessed in this manager.
34
+ * This class is responsible for managing all statistics of the bot.
35
+ * Statistic are categorized in "scopes" which can be accessed in this manager.
36
36
  *
37
- * Stats can be accessed in the individual scopes.
37
+ * Statistic can be accessed in the individual scopes.
38
38
  */
39
- export class ODStatsManager<IdList extends ODStatsManagerIdConstraint = ODStatsManagerIdConstraint> extends ODManager<ODStatScope> {
39
+ export class ODStatisticManager<IdList extends ODStatisticManagerIdConstraint = ODStatisticManagerIdConstraint> extends ODManager<ODStatisticScope> {
40
40
  /**Alias to Open Discord debugger. */
41
41
  #debug: ODDebugger
42
- /**Alias to Open Discord stats database. */
42
+ /**Alias to Open Discord statistics database. */
43
43
  database: ODDatabase<ODDatabaseIdConstraint>|null = null
44
44
  /**All the listeners for the init event. */
45
- #initListeners: ODStatsManagerInitCallback[] = []
45
+ #initListeners: ODStatisticManagerInitCallback[] = []
46
46
 
47
47
  constructor(debug:ODDebugger){
48
- super(debug,"stat scope")
48
+ super(debug,"statistic scope")
49
49
  this.#debug = debug
50
50
  }
51
51
 
52
- /**Select the database to use to read/write all stats from/to. */
52
+ /**Select the database to use to read/write all statistics from/to. */
53
53
  useDatabase(database:ODDatabase<ODDatabaseIdConstraint>){
54
54
  this.database = database
55
55
  }
56
- add(data:ODStatScope, overwrite?:boolean): boolean {
56
+ add(data:ODStatisticScope, overwrite?:boolean): boolean {
57
57
  data.useDebug(this.#debug,"stat")
58
58
  if (this.database) data.useDatabase(this.database)
59
59
  return super.add(data,overwrite)
60
60
  }
61
- /**Init all stats and run `onInit()` listeners. */
61
+ /**Init all statistics and run `onInit()` listeners. */
62
62
  async init(){
63
- if (!this.database) throw new ODSystemError("Unable to initialize stats scopes due to missing database!")
63
+ if (!this.database) throw new ODSystemError("Unable to initialize statistics scopes due to missing database!")
64
64
 
65
65
  //get all valid categories
66
66
  const validCategories: string[] = []
@@ -68,7 +68,7 @@ export class ODStatsManager<IdList extends ODStatsManagerIdConstraint = ODStatsM
68
68
  validCategories.push(...scope.init())
69
69
  }
70
70
 
71
- //filter out the deletable stats
71
+ //filter out the deletable statistics
72
72
  const deletableStats: ODJsonDatabaseStructure = []
73
73
  const data = await this.database.getAll()
74
74
  data.forEach((data) => {
@@ -80,13 +80,13 @@ export class ODStatsManager<IdList extends ODStatsManagerIdConstraint = ODStatsM
80
80
  await cb(data,deletableStats)
81
81
  }
82
82
 
83
- //delete all deletable stats
83
+ //delete all deletable statistics
84
84
  for (const data of deletableStats){
85
85
  if (!this.database) return
86
86
  await this.database.delete(data.category,data.key)
87
87
  }
88
88
  }
89
- /**Reset all stats. (clears the entire database) */
89
+ /**Reset all statistics. (clears the entire database) */
90
90
  async reset(){
91
91
  if (!this.database) return
92
92
  const data = await this.database.getAll()
@@ -95,22 +95,22 @@ export class ODStatsManager<IdList extends ODStatsManagerIdConstraint = ODStatsM
95
95
  await this.database.delete(d.category,d.key)
96
96
  }
97
97
  }
98
- /**Run a function when the stats are initialized. This can be used to clear stats from users that left the server or tickets which don't exist anymore. */
99
- onInit(callback:ODStatsManagerInitCallback){
98
+ /**Run a function when the statistics are initialized. This can be used to clear statistics from users that left the server or tickets which don't exist anymore. */
99
+ onInit(callback:ODStatisticManagerInitCallback){
100
100
  this.#initListeners.push(callback)
101
101
  }
102
102
 
103
- get<StatsId extends keyof IdList>(id:StatsId): IdList[StatsId]
104
- get(id:ODValidId): ODStatScope|null
103
+ get<ScopeId extends keyof IdList>(id:ScopeId): IdList[ScopeId]
104
+ get(id:ODValidId): ODStatisticScope|null
105
105
 
106
- get(id:ODValidId): ODStatScope|null {
106
+ get(id:ODValidId): ODStatisticScope|null {
107
107
  return super.get(id)
108
108
  }
109
109
 
110
- remove<StatsId extends keyof IdList>(id:StatsId): IdList[StatsId]
111
- remove(id:ODValidId): ODStatScope|null
110
+ remove<ScopeId extends keyof IdList>(id:ScopeId): IdList[ScopeId]
111
+ remove(id:ODValidId): ODStatisticScope|null
112
112
 
113
- remove(id:ODValidId): ODStatScope|null {
113
+ remove(id:ODValidId): ODStatisticScope|null {
114
114
  return super.remove(id)
115
115
  }
116
116
 
@@ -121,25 +121,25 @@ export class ODStatsManager<IdList extends ODStatsManagerIdConstraint = ODStatsM
121
121
  return super.exists(id)
122
122
  }
123
123
  }
124
- /**## ODStatScopeIdConstraint `type`
125
- * The constraint/layout for id mappings/interfaces of the `ODStatScope` class.
124
+ /**## ODStatisticScopeIdConstraint `type`
125
+ * The constraint/layout for id mappings/interfaces of the `ODStatisticScope` class.
126
126
  */
127
- export type ODStatScopeIdConstraint = Record<string,ODStat>
127
+ export type ODStatisticScopeIdConstraint = Record<string,ODStatistic>
128
128
 
129
- /**## ODStatScope `class`
130
- * This is an Open Discord stat scope.
129
+ /**## ODStatisticScope `class`
130
+ * This is an Open Discord statistic scope.
131
131
  *
132
- * A scope can contain multiple stats. Every scope is seperated from other scopes.
133
- * Here, you can read & write the values of all stats.
132
+ * A scope can contain multiple statistics. Every scope is seperated from other scopes.
133
+ * Here, you can read & write the values of all statistics.
134
134
  *
135
135
  * The built-in Open Discord scopes are: `global`, `user`, `ticket`
136
136
  */
137
- export class ODStatScope<IdList extends ODStatScopeIdConstraint = ODStatScopeIdConstraint> extends ODManager<ODStat> {
137
+ export class ODStatisticScope<IdList extends ODStatisticScopeIdConstraint = ODStatisticScopeIdConstraint> extends ODManager<ODStatistic> {
138
138
  /**The id of this statistics scope. */
139
139
  id: ODId
140
- /**Is this stat scope already initialized? */
140
+ /**Is this scope already initialized? */
141
141
  ready: boolean = false
142
- /**Alias to Open Discord stats database. */
142
+ /**Alias to Open Discord statistics database. */
143
143
  database: ODDatabase<ODDatabaseIdConstraint>|null = null
144
144
  /**The name of this scope (used in embed title) */
145
145
  name:string
@@ -150,20 +150,20 @@ export class ODStatScope<IdList extends ODStatScopeIdConstraint = ODStatScopeIdC
150
150
  this.name = name
151
151
  }
152
152
 
153
- /**Select the database to use to read/write all stats from/to. (Automatically assigned when used in `ODStatsManager`) */
153
+ /**Select the database to use to read/write all statistics from/to. (Automatically assigned when used in `ODStatisticManager`) */
154
154
  useDatabase(database:ODDatabase<ODDatabaseIdConstraint>){
155
155
  this.database = database
156
156
  }
157
- /**Get the value of a statistic. The `scopeId` is the unique id of the user, channel, role, etc that the stats are related to. */
158
- getStat<StatsId extends keyof IdList>(id:StatsId, scopeId:string): Promise<ODValidStatValue|null>
159
- getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
160
- async getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
157
+ /**Get the value of a statistic. The `scopeId` is the unique id of the user, channel, role, etc that the statistics are related to. */
158
+ getStat<StatisticId extends keyof IdList>(id:StatisticId, scopeId:string): Promise<ODValidStatisticValue|null>
159
+ getStat(id:ODValidId, scopeId:string): Promise<ODValidStatisticValue|null>
160
+ async getStat(id:ODValidId, scopeId:string): Promise<ODValidStatisticValue|null> {
161
161
  if (!this.database) return null
162
162
  const newId = new ODId(id)
163
163
  const data = await this.database.get(this.id.value+"_"+newId.value,scopeId)
164
164
 
165
165
  if (typeof data == "undefined"){
166
- //set stats to default value & return
166
+ //set statistics to default value & return
167
167
  return this.resetStat(id,scopeId)
168
168
  }else if (typeof data == "string" || typeof data == "boolean" || typeof data == "number"){
169
169
  //return value received from database
@@ -172,14 +172,14 @@ export class ODStatScope<IdList extends ODStatScopeIdConstraint = ODStatScopeIdC
172
172
  //return null on error
173
173
  return null
174
174
  }
175
- /**Get the value of a statistic for all `scopeId`'s. The `scopeId` is the unique id of the user, channel, role, etc that the stats are related to. */
176
- getAllStats<StatsId extends keyof IdList>(id:StatsId): Promise<{id:string,value:ODValidStatValue}[]>
177
- getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]>
178
- async getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]> {
175
+ /**Get the value of a statistic for all `scopeId`'s. The `scopeId` is the unique id of the user, channel, role, etc that the statistics are related to. */
176
+ getAllStats<StatisticId extends keyof IdList>(id:StatisticId): Promise<{id:string,value:ODValidStatisticValue}[]>
177
+ getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatisticValue}[]>
178
+ async getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatisticValue}[]> {
179
179
  if (!this.database) return []
180
180
  const newId = new ODId(id)
181
181
  const data = await this.database.getCategory(this.id.value+"_"+newId.value) ?? []
182
- const output: {id:string,value:ODValidStatValue}[] = []
182
+ const output: {id:string,value:ODValidStatisticValue}[] = []
183
183
 
184
184
  for (const stat of data){
185
185
  if (typeof stat.value == "string" || typeof stat.value == "boolean" || typeof stat.value == "number"){
@@ -191,10 +191,10 @@ export class ODStatScope<IdList extends ODStatScopeIdConstraint = ODStatScopeIdC
191
191
  //return null on error
192
192
  return output
193
193
  }
194
- /**Set, increase or decrease the value of a statistic. The `scopeId` is the unique id of the user, channel, role, etc that the stats are related to. */
195
- setStat<StatsId extends keyof IdList>(id:StatsId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
196
- setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
197
- async setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
194
+ /**Set, increase or decrease the value of a statistic. The `scopeId` is the unique id of the user, channel, role, etc that the statistics are related to. */
195
+ setStat<StatisticId extends keyof IdList>(id:StatisticId, scopeId:string, value:ODValidStatisticValue, mode:ODStatisticScopeSetMode): Promise<boolean>
196
+ setStat(id:ODValidId, scopeId:string, value:ODValidStatisticValue, mode:ODStatisticScopeSetMode): Promise<boolean>
197
+ async setStat(id:ODValidId, scopeId:string, value:ODValidStatisticValue, mode:ODStatisticScopeSetMode): Promise<boolean> {
198
198
  if (!this.database) return false
199
199
  const stat = this.get(id)
200
200
  if (!stat) return false
@@ -211,23 +211,23 @@ export class ODStatScope<IdList extends ODStatScopeIdConstraint = ODStatScopeIdC
211
211
  }
212
212
  return true
213
213
  }
214
- /**Reset the value of a statistic to the initial value. The `scopeId` is the unique id of the user, channel, role, etc that the stats are related to. */
215
- resetStat<StatsId extends keyof IdList>(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
216
- resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
217
- async resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
214
+ /**Reset the value of a statistic to the initial value. The `scopeId` is the unique id of the user, channel, role, etc that the statistics are related to. */
215
+ resetStat<StatisticId extends keyof IdList>(id:ODValidId, scopeId:string): Promise<ODValidStatisticValue|null>
216
+ resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatisticValue|null>
217
+ async resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatisticValue|null> {
218
218
  if (!this.database) return null
219
219
  const stat = this.get(id)
220
220
  if (!stat) return null
221
221
  if (stat.value != null) await this.database.set(this.id.value+"_"+stat.id.value,scopeId,stat.value)
222
222
  return stat.value
223
223
  }
224
- /**Initialize this stat scope & return a list of all statistic ids in the following format: `<scopeid>_<statid>` */
224
+ /**Initialize this statistic scope & return a list of all statistic ids in the following format: `<scopeid>_<statid>` */
225
225
  init(): string[] {
226
- //get all valid stats categories
226
+ //get all valid statistics categories
227
227
  this.ready = true
228
228
  return this.getAll().map((stat) => this.id.value+"_"+stat.id.value)
229
229
  }
230
- /**Render all stats in this scope for usage in a discord message/embed. */
230
+ /**Render all statistics in this scope for usage in a discord message/embed. */
231
231
  async render(scopeId:string, guild:discord.Guild, channel:discord.TextBasedChannel, user:discord.User): Promise<string> {
232
232
  //sort from high priority to low
233
233
  const derefArray = [...this.getAll()]
@@ -238,7 +238,7 @@ export class ODStatScope<IdList extends ODStatScopeIdConstraint = ODStatScopeIdC
238
238
 
239
239
  for (const stat of derefArray){
240
240
  try {
241
- if (stat instanceof ODDynamicStat){
241
+ if (stat instanceof ODDynamicStatistic){
242
242
  //dynamic render (without value)
243
243
  result.push(await stat.render("",scopeId,guild,channel,user))
244
244
  }else{
@@ -255,17 +255,17 @@ export class ODStatScope<IdList extends ODStatScopeIdConstraint = ODStatScopeIdC
255
255
  return result.filter((stat) => stat !== "").join("\n")
256
256
  }
257
257
 
258
- get<StatsId extends keyof IdList>(id:StatsId): IdList[StatsId]
259
- get(id:ODValidId): ODStat|null
258
+ get<StatisticId extends keyof IdList>(id:StatisticId): IdList[StatisticId]
259
+ get(id:ODValidId): ODStatistic|null
260
260
 
261
- get(id:ODValidId): ODStat|null {
261
+ get(id:ODValidId): ODStatistic|null {
262
262
  return super.get(id)
263
263
  }
264
264
 
265
- remove<StatsId extends keyof IdList>(id:StatsId): IdList[StatsId]
266
- remove(id:ODValidId): ODStat|null
265
+ remove<StatisticId extends keyof IdList>(id:StatisticId): IdList[StatisticId]
266
+ remove(id:ODValidId): ODStatistic|null
267
267
 
268
- remove(id:ODValidId): ODStat|null {
268
+ remove(id:ODValidId): ODStatistic|null {
269
269
  return super.remove(id)
270
270
  }
271
271
 
@@ -277,36 +277,36 @@ export class ODStatScope<IdList extends ODStatScopeIdConstraint = ODStatScopeIdC
277
277
  }
278
278
  }
279
279
 
280
- /**## ODStatGlobalScope `class`
281
- * This is an Open Discord stat global scope.
280
+ /**## ODStatisticGlobalScope `class`
281
+ * This is an Open Discord statistic global scope.
282
282
  *
283
- * A scope can contain multiple stats. Every scope is seperated from other scopes.
284
- * Here, you can read & write the values of all stats.
283
+ * A scope can contain multiple statistics. Every scope is seperated from other scopes.
284
+ * Here, you can read & write the values of all statistics.
285
285
  *
286
- * This scope is made specifically for the global stats of Open Discord.
286
+ * This scope is made specifically for the global statistics of Open Discord.
287
287
  */
288
- export class ODStatGlobalScope<IdList extends ODStatScopeIdConstraint = ODStatScopeIdConstraint> extends ODStatScope<IdList> {
289
- getStat<StatsId extends keyof IdList>(id:StatsId): Promise<ODValidStatValue|null>
290
- getStat(id:ODValidId): Promise<ODValidStatValue|null>
291
- getStat(id:ODValidId): Promise<ODValidStatValue|null> {
288
+ export class ODStatisticGlobalScope<IdList extends ODStatisticScopeIdConstraint = ODStatisticScopeIdConstraint> extends ODStatisticScope<IdList> {
289
+ getStat<StatisticId extends keyof IdList>(id:StatisticId): Promise<ODValidStatisticValue|null>
290
+ getStat(id:ODValidId): Promise<ODValidStatisticValue|null>
291
+ getStat(id:ODValidId): Promise<ODValidStatisticValue|null> {
292
292
  return super.getStat(id,"GLOBAL")
293
293
  }
294
294
 
295
- getAllStats<StatsId extends keyof IdList>(id:StatsId): Promise<{id:string,value:ODValidStatValue}[]>
296
- getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]>
297
- getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]> {
295
+ getAllStats<StatisticId extends keyof IdList>(id:StatisticId): Promise<{id:string,value:ODValidStatisticValue}[]>
296
+ getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatisticValue}[]>
297
+ getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatisticValue}[]> {
298
298
  return super.getAllStats(id)
299
299
  }
300
300
 
301
- setStat<StatsId extends keyof IdList>(id:StatsId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
302
- setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
303
- setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
301
+ setStat<StatisticId extends keyof IdList>(id:StatisticId, value:ODValidStatisticValue, mode:ODStatisticScopeSetMode): Promise<boolean>
302
+ setStat(id:ODValidId, value:ODValidStatisticValue, mode:ODStatisticScopeSetMode): Promise<boolean>
303
+ setStat(id:ODValidId, value:ODValidStatisticValue, mode:ODStatisticScopeSetMode): Promise<boolean> {
304
304
  return super.setStat(id,"GLOBAL",value,mode)
305
305
  }
306
306
 
307
- resetStat<StatsId extends keyof IdList>(id:ODValidId): Promise<ODValidStatValue|null>
308
- resetStat(id:ODValidId): Promise<ODValidStatValue|null>
309
- resetStat(id:ODValidId): Promise<ODValidStatValue|null> {
307
+ resetStat<StatisticId extends keyof IdList>(id:ODValidId): Promise<ODValidStatisticValue|null>
308
+ resetStat(id:ODValidId): Promise<ODValidStatisticValue|null>
309
+ resetStat(id:ODValidId): Promise<ODValidStatisticValue|null> {
310
310
  return super.resetStat(id,"GLOBAL")
311
311
  }
312
312
 
@@ -315,28 +315,28 @@ export class ODStatGlobalScope<IdList extends ODStatScopeIdConstraint = ODStatSc
315
315
  }
316
316
  }
317
317
 
318
- /**## ODStatRenderer `type`
318
+ /**## ODStatisticRenderer `type`
319
319
  * This callback will render a single statistic for a discord embed/message.
320
320
  */
321
- export type ODStatRenderer = (value:ODValidStatValue, scopeId:string, guild:discord.Guild, channel:discord.TextBasedChannel, user:discord.User) => string|Promise<string>
321
+ export type ODStatisticRenderer = (value:ODValidStatisticValue, scopeId:string, guild:discord.Guild, channel:discord.TextBasedChannel, user:discord.User) => string|Promise<string>
322
322
 
323
- /**## ODStat `class`
323
+ /**## ODStatistic `class`
324
324
  * This is an Open Discord statistic.
325
325
  *
326
326
  * This single statistic doesn't do anything except defining the rules of this statistic.
327
- * Use it in a stats scope to register a new statistic. A statistic can also include a priority to choose the render priority.
327
+ * Use it in a statistics scope to register a new statistic. A statistic can also include a priority to choose the render priority.
328
328
  *
329
- * It's recommended to use the `ODBasicStat` & `ODDynamicStat` classes instead of this one!
329
+ * It's recommended to use the `ODBaseStatistic` & `ODDynamicStatistic` classes instead of this one!
330
330
  */
331
- export class ODStat extends ODManagerData {
331
+ export class ODStatistic extends ODManagerData {
332
332
  /**The priority of this statistic. */
333
333
  priority: number
334
334
  /**The render function of this statistic. */
335
- render: ODStatRenderer
335
+ render: ODStatisticRenderer
336
336
  /**The value of this statistic. */
337
- value: ODValidStatValue|null
337
+ value: ODValidStatisticValue|null
338
338
 
339
- constructor(id:ODValidId, priority:number, render:ODStatRenderer, value?:ODValidStatValue){
339
+ constructor(id:ODValidId, priority:number, render:ODStatisticRenderer, value?:ODValidStatisticValue){
340
340
  super(id)
341
341
  this.priority = priority
342
342
  this.render = render
@@ -344,17 +344,17 @@ export class ODStat extends ODManagerData {
344
344
  }
345
345
  }
346
346
 
347
- /**## ODBasicStat `class`
347
+ /**## ODBaseStatistic `class`
348
348
  * This is an Open Discord basic statistic.
349
349
  *
350
350
  * This single statistic will store a number, boolean or string in the database.
351
- * Use it to create a simple statistic for any stats scope.
351
+ * Use it to create a simple statistic for any statistics scope.
352
352
  */
353
- export class ODBasicStat extends ODStat {
354
- /**The name of this stat. Rendered in discord embeds/messages. */
353
+ export class ODBaseStatistic extends ODStatistic {
354
+ /**The name of this statistic. Rendered in discord embeds/messages. */
355
355
  name: string
356
356
 
357
- constructor(id:ODValidId, priority:number, name:string, value:ODValidStatValue){
357
+ constructor(id:ODValidId, priority:number, name:string, value:ODValidStatisticValue){
358
358
  super(id,priority,(value) => {
359
359
  return ""+name+": `"+value.toString()+"`"
360
360
  },value)
@@ -362,12 +362,12 @@ export class ODBasicStat extends ODStat {
362
362
  }
363
363
  }
364
364
 
365
- /**## ODDynamicStatRenderer `type`
365
+ /**## ODDynamicStatisticRenderer `type`
366
366
  * This callback will render a single dynamic statistic for a discord embed/message.
367
367
  */
368
- export type ODDynamicStatRenderer = (scopeId:string, guild:discord.Guild, channel:discord.TextBasedChannel, user:discord.User) => string|Promise<string>
368
+ export type ODDynamicStatisticRenderer = (scopeId:string, guild:discord.Guild, channel:discord.TextBasedChannel, user:discord.User) => string|Promise<string>
369
369
 
370
- /**## ODDynamicStat `class`
370
+ /**## ODDynamicStatistic `class`
371
371
  * This is an Open Discord dynamic statistic.
372
372
  *
373
373
  * A dynamic statistic does not store anything in the database! Instead, it will execute a function to return a custom result.
@@ -375,8 +375,8 @@ export type ODDynamicStatRenderer = (scopeId:string, guild:discord.Guild, channe
375
375
  *
376
376
  * This is used in Open Discord for the live ticket status, participants & system status.
377
377
  */
378
- export class ODDynamicStat extends ODStat {
379
- constructor(id:ODValidId, priority:number, render:ODDynamicStatRenderer){
378
+ export class ODDynamicStatistic extends ODStatistic {
379
+ constructor(id:ODValidId, priority:number, render:ODDynamicStatisticRenderer){
380
380
  super(id,priority,(value,scopeId,guild,channel,user) => {
381
381
  return render(scopeId,guild,channel,user)
382
382
  })