@open-discord-bots/framework 0.2.5 → 0.2.6
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/dist/api/modules/action.d.ts +4 -4
- package/dist/api/modules/base.d.ts +12 -6
- package/dist/api/modules/builder.d.ts +25 -25
- package/dist/api/modules/checker.d.ts +7 -7
- package/dist/api/modules/client.d.ts +13 -13
- package/dist/api/modules/code.d.ts +4 -4
- package/dist/api/modules/config.d.ts +4 -4
- package/dist/api/modules/console.d.ts +4 -4
- package/dist/api/modules/cooldown.d.ts +4 -4
- package/dist/api/modules/database.d.ts +13 -13
- package/dist/api/modules/event.d.ts +4 -4
- package/dist/api/modules/flag.d.ts +4 -4
- package/dist/api/modules/helpmenu.d.ts +7 -7
- package/dist/api/modules/language.d.ts +6 -6
- package/dist/api/modules/permission.d.ts +4 -4
- package/dist/api/modules/plugin.d.ts +7 -7
- package/dist/api/modules/post.d.ts +4 -4
- package/dist/api/modules/progressbar.d.ts +7 -7
- package/dist/api/modules/responder.d.ts +19 -19
- package/dist/api/modules/session.d.ts +4 -4
- package/dist/api/modules/startscreen.d.ts +4 -4
- package/dist/api/modules/statistic.d.ts +15 -15
- package/dist/api/modules/verifybar.d.ts +4 -4
- package/package.json +1 -1
- package/src/api/modules/action.ts +4 -4
- package/src/api/modules/base.ts +15 -10
- package/src/api/modules/builder.ts +25 -25
- package/src/api/modules/checker.ts +7 -7
- package/src/api/modules/client.ts +13 -13
- package/src/api/modules/code.ts +4 -4
- package/src/api/modules/config.ts +4 -4
- package/src/api/modules/console.ts +4 -4
- package/src/api/modules/cooldown.ts +4 -4
- package/src/api/modules/database.ts +13 -13
- package/src/api/modules/event.ts +4 -4
- package/src/api/modules/flag.ts +4 -4
- package/src/api/modules/helpmenu.ts +7 -7
- package/src/api/modules/language.ts +6 -6
- package/src/api/modules/permission.ts +4 -4
- package/src/api/modules/plugin.ts +7 -7
- package/src/api/modules/post.ts +4 -4
- package/src/api/modules/progressbar.ts +7 -7
- package/src/api/modules/responder.ts +19 -19
- package/src/api/modules/session.ts +4 -4
- package/src/api/modules/startscreen.ts +4 -4
- package/src/api/modules/statistic.ts +15 -15
- package/src/api/modules/verifybar.ts +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
///////////////////////////////////////
|
|
2
2
|
//STATISTIC MODULE
|
|
3
3
|
///////////////////////////////////////
|
|
4
|
-
import { ODId, ODManager, ODManagerData, ODSystemError, ODValidId } from "./base"
|
|
4
|
+
import { ODId, ODManager, ODManagerData, ODNoGeneric, 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"
|
|
@@ -100,21 +100,21 @@ export class ODStatisticManager<IdList extends ODStatisticManagerIdConstraint =
|
|
|
100
100
|
this.#initListeners.push(callback)
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
get<ScopeId extends keyof IdList
|
|
103
|
+
get<ScopeId extends keyof ODNoGeneric<IdList>>(id:ScopeId): IdList[ScopeId]
|
|
104
104
|
get(id:ODValidId): ODStatisticScope|null
|
|
105
105
|
|
|
106
106
|
get(id:ODValidId): ODStatisticScope|null {
|
|
107
107
|
return super.get(id)
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
remove<ScopeId extends keyof IdList
|
|
110
|
+
remove<ScopeId extends keyof ODNoGeneric<IdList>>(id:ScopeId): IdList[ScopeId]
|
|
111
111
|
remove(id:ODValidId): ODStatisticScope|null
|
|
112
112
|
|
|
113
113
|
remove(id:ODValidId): ODStatisticScope|null {
|
|
114
114
|
return super.remove(id)
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
exists(id:keyof IdList): boolean
|
|
117
|
+
exists(id:keyof ODNoGeneric<IdList>): boolean
|
|
118
118
|
exists(id:ODValidId): boolean
|
|
119
119
|
|
|
120
120
|
exists(id:ODValidId): boolean {
|
|
@@ -155,7 +155,7 @@ export class ODStatisticScope<IdList extends ODStatisticScopeIdConstraint = ODSt
|
|
|
155
155
|
this.database = database
|
|
156
156
|
}
|
|
157
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
|
|
158
|
+
getStat<StatisticId extends keyof ODNoGeneric<IdList>>(id:StatisticId, scopeId:string): Promise<ODValidStatisticValue|null>
|
|
159
159
|
getStat(id:ODValidId, scopeId:string): Promise<ODValidStatisticValue|null>
|
|
160
160
|
async getStat(id:ODValidId, scopeId:string): Promise<ODValidStatisticValue|null> {
|
|
161
161
|
if (!this.database) return null
|
|
@@ -173,7 +173,7 @@ export class ODStatisticScope<IdList extends ODStatisticScopeIdConstraint = ODSt
|
|
|
173
173
|
return null
|
|
174
174
|
}
|
|
175
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
|
|
176
|
+
getAllStats<StatisticId extends keyof ODNoGeneric<IdList>>(id:StatisticId): Promise<{id:string,value:ODValidStatisticValue}[]>
|
|
177
177
|
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatisticValue}[]>
|
|
178
178
|
async getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatisticValue}[]> {
|
|
179
179
|
if (!this.database) return []
|
|
@@ -192,7 +192,7 @@ export class ODStatisticScope<IdList extends ODStatisticScopeIdConstraint = ODSt
|
|
|
192
192
|
return output
|
|
193
193
|
}
|
|
194
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
|
|
195
|
+
setStat<StatisticId extends keyof ODNoGeneric<IdList>>(id:StatisticId, scopeId:string, value:ODValidStatisticValue, mode:ODStatisticScopeSetMode): Promise<boolean>
|
|
196
196
|
setStat(id:ODValidId, scopeId:string, value:ODValidStatisticValue, mode:ODStatisticScopeSetMode): Promise<boolean>
|
|
197
197
|
async setStat(id:ODValidId, scopeId:string, value:ODValidStatisticValue, mode:ODStatisticScopeSetMode): Promise<boolean> {
|
|
198
198
|
if (!this.database) return false
|
|
@@ -212,7 +212,7 @@ export class ODStatisticScope<IdList extends ODStatisticScopeIdConstraint = ODSt
|
|
|
212
212
|
return true
|
|
213
213
|
}
|
|
214
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
|
|
215
|
+
resetStat<StatisticId extends keyof ODNoGeneric<IdList>>(id:ODValidId, scopeId:string): Promise<ODValidStatisticValue|null>
|
|
216
216
|
resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatisticValue|null>
|
|
217
217
|
async resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatisticValue|null> {
|
|
218
218
|
if (!this.database) return null
|
|
@@ -255,21 +255,21 @@ export class ODStatisticScope<IdList extends ODStatisticScopeIdConstraint = ODSt
|
|
|
255
255
|
return result.filter((stat) => stat !== "").join("\n")
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
get<StatisticId extends keyof IdList
|
|
258
|
+
get<StatisticId extends keyof ODNoGeneric<IdList>>(id:StatisticId): IdList[StatisticId]
|
|
259
259
|
get(id:ODValidId): ODStatistic|null
|
|
260
260
|
|
|
261
261
|
get(id:ODValidId): ODStatistic|null {
|
|
262
262
|
return super.get(id)
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
remove<StatisticId extends keyof IdList
|
|
265
|
+
remove<StatisticId extends keyof ODNoGeneric<IdList>>(id:StatisticId): IdList[StatisticId]
|
|
266
266
|
remove(id:ODValidId): ODStatistic|null
|
|
267
267
|
|
|
268
268
|
remove(id:ODValidId): ODStatistic|null {
|
|
269
269
|
return super.remove(id)
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
exists(id:keyof IdList): boolean
|
|
272
|
+
exists(id:keyof ODNoGeneric<IdList>): boolean
|
|
273
273
|
exists(id:ODValidId): boolean
|
|
274
274
|
|
|
275
275
|
exists(id:ODValidId): boolean {
|
|
@@ -286,25 +286,25 @@ export class ODStatisticScope<IdList extends ODStatisticScopeIdConstraint = ODSt
|
|
|
286
286
|
* This scope is made specifically for the global statistics of Open Discord.
|
|
287
287
|
*/
|
|
288
288
|
export class ODStatisticGlobalScope<IdList extends ODStatisticScopeIdConstraint = ODStatisticScopeIdConstraint> extends ODStatisticScope<IdList> {
|
|
289
|
-
getStat<StatisticId extends keyof IdList
|
|
289
|
+
getStat<StatisticId extends keyof ODNoGeneric<IdList>>(id:StatisticId): Promise<ODValidStatisticValue|null>
|
|
290
290
|
getStat(id:ODValidId): Promise<ODValidStatisticValue|null>
|
|
291
291
|
getStat(id:ODValidId): Promise<ODValidStatisticValue|null> {
|
|
292
292
|
return super.getStat(id,"GLOBAL")
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
getAllStats<StatisticId extends keyof IdList
|
|
295
|
+
getAllStats<StatisticId extends keyof ODNoGeneric<IdList>>(id:StatisticId): Promise<{id:string,value:ODValidStatisticValue}[]>
|
|
296
296
|
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatisticValue}[]>
|
|
297
297
|
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatisticValue}[]> {
|
|
298
298
|
return super.getAllStats(id)
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
setStat<StatisticId extends keyof IdList
|
|
301
|
+
setStat<StatisticId extends keyof ODNoGeneric<IdList>>(id:StatisticId, value:ODValidStatisticValue, mode:ODStatisticScopeSetMode): Promise<boolean>
|
|
302
302
|
setStat(id:ODValidId, value:ODValidStatisticValue, mode:ODStatisticScopeSetMode): Promise<boolean>
|
|
303
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<StatisticId extends keyof IdList
|
|
307
|
+
resetStat<StatisticId extends keyof ODNoGeneric<IdList>>(id:ODValidId): Promise<ODValidStatisticValue|null>
|
|
308
308
|
resetStat(id:ODValidId): Promise<ODValidStatisticValue|null>
|
|
309
309
|
resetStat(id:ODValidId): Promise<ODValidStatisticValue|null> {
|
|
310
310
|
return super.resetStat(id,"GLOBAL")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
///////////////////////////////////////
|
|
2
2
|
//VERIFYBAR MODULE
|
|
3
3
|
///////////////////////////////////////
|
|
4
|
-
import { ODId, ODManager, ODManagerData, ODValidId } from "./base"
|
|
4
|
+
import { ODId, ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base"
|
|
5
5
|
import { ODMessage } from "./builder"
|
|
6
6
|
import { ODDebugger } from "./console"
|
|
7
7
|
import { ODButtonResponderInstance } from "./responder"
|
|
@@ -64,21 +64,21 @@ export class ODVerifyBarManager<IdList extends ODVerifyBarManagerIdConstraint =
|
|
|
64
64
|
super(debug,"verifybar")
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
get<VerifyBarId extends keyof IdList
|
|
67
|
+
get<VerifyBarId extends keyof ODNoGeneric<IdList>>(id:VerifyBarId): ODVerifyBar<IdList[VerifyBarId]["successWorkerIds"],IdList[VerifyBarId]["failureWorkerIds"]>
|
|
68
68
|
get(id:ODValidId): ODVerifyBar|null
|
|
69
69
|
|
|
70
70
|
get(id:ODValidId): ODVerifyBar|null {
|
|
71
71
|
return super.get(id)
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
remove<VerifyBarId extends keyof IdList
|
|
74
|
+
remove<VerifyBarId extends keyof ODNoGeneric<IdList>>(id:VerifyBarId): ODVerifyBar<IdList[VerifyBarId]["successWorkerIds"],IdList[VerifyBarId]["failureWorkerIds"]>
|
|
75
75
|
remove(id:ODValidId): ODVerifyBar|null
|
|
76
76
|
|
|
77
77
|
remove(id:ODValidId): ODVerifyBar|null {
|
|
78
78
|
return super.remove(id)
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
exists(id:keyof IdList): boolean
|
|
81
|
+
exists(id:keyof ODNoGeneric<IdList>): boolean
|
|
82
82
|
exists(id:ODValidId): boolean
|
|
83
83
|
|
|
84
84
|
exists(id:ODValidId): boolean {
|