@open-discord-bots/framework 0.3.13 → 0.3.15

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.
Files changed (43) hide show
  1. package/dist/api/main.js +1 -1
  2. package/dist/api/modules/responder.js +50 -26
  3. package/dist/api/modules/verifybar.d.ts +1 -1
  4. package/dist/api/modules/verifybar.js +1 -1
  5. package/package.json +1 -1
  6. package/src/api/index.ts +0 -31
  7. package/src/api/main.ts +0 -203
  8. package/src/api/modules/action.ts +0 -89
  9. package/src/api/modules/base.ts +0 -845
  10. package/src/api/modules/builder.ts +0 -1755
  11. package/src/api/modules/checker.ts +0 -1826
  12. package/src/api/modules/client.ts +0 -2345
  13. package/src/api/modules/code.ts +0 -84
  14. package/src/api/modules/component.ts +0 -2000
  15. package/src/api/modules/config.ts +0 -264
  16. package/src/api/modules/console.ts +0 -697
  17. package/src/api/modules/cooldown.ts +0 -369
  18. package/src/api/modules/database.ts +0 -321
  19. package/src/api/modules/event.ts +0 -123
  20. package/src/api/modules/flag.ts +0 -99
  21. package/src/api/modules/fuse.ts +0 -365
  22. package/src/api/modules/helpmenu.ts +0 -273
  23. package/src/api/modules/language.ts +0 -230
  24. package/src/api/modules/permission.ts +0 -363
  25. package/src/api/modules/plugin.ts +0 -294
  26. package/src/api/modules/post.ts +0 -137
  27. package/src/api/modules/progressbar.ts +0 -370
  28. package/src/api/modules/responder.ts +0 -1625
  29. package/src/api/modules/session.ts +0 -181
  30. package/src/api/modules/startscreen.ts +0 -345
  31. package/src/api/modules/state.ts +0 -298
  32. package/src/api/modules/statistic.ts +0 -380
  33. package/src/api/modules/verifybar.ts +0 -68
  34. package/src/api/modules/worker.ts +0 -119
  35. package/src/cli/editConfig.ts +0 -930
  36. package/src/cli/index.ts +0 -152
  37. package/src/index.ts +0 -8
  38. package/src/startup/compilation.ts +0 -204
  39. package/src/startup/dump.ts +0 -46
  40. package/src/startup/errorHandling.ts +0 -42
  41. package/src/startup/pluginLauncher.ts +0 -265
  42. package/src/utilities/index.ts +0 -229
  43. package/tools/cleanup.js +0 -2
@@ -1,181 +0,0 @@
1
- ///////////////////////////////////////
2
- //SESSION MODULE
3
- ///////////////////////////////////////
4
- import { ODId, ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base.js"
5
- import { ODDebugger } from "./console.js"
6
- import * as crypto from "crypto"
7
-
8
- /**## ODSessionManagerIdConstraint `type`
9
- * The constraint/layout for id mappings/interfaces of the `ODSessionManager` class.
10
- */
11
- export type ODSessionManagerIdConstraint = Record<string,ODSession>
12
-
13
- /**## ODSessionManager `class`
14
- * This is an Open Discord session manager.
15
- *
16
- * It contains all sessions in Open Discord. Sessions are a sort of temporary storage which will be cleared when the bot stops.
17
- * Data in sessions have a randomly generated key which will always be unique.
18
- *
19
- * Visit the `ODSession` class for more info
20
- */
21
- export class ODSessionManager<IdList extends ODSessionManagerIdConstraint = ODSessionManagerIdConstraint> extends ODManager<ODSession> {
22
- constructor(debug:ODDebugger){
23
- super(debug,"session")
24
- }
25
-
26
- get<SessionId extends keyof ODNoGeneric<IdList>>(id:SessionId): IdList[SessionId]
27
- get(id:ODValidId): ODSession|null
28
-
29
- get(id:ODValidId): ODSession|null {
30
- return super.get(id)
31
- }
32
-
33
- remove<SessionId extends keyof ODNoGeneric<IdList>>(id:SessionId): IdList[SessionId]
34
- remove(id:ODValidId): ODSession|null
35
-
36
- remove(id:ODValidId): ODSession|null {
37
- return super.remove(id)
38
- }
39
-
40
- exists(id:keyof ODNoGeneric<IdList>): boolean
41
- exists(id:ODValidId): boolean
42
-
43
- exists(id:ODValidId): boolean {
44
- return super.exists(id)
45
- }
46
- }
47
-
48
- /**## ODSessionInstance `interface`
49
- * This interface represents a single session instance. It contains an id, data & some dates.
50
- */
51
- export interface ODSessionInstance {
52
- /**The id of this session instance. */
53
- id:string,
54
- /**The creation date of this session instance. */
55
- creation:number,
56
- /**The custom amount of minutes before this session expires. */
57
- timeout:number|null,
58
- /**This is the data from this session instance */
59
- data:any
60
- }
61
-
62
- /**## ODSessionTimeoutCallback `type`
63
- * This is the callback used for session timeout listeners.
64
- */
65
- export type ODSessionTimeoutCallback = (id:string, timeout:"default"|"custom", data:any, creation:Date) => void
66
-
67
- /**## ODSession `class`
68
- * This is an Open Discord session.
69
- *
70
- * It can be used to create unique user sessions with an ID. Each session can store additional data which isn't saved to the filesystem.
71
- * You can almost compare it to the PHP session system.
72
- */
73
- export class ODSession extends ODManagerData {
74
- /**The history of previously generated instance ids. Used to reduce the risk of generating the same id twice. */
75
- protected idHistory: string[] = []
76
- /**The max length of the instance id history. */
77
- protected maxIdHistoryLength: number = 500
78
- /**An array of all the currently active session instances. */
79
- sessions: ODSessionInstance[] = []
80
- /**The default amount of minutes before a session automatically stops. */
81
- timeoutMinutes: number = 30
82
- /**The id of the auto-timeout session checker interval */
83
- protected intervalId: NodeJS.Timeout
84
- /**Listeners for when a session times-out. */
85
- protected timeoutListeners: ODSessionTimeoutCallback[] = []
86
-
87
- constructor(id:ODValidId, intervalSeconds?:number){
88
- super(id)
89
-
90
- //create the auto-timeout session checker
91
- this.intervalId = setInterval(() => {
92
- const deletableSessions: {instance:ODSessionInstance,reason:"default"|"custom"}[] = []
93
-
94
- //collect all deletable sessions
95
- this.sessions.forEach((session) => {
96
- if (session.timeout && (new Date().getTime() - session.creation) > session.timeout*60000){
97
- //stop session => custom timeout
98
- deletableSessions.push({instance:session,reason:"custom"})
99
- }else if (!session.timeout && (new Date().getTime() - session.creation) > this.timeoutMinutes*60000){
100
- //stop session => default timeout
101
- deletableSessions.push({instance:session,reason:"default"})
102
- }
103
- })
104
-
105
- //permanently delete sessions
106
- deletableSessions.forEach((session) => {
107
- const index = this.sessions.findIndex((s) => s.id === session.instance.id)
108
- this.sessions.splice(index,1)
109
-
110
- //emit timeout listeners
111
- this.timeoutListeners.forEach((cb) => cb(session.instance.id,session.reason,session.instance.data,new Date(session.instance.creation)))
112
- })
113
-
114
- },((intervalSeconds) ? (intervalSeconds * 1000) : 60000))
115
- }
116
-
117
- /**Create a unique hex id of 8 characters and add it to the instance id history */
118
- protected createUniqueId(): string {
119
- const hex = crypto.randomBytes(4).toString("hex")
120
- if (this.idHistory.includes(hex)){
121
- return this.createUniqueId()
122
- }else{
123
- this.idHistory.push(hex)
124
- if (this.idHistory.length > this.maxIdHistoryLength) this.idHistory.shift()
125
- return hex
126
- }
127
- }
128
- /**Stop the global interval that automatically deletes timed-out sessions. (This action can't be reverted!) */
129
- stopAutoTimeout(){
130
- clearInterval(this.intervalId)
131
- }
132
-
133
- /**Start a session instance with data. Returns the unique id required to access the session. */
134
- start(data?:any): string {
135
- const id = this.createUniqueId()
136
- this.sessions.push({
137
- id,data,
138
- creation:new Date().getTime(),
139
- timeout:null
140
- })
141
- return id
142
- }
143
- /**Get the data of a session instance. Returns `null` when not found. */
144
- data(id:string): any|null {
145
- const session = this.sessions.find((session) => session.id === id)
146
- if (!session) return null
147
- return session.data
148
- }
149
- /**Stop & delete a session instance. Returns `true` when sucessful. */
150
- stop(id:string): boolean {
151
- const index = this.sessions.findIndex((session) => session.id === id)
152
- if (index < 0) return false
153
- this.sessions.splice(index,1)
154
- return true
155
- }
156
- /**Update the data of a session instance. Returns `true` when sucessful. */
157
- update(id:string, data:any): boolean {
158
- const session = this.sessions.find((session) => session.id === id)
159
- if (!session) return false
160
- session.data = data
161
- return true
162
- }
163
- /**Change the global or session timeout minutes. Returns `true` when sucessful. */
164
- setTimeout(min:number, id?:string): boolean {
165
- if (!id){
166
- //change global timeout minutes
167
- this.timeoutMinutes = min
168
- return true
169
- }else{
170
- //change session instance timeout minutes
171
- const session = this.sessions.find((session) => session.id === id)
172
- if (!session) return false
173
- session.timeout = min
174
- return true
175
- }
176
- }
177
- /**Listen for a session timeout (default or custom) */
178
- onTimeout(callback:ODSessionTimeoutCallback){
179
- this.timeoutListeners.push(callback)
180
- }
181
- }
@@ -1,345 +0,0 @@
1
- ///////////////////////////////////////
2
- //STARTSCREEN MODULE
3
- ///////////////////////////////////////
4
- import { ODId, ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base.js"
5
- import { ODDebugger, ODError, ODLiveStatusManager, ODLiveStatusManagerIdConstraint } from "./console.js"
6
- import { ODFlag } from "./flag.js"
7
- import { ODPlugin, ODUnknownCrashedPlugin } from "./plugin.js"
8
- import ansis from "ansis"
9
-
10
- /**## ODStartScreenComponentRenderCallback `type`
11
- * This is the render function of a startscreen component. It also sends the location of where the component is rendered.
12
- */
13
- export type ODStartScreenComponentRenderCallback = (location:number) => string|Promise<string>
14
-
15
- /**## ODStartScreenManagerIdConstraint `type`
16
- * The constraint/layout for id mappings/interfaces of the `ODStartScreenManager` class.
17
- */
18
- export type ODStartScreenManagerIdConstraint = Record<string,ODStartScreenComponent>
19
-
20
- /**## ODStartScreenManager `class`
21
- * This is an Open Discord startscreen manager.
22
- *
23
- * This class is responsible for managing & rendering the startscreen of the bot.
24
- * The startscreen is the part you see when the bot has started up successfully. (e.g. the Open Discord logo, logs, livestatus, flags, ...)
25
- */
26
- export class ODStartScreenManager<IdList extends ODStartScreenManagerIdConstraint = ODStartScreenManagerIdConstraint,LiveStatus extends ODLiveStatusManager = ODLiveStatusManager> extends ODManager<ODStartScreenComponent> {
27
- /**Alias to the livestatus manager. */
28
- livestatus: LiveStatus
29
-
30
- constructor(debug:ODDebugger,livestatus:LiveStatus){
31
- super(debug,"startscreen component")
32
- this.livestatus = livestatus
33
- }
34
-
35
- /**Get all components in sorted order. */
36
- getSortedComponents(priority:"ascending"|"descending"){
37
- return this.getAll().sort((a,b) => {
38
- if (priority == "ascending") return a.priority-b.priority
39
- else return b.priority-a.priority
40
- })
41
- }
42
- /**Render all startscreen components in priority order. */
43
- async renderAllComponents(){
44
- const components = this.getSortedComponents("descending")
45
-
46
- let location = 0
47
- for (const component of components){
48
- try {
49
- const renderedText = await component.renderAll(location)
50
- console.log(renderedText)
51
- this.debug?.console.debugfile.writeText("[STARTSCREEN] Component: \""+component.id+"\"\n"+ansis.strip(renderedText))
52
- }catch(e){
53
- this.debug?.console.log("Unable to render \""+component.id+"\" startscreen component!","error")
54
- this.debug?.console.debugfile.writeErrorMessage(new ODError(e,"uncaughtException"))
55
- }
56
- location++
57
- }
58
- }
59
-
60
- get<StartScreenId extends keyof ODNoGeneric<IdList>>(id:StartScreenId): IdList[StartScreenId]
61
- get(id:ODValidId): ODStartScreenComponent|null
62
-
63
- get(id:ODValidId): ODStartScreenComponent|null {
64
- return super.get(id)
65
- }
66
-
67
- remove<StartScreenId extends keyof ODNoGeneric<IdList>>(id:StartScreenId): IdList[StartScreenId]
68
- remove(id:ODValidId): ODStartScreenComponent|null
69
-
70
- remove(id:ODValidId): ODStartScreenComponent|null {
71
- return super.remove(id)
72
- }
73
-
74
- exists(id:keyof ODNoGeneric<IdList>): boolean
75
- exists(id:ODValidId): boolean
76
-
77
- exists(id:ODValidId): boolean {
78
- return super.exists(id)
79
- }
80
- }
81
-
82
- /**## ODStartScreenComponent `class`
83
- * This is an Open Discord startscreen component.
84
- *
85
- * This component can be rendered to the start screen of the bot.
86
- * An optional priority can be specified to choose the location of the component.
87
- *
88
- * It's recommended to use pre-built components except if you really need a custom one.
89
- */
90
- export abstract class ODStartScreenComponent extends ODManagerData {
91
- /**The priority of this component. */
92
- priority: number
93
- /**An optional render function which will be inserted before the default renderer. */
94
- renderBefore: ODStartScreenComponentRenderCallback|null
95
- /**The render function which will render the contents of this component. */
96
- render: ODStartScreenComponentRenderCallback
97
- /**An optional render function which will be inserted behind the default renderer. */
98
- renderAfter: ODStartScreenComponentRenderCallback|null
99
-
100
- constructor(id:ODValidId, priority:number, render:ODStartScreenComponentRenderCallback,renderBefore?:ODStartScreenComponentRenderCallback,renderAfter?:ODStartScreenComponentRenderCallback){
101
- super(id)
102
- this.priority = priority
103
- this.render = render
104
- this.renderBefore = renderBefore ?? null
105
- this.renderAfter = renderAfter ?? null
106
- }
107
-
108
- /**Render this component and combine it with the `renderBefore` & `renderAfter` contents. */
109
- async renderAll(location:number){
110
- const textBefore = (this.renderBefore) ? await this.renderBefore(location) : ""
111
- const text = await this.render(location)
112
- const textAfter = (this.renderAfter) ? await this.renderAfter(location) : ""
113
- return (textBefore ? textBefore+"\n" : "")+text+(textAfter ? "\n"+textAfter : "")
114
- }
115
- }
116
-
117
- /**## ODStartScreenProperty `type`
118
- * This interface contains properties used in a few default templates of the startscreen component.
119
- */
120
- export interface ODStartScreenProperty {
121
- /**The key or name of this property. */
122
- key:string,
123
- /**The value or contents of this property. */
124
- value:string
125
- }
126
-
127
- /**## ODStartScreenLogoComponent `class`
128
- * This is an Open Discord startscreen logo component.
129
- *
130
- * This component will render an ASCII art logo (from an array) to the startscreen. Every property in the array is another row.
131
- * An optional priority can be specified to choose the location of the component.
132
- */
133
- export class ODStartScreenLogoComponent extends ODStartScreenComponent {
134
- /**The ASCII logo contents. */
135
- logo: string[]
136
- /**When enabled, the component will add a new line above the logo. */
137
- topPadding: boolean
138
- /**When enabled, the component will add a new line below the logo. */
139
- bottomPadding: boolean
140
- /**The color of the logo in hex format. */
141
- logoHexColor: string
142
-
143
- constructor(id:ODValidId, priority:number, logo:string[], topPadding?:boolean, bottomPadding?:boolean, logoHexColor?:string){
144
- super(id,priority,() => {
145
- const renderedTop = (this.topPadding ? "\n" : "")
146
- const renderedLogo = this.logo.join("\n")
147
- const renderedBottom = (this.bottomPadding ? "\n" : "")
148
- return ansis.hex(this.logoHexColor)(renderedTop+renderedLogo+renderedBottom)
149
- })
150
- this.logo = logo
151
- this.topPadding = topPadding ?? false
152
- this.bottomPadding = bottomPadding ?? false
153
- this.logoHexColor = logoHexColor ?? "#f8ba00"
154
- }
155
- }
156
-
157
- /**## ODStartScreenHeaderAlignmentSettings `type`
158
- * This interface contains all settings used in the startscreen header component.
159
- */
160
- export interface ODStartScreenHeaderAlignmentSettings {
161
- /**The alignment settings for this header. */
162
- align:"center"|"left"|"right",
163
- /**The width or component to use when calculating center & right alignment. */
164
- width:number|ODStartScreenComponent
165
- }
166
-
167
- /**## ODStartScreenHeaderComponent `class`
168
- * This is an Open Discord startscreen header component.
169
- *
170
- * This component will render a header to the startscreen. Properties can be aligned left, right or centered.
171
- * An optional priority can be specified to choose the location of the component.
172
- */
173
- export class ODStartScreenHeaderComponent extends ODStartScreenComponent {
174
- /**All properties of this header component. */
175
- properties: ODStartScreenProperty[]
176
- /**The spacer used between properties. */
177
- spacer: string
178
- /**The alignment settings of this header component. */
179
- align: ODStartScreenHeaderAlignmentSettings|null
180
-
181
- constructor(id:ODValidId, priority:number, properties:ODStartScreenProperty[], spacer?:string, align?:ODStartScreenHeaderAlignmentSettings){
182
- super(id,priority,async () => {
183
- const renderedProperties = ansis.bold(this.properties.map((prop) => prop.key+": "+prop.value).join(this.spacer))
184
- if (!this.align || this.align.align == "left"){
185
- return renderedProperties
186
- }else if (this.align.align == "right"){
187
- const width = (typeof this.align.width == "number") ? this.align.width : (
188
- ansis.strip(await this.align.width.renderAll(0)).split("\n").map((row) => row.length).reduce((prev,curr) => {
189
- if (prev < curr) return curr
190
- else return prev
191
- },0)
192
- )
193
- const offset = width - ansis.strip(renderedProperties).length
194
- if (offset < 0) return renderedProperties
195
- else{
196
- return (" ".repeat(offset) + renderedProperties)
197
- }
198
- }else if (this.align.align == "center"){
199
- const width = (typeof this.align.width == "number") ? this.align.width : (
200
- ansis.strip(await this.align.width.renderAll(0)).split("\n").map((row) => row.length).reduce((prev,curr) => {
201
- if (prev < curr) return curr
202
- else return prev
203
- })
204
- )
205
- const offset = Math.round((width - ansis.strip(renderedProperties).length)/2)
206
- if (offset < 0) return renderedProperties
207
- else{
208
- return (" ".repeat(offset) + renderedProperties)
209
- }
210
- }
211
- return renderedProperties
212
- })
213
- this.properties = properties
214
- this.spacer = spacer ?? " - "
215
- this.align = align ?? null
216
- }
217
- }
218
-
219
- /**## ODStartScreenCategoryComponent `class`
220
- * This is an Open Discord startscreen category component.
221
- *
222
- * This component will render a category to the startscreen. This will only render the category name. You'll need to provide your own renderer for the contents.
223
- * An optional priority can be specified to choose the location of the component.
224
- */
225
- export class ODStartScreenCategoryComponent extends ODStartScreenComponent {
226
- /**The name of this category. */
227
- name: string
228
- /**When enabled, this category will still be rendered when the contents are empty. (enabled by default) */
229
- renderIfEmpty: boolean
230
-
231
- constructor(id:ODValidId, priority:number, name:string, render:ODStartScreenComponentRenderCallback, renderIfEmpty?:boolean){
232
- super(id,priority,async (location) => {
233
- const contents = await render(location)
234
- if (contents != "" || this.renderIfEmpty){
235
- return ansis.bold.underline("\n"+this.name.toUpperCase()+(contents != "" ? ":\n" : ":")) + contents
236
- }else return ""
237
- })
238
- this.name = name
239
- this.renderIfEmpty = renderIfEmpty ?? true
240
- }
241
- }
242
-
243
- /**## ODStartScreenPropertiesCategoryComponent `class`
244
- * This is an Open Discord startscreen properties category component.
245
- *
246
- * This component will render a properties category to the startscreen. This will list the properties in the category.
247
- * An optional priority can be specified to choose the location of the component.
248
- */
249
- export class ODStartScreenPropertiesCategoryComponent extends ODStartScreenCategoryComponent {
250
- /**The properties of this category component. */
251
- properties: ODStartScreenProperty[]
252
- /**The hex color for the key/name of all the properties. */
253
- propertyHexColor: string
254
-
255
- constructor(id:ODValidId, priority:number, name:string, properties:ODStartScreenProperty[], propertyHexColor?:string, renderIfEmpty?:boolean){
256
- super(id,priority,name,() => {
257
- return this.properties.map((prop) => ansis.hex(this.propertyHexColor)(prop.key+": ")+prop.value).join("\n")
258
- },renderIfEmpty)
259
-
260
- this.properties = properties
261
- this.propertyHexColor = propertyHexColor ?? "#f8ba00"
262
- }
263
- }
264
-
265
- /**## ODStartScreenFlagsCategoryComponent `class`
266
- * This is an Open Discord startscreen flags category component.
267
- *
268
- * This component will render a flags category to the startscreen. This will list the enabled flags in the category.
269
- * An optional priority can be specified to choose the location of the component.
270
- */
271
- export class ODStartScreenFlagsCategoryComponent extends ODStartScreenCategoryComponent {
272
- /**A list of all flags to render. */
273
- flags: ODFlag[]
274
-
275
- constructor(id:ODValidId, priority:number, flags:ODFlag[]){
276
- super(id,priority,"flags",() => {
277
- return this.flags.filter((flag) => (flag.value == true)).map((flag) => ansis.blue("["+flag.name+"] "+flag.description)).join("\n")
278
- },false)
279
- this.flags = flags
280
- }
281
- }
282
-
283
- /**## ODStartScreenPluginsCategoryComponent `class`
284
- * This is an Open Discord startscreen plugins category component.
285
- *
286
- * This component will render a plugins category to the startscreen. This will list the enabled, disabled & crashed plugins in the category.
287
- * An optional priority can be specified to choose the location of the component.
288
- */
289
- export class ODStartScreenPluginsCategoryComponent extends ODStartScreenCategoryComponent {
290
- /**A list of all plugins to render. */
291
- plugins: ODPlugin[]
292
- /**A list of all crashed plugins to render. */
293
- unknownCrashedPlugins: ODUnknownCrashedPlugin[]
294
-
295
- constructor(id:ODValidId, priority:number, plugins:ODPlugin[], unknownCrashedPlugins:ODUnknownCrashedPlugin[]){
296
- super(id,priority,"plugins",() => {
297
- const disabledPlugins = this.plugins.filter((plugin) => !plugin.enabled)
298
-
299
- const renderedActivePlugins = this.plugins.filter((plugin) => plugin.enabled && plugin.executed).sort((a,b) => b.priority-a.priority).map((plugin) => ansis.green("✅ ["+plugin.name+"] "+plugin.details.shortDescription))
300
- const renderedCrashedPlugins = this.plugins.filter((plugin) => plugin.enabled && plugin.crashed).sort((a,b) => b.priority-a.priority).map((plugin) => ansis.red("❌ ["+plugin.name+"] "+plugin.details.shortDescription))
301
- const renderedDisabledPlugins = (disabledPlugins.length > 4) ? [ansis.gray("💤 (+"+disabledPlugins.length+" disabled plugins)")] : disabledPlugins.sort((a,b) => b.priority-a.priority).map((plugin) => ansis.gray("💤 ["+plugin.name+"] "+plugin.details.shortDescription))
302
- const renderedUnknownPlugins = unknownCrashedPlugins.map((plugin) => ansis.red("❌ ["+plugin.name+"] "+plugin.description))
303
-
304
- return [
305
- ...renderedActivePlugins,
306
- ...renderedDisabledPlugins,
307
- ...renderedCrashedPlugins,
308
- ...renderedUnknownPlugins
309
- ].join("\n")
310
- },false)
311
- this.plugins = plugins
312
- this.unknownCrashedPlugins = unknownCrashedPlugins
313
- }
314
- }
315
-
316
- /**## ODStartScreenLiveStatusCategoryComponent `class`
317
- * This is an Open Discord startscreen livestatus category component.
318
- *
319
- * This component will render a livestatus category to the startscreen. This will list the livestatus messages in the category.
320
- * An optional priority can be specified to choose the location of the component.
321
- */
322
- export class ODStartScreenLiveStatusCategoryComponent<LiveStatus extends ODLiveStatusManager<ODLiveStatusManagerIdConstraint>> extends ODStartScreenCategoryComponent {
323
- /**A reference to the Open Discord livestatus manager. */
324
- livestatus: LiveStatus
325
-
326
- constructor(id:ODValidId, priority:number, livestatus:LiveStatus){
327
- super(id,priority,"news & updates",async () => {
328
- const messages = await this.livestatus.getAllMessages()
329
- return this.livestatus.renderer.render(messages)
330
- },false)
331
- this.livestatus = livestatus
332
- }
333
- }
334
-
335
- /**## ODStartScreenLogsCategoryComponent `class`
336
- * This is an Open Discord startscreen logs category component.
337
- *
338
- * This component will render a logs category to the startscreen. This will only render the logs category name.
339
- * An optional priority can be specified to choose the location of the component.
340
- */
341
- export class ODStartScreenLogCategoryComponent extends ODStartScreenCategoryComponent {
342
- constructor(id:ODValidId, priority:number){
343
- super(id,priority,"logs",() => "",true)
344
- }
345
- }