@open-discord-bots/framework 0.2.17 → 0.3.1

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 (76) hide show
  1. package/dist/api/index.d.ts +16 -15
  2. package/dist/api/index.js +16 -15
  3. package/dist/api/main.d.ts +31 -23
  4. package/dist/api/main.js +3 -1
  5. package/dist/api/modules/action.d.ts +2 -2
  6. package/dist/api/modules/action.js +1 -5
  7. package/dist/api/modules/base.d.ts +29 -11
  8. package/dist/api/modules/base.js +78 -80
  9. package/dist/api/modules/builder.d.ts +2 -11
  10. package/dist/api/modules/builder.js +0 -4
  11. package/dist/api/modules/checker.d.ts +28 -7
  12. package/dist/api/modules/checker.js +33 -37
  13. package/dist/api/modules/client.d.ts +66 -14
  14. package/dist/api/modules/client.js +146 -132
  15. package/dist/api/modules/component.d.ts +928 -0
  16. package/dist/api/modules/component.js +1346 -0
  17. package/dist/api/modules/config.d.ts +30 -2
  18. package/dist/api/modules/config.js +90 -7
  19. package/dist/api/modules/console.d.ts +16 -4
  20. package/dist/api/modules/console.js +25 -25
  21. package/dist/api/modules/cooldown.d.ts +5 -5
  22. package/dist/api/modules/cooldown.js +1 -17
  23. package/dist/api/modules/database.d.ts +21 -13
  24. package/dist/api/modules/database.js +0 -23
  25. package/dist/api/modules/event.d.ts +4 -2
  26. package/dist/api/modules/event.js +8 -10
  27. package/dist/api/modules/fuse.d.ts +1 -1
  28. package/dist/api/modules/helpmenu.d.ts +11 -9
  29. package/dist/api/modules/helpmenu.js +24 -22
  30. package/dist/api/modules/language.d.ts +4 -3
  31. package/dist/api/modules/language.js +9 -16
  32. package/dist/api/modules/permission.d.ts +10 -1
  33. package/dist/api/modules/permission.js +17 -20
  34. package/dist/api/modules/plugin.d.ts +2 -1
  35. package/dist/api/modules/plugin.js +2 -2
  36. package/dist/api/modules/post.d.ts +12 -4
  37. package/dist/api/modules/post.js +36 -10
  38. package/dist/api/modules/progressbar.d.ts +18 -6
  39. package/dist/api/modules/progressbar.js +35 -35
  40. package/dist/api/modules/responder.d.ts +97 -28
  41. package/dist/api/modules/responder.js +213 -176
  42. package/dist/api/modules/session.d.ts +11 -2
  43. package/dist/api/modules/session.js +16 -16
  44. package/dist/api/modules/startscreen.d.ts +2 -3
  45. package/dist/api/modules/startscreen.js +8 -9
  46. package/dist/api/modules/statistic.d.ts +2 -1
  47. package/dist/api/modules/statistic.js +4 -7
  48. package/dist/api/modules/worker.d.ts +2 -1
  49. package/dist/api/modules/worker.js +3 -3
  50. package/package.json +3 -2
  51. package/src/api/index.ts +16 -15
  52. package/src/api/main.ts +33 -24
  53. package/src/api/modules/action.ts +2 -4
  54. package/src/api/modules/base.ts +77 -79
  55. package/src/api/modules/builder.ts +2 -14
  56. package/src/api/modules/checker.ts +36 -37
  57. package/src/api/modules/client.ts +144 -136
  58. package/src/api/modules/component.ts +1826 -0
  59. package/src/api/modules/config.ts +86 -7
  60. package/src/api/modules/console.ts +25 -25
  61. package/src/api/modules/cooldown.ts +8 -13
  62. package/src/api/modules/database.ts +24 -32
  63. package/src/api/modules/event.ts +6 -10
  64. package/src/api/modules/fuse.ts +1 -1
  65. package/src/api/modules/helpmenu.ts +31 -27
  66. package/src/api/modules/language.ts +11 -16
  67. package/src/api/modules/permission.ts +17 -20
  68. package/src/api/modules/plugin.ts +2 -2
  69. package/src/api/modules/post.ts +31 -10
  70. package/src/api/modules/progressbar.ts +36 -37
  71. package/src/api/modules/responder.ts +234 -185
  72. package/src/api/modules/session.ts +15 -15
  73. package/src/api/modules/startscreen.ts +9 -10
  74. package/src/api/modules/statistic.ts +4 -7
  75. package/src/api/modules/worker.ts +3 -3
  76. package/src/api/modules/component.txt +0 -350
@@ -1,26 +1,27 @@
1
1
  export * from "./main.js";
2
+ export * from "./modules/action.js";
2
3
  export * from "./modules/base.js";
3
- export * from "./modules/event.js";
4
+ export * from "./modules/builder.js";
5
+ export * from "./modules/checker.js";
6
+ export * from "./modules/client.js";
7
+ export * from "./modules/code.js";
8
+ export * from "./modules/component.js";
4
9
  export * from "./modules/config.js";
10
+ export * from "./modules/console.js";
11
+ export * from "./modules/cooldown.js";
5
12
  export * from "./modules/database.js";
6
- export * from "./modules/language.js";
13
+ export * from "./modules/event.js";
7
14
  export * from "./modules/flag.js";
8
- export * from "./modules/console.js";
9
15
  export * from "./modules/fuse.js";
16
+ export * from "./modules/helpmenu.js";
17
+ export * from "./modules/language.js";
18
+ export * from "./modules/permission.js";
10
19
  export * from "./modules/plugin.js";
11
- export * from "./modules/checker.js";
12
- export * from "./modules/client.js";
13
- export * from "./modules/worker.js";
14
- export * from "./modules/builder.js";
20
+ export * from "./modules/post.js";
21
+ export * from "./modules/progressbar.js";
15
22
  export * from "./modules/responder.js";
16
- export * from "./modules/action.js";
17
- export * from "./modules/permission.js";
18
- export * from "./modules/helpmenu.js";
19
23
  export * from "./modules/session.js";
24
+ export * from "./modules/startscreen.js";
20
25
  export * from "./modules/statistic.js";
21
- export * from "./modules/code.js";
22
- export * from "./modules/cooldown.js";
23
- export * from "./modules/post.js";
24
26
  export * from "./modules/verifybar.js";
25
- export * from "./modules/progressbar.js";
26
- export * from "./modules/startscreen.js";
27
+ export * from "./modules/worker.js";
package/dist/api/index.js CHANGED
@@ -1,28 +1,29 @@
1
1
  //MAIN MODULE
2
2
  export * from "./main.js";
3
3
  //BASE MODULES
4
+ export * from "./modules/action.js";
4
5
  export * from "./modules/base.js";
5
- export * from "./modules/event.js";
6
+ export * from "./modules/builder.js";
7
+ export * from "./modules/checker.js";
8
+ export * from "./modules/client.js";
9
+ export * from "./modules/code.js";
10
+ export * from "./modules/component.js";
6
11
  export * from "./modules/config.js";
12
+ export * from "./modules/console.js";
13
+ export * from "./modules/cooldown.js";
7
14
  export * from "./modules/database.js";
8
- export * from "./modules/language.js";
15
+ export * from "./modules/event.js";
9
16
  export * from "./modules/flag.js";
10
- export * from "./modules/console.js";
11
17
  export * from "./modules/fuse.js";
18
+ export * from "./modules/helpmenu.js";
19
+ export * from "./modules/language.js";
20
+ export * from "./modules/permission.js";
12
21
  export * from "./modules/plugin.js";
13
- export * from "./modules/checker.js";
14
- export * from "./modules/client.js";
15
- export * from "./modules/worker.js";
16
- export * from "./modules/builder.js";
22
+ export * from "./modules/post.js";
23
+ export * from "./modules/progressbar.js";
17
24
  export * from "./modules/responder.js";
18
- export * from "./modules/action.js";
19
- export * from "./modules/permission.js";
20
- export * from "./modules/helpmenu.js";
21
25
  export * from "./modules/session.js";
26
+ export * from "./modules/startscreen.js";
22
27
  export * from "./modules/statistic.js";
23
- export * from "./modules/code.js";
24
- export * from "./modules/cooldown.js";
25
- export * from "./modules/post.js";
26
28
  export * from "./modules/verifybar.js";
27
- export * from "./modules/progressbar.js";
28
- export * from "./modules/startscreen.js";
29
+ export * from "./modules/worker.js";
@@ -22,11 +22,12 @@ import { ODPostManager } from "./modules/post.js";
22
22
  import { ODClientManager } from "./modules/client.js";
23
23
  import { ODSharedFuseManager } from "./modules/fuse.js";
24
24
  import { ODStartScreenManager } from "./modules/startscreen.js";
25
+ import { ODComponentManager } from "./modules/component.js";
25
26
  /**## ODMainManagers `interface`
26
27
  * The global properties for the main class of the bot.
27
28
  */
28
29
  export interface ODMainManagers {
29
- /**The manager that handles all versions in the bot. */
30
+ /**A collection of versions of the bot, systems, frameworks & services. */
30
31
  versions: ODVersionManager;
31
32
  /**The timestamp that the (node.js) process of the bot started. */
32
33
  processStartupDate: Date;
@@ -44,47 +45,53 @@ export interface ODMainManagers {
44
45
  plugins: ODPluginManager;
45
46
  /**The manager that manages & checks all the console flags of the bot. (like `--debug`) */
46
47
  flags: ODFlagManager;
47
- /**The manager responsible for progress bars in the console. */
48
+ /**The manager responsible for displaying progress bars in the console. */
48
49
  progressbars: ODProgressBarManager;
49
- /**The manager that manages & contains all the config files of the bot. (like `config/general.json`) */
50
+ /**A collection of all the config files of the bot and plugins. (like `config/general.json`) */
50
51
  configs: ODConfigManager;
51
- /**The manager that manages & contains all the databases of the bot. (like `database/global.json`) */
52
+ /**A collection of all the databases of the bot and plugins. (like `database/global.json`) */
52
53
  databases: ODDatabaseManager;
53
- /**The manager that manages all the data sessions of the bot. (it's a temporary database) */
54
+ /**A collection of all the sessions of the bot. (Sessions are temporary objects stored in memory) */
54
55
  sessions: ODSessionManager;
55
- /**The manager that manages all languages & translations of the bot. (but not for plugins) */
56
+ /**The global translation manager which manges all language files, translations & switches between them. (Does not manage translations for plugins) */
56
57
  languages: ODLanguageManager;
57
- /**The manager that handles & executes all config checkers in the bot. (the code that checks if you have something wrong in your config) */
58
+ /**The manager responsible for checking the bot & plugin configs. (it checks for mistakes in your config) */
58
59
  checkers: ODCheckerManager;
59
- /**The manager that manages all builders in the bot. (e.g. buttons, dropdowns, messages, modals, etc) */
60
+ /**A collection of button, dropdown, embed, ... templates which can be used to construct messages and modals.
61
+ * ### (🚨 Better alternative: `opendiscord.components (ODComponentManager)`)
62
+ */
60
63
  builders: ODBuilderManager;
61
- /**The manager that manages all responders in the bot. (e.g. commands, buttons, dropdowns, modals) */
64
+ /**A collection of building blocks and templates for messages & modals with native support for Discord Components v2. (e.g. buttons, dropdowns, checkboxes, radio groups, file uploads, ...)
65
+ * ### (✅ New replacement for: `opendiscord.builders (ODBuilderManager)`)
66
+ */
67
+ components: ODComponentManager;
68
+ /**The manager that handles responses to all interactions of the bot. (e.g. slash/text commands, buttons, dropdowns, modals) */
62
69
  responders: ODResponderManager;
63
- /**The manager that manages all actions or procedures in the bot. (e.g. ticket-creation, ticket-deletion, ticket-claiming, etc) */
70
+ /**A collection of procedures. A procedure is a complex task which can be executed from multiple responders or events. (e.g. ticket-creation, ticket-deletion, ticket-claiming, ...) */
64
71
  actions: ODActionManager;
65
- /**The manager that manages all verify bars in the bot. (the ✅ ❌ buttons) */
72
+ /**A collection of verify bars from the bot. (the ✅ ❌ buttons in messages) */
66
73
  verifybars: ODVerifyBarManager;
67
- /**The manager that contains all permissions for commands & actions in the bot. (use it to check if someone has admin perms or not) */
74
+ /**A manager which will help with calculating permissions for commands & actions. */
68
75
  permissions: ODPermissionManager;
69
- /**The manager that contains all cooldowns of the bot. (e.g. ticket-cooldowns) */
76
+ /**The manager which will manage cooldowns in the bot. (e.g. ticket-create cooldowns) */
70
77
  cooldowns: ODCooldownManager;
71
- /**The manager that manages & renders the Open Discord help menu. (not the embed, but the text) */
78
+ /**The manager that collects & renders the Open Discord help menu contents. (not the final embed) */
72
79
  helpmenu: ODHelpMenuManager;
73
- /**The manager that manages, saves & renders the Open Discord statistics. (not the embed, but the text & database) */
80
+ /**The manager that registers, saves & updates statistics in the database. */
74
81
  statistics: ODStatisticManager;
75
- /**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
+ /**A place where you can put general-purpose code which will start on startup of the bot. (Perfect for background tasks) */
76
83
  code: ODCodeManager;
77
- /**The manager that manages all posts (static discord channels) in the bot. (e.g. transcripts, logs, etc) */
84
+ /**A collection of static Discord post channels. It allows the bot to find back log, transcript or configured channels based on a linked ID. */
78
85
  posts: ODPostManager;
79
- /**The manager responsible for everything related to the client. (e.g. status, login, slash & text commands, etc) */
86
+ /**A wrapper around the `discord.Client` class. It handles client login, activity and registering text/slash commands. */
80
87
  client: ODClientManager;
81
- /**Shared fuses between Open Discord bots. With these fuses/switches, you can turn off "default behaviours" from the bot. Useful for replacing default behaviour with a custom implementation. */
88
+ /**Shared fuses between Open Discord bots. Turn off "default behaviours" from the bot which is useful for replacing default behaviour with a custom implementation. */
82
89
  sharedFuses: ODSharedFuseManager;
83
- /**This manager manages all the variables in the ENV. It reads from both the `.env` file & the `process.env`. (these 2 will be combined) */
90
+ /**A manager which collects variables from the Process ENV and `.env` file. */
84
91
  env: ODEnvHelper;
85
- /**The manager responsible for the livestatus system. (remote console logs) */
92
+ /**LiveStatus is a protocol which displays live updates from DJdj Development in the startscreen of the bot. (e.g. new version available) */
86
93
  livestatus: ODLiveStatusManager;
87
- /**The manager responsible for the livestatus system. (remote console logs) */
94
+ /**The manager responsible for rendering the startscreen of the bot. */
88
95
  startscreen: ODStartScreenManager;
89
96
  }
90
97
  /**## ODMain `class`
@@ -93,7 +100,7 @@ export interface ODMainManagers {
93
100
  *
94
101
  * This class can't be overwritten or extended & is available as the global variable `opendiscord`!
95
102
  */
96
- export declare class ODMain implements ODMainManagers {
103
+ export declare abstract class ODMain implements ODMainManagers {
97
104
  readonly project: ODProjectType;
98
105
  readonly versions: ODVersionManager;
99
106
  readonly processStartupDate: Date;
@@ -111,6 +118,7 @@ export declare class ODMain implements ODMainManagers {
111
118
  readonly languages: ODLanguageManager;
112
119
  readonly checkers: ODCheckerManager;
113
120
  readonly builders: ODBuilderManager;
121
+ readonly components: ODComponentManager;
114
122
  readonly responders: ODResponderManager;
115
123
  readonly actions: ODActionManager;
116
124
  readonly verifybars: ODVerifyBarManager;
package/dist/api/main.js CHANGED
@@ -25,6 +25,7 @@ export class ODMain {
25
25
  languages;
26
26
  checkers;
27
27
  builders;
28
+ components;
28
29
  responders;
29
30
  actions;
30
31
  verifybars;
@@ -42,7 +43,7 @@ export class ODMain {
42
43
  constructor(managers, project) {
43
44
  this.project = project;
44
45
  this.versions = managers.versions;
45
- this.versions.add(ODVersion.fromString("opendiscord:api", "v0.2.17"));
46
+ this.versions.add(ODVersion.fromString("opendiscord:api", "v0.3.1"));
46
47
  this.versions.add(ODVersion.fromString("opendiscord:livestatus", "v2.0.0"));
47
48
  this.debugfile = managers.debugfile;
48
49
  this.console = managers.console;
@@ -57,6 +58,7 @@ export class ODMain {
57
58
  this.languages = managers.languages;
58
59
  this.checkers = managers.checkers;
59
60
  this.builders = managers.builders;
61
+ this.components = managers.components;
60
62
  this.client = managers.client;
61
63
  this.responders = managers.responders;
62
64
  this.actions = managers.actions;
@@ -8,12 +8,12 @@ import { ODDebugger } from "./console.js";
8
8
  *
9
9
  * This class can't be used stand-alone & needs to be extended from!
10
10
  */
11
- export declare class ODActionImplementation<Origin extends string, Params extends object, Result extends object, WorkerIds extends string = string> extends ODManagerData {
11
+ export declare abstract class ODActionImplementation<Origin extends string, Params extends object, Result extends object, WorkerIds extends string = string> extends ODManagerData {
12
12
  /**The manager that has all workers of this implementation */
13
13
  workers: ODWorkerManager<Partial<Result>, Origin, Params, WorkerIds>;
14
14
  constructor(id: ODValidId, callback?: ODWorkerCallback<Partial<Result>, Origin, Params>, priority?: number, callbackId?: ODValidId);
15
15
  /**Execute all workers & return the result. */
16
- run(origin: Origin, params: Params): Promise<Partial<Result>>;
16
+ abstract run(origin: Origin, params: Params): Promise<Partial<Result>>;
17
17
  }
18
18
  /**## ODActionManagerIdConstraint `type`
19
19
  * The constraint/layout for id mappings/interfaces of the `ODActionManager` class.
@@ -1,7 +1,7 @@
1
1
  ///////////////////////////////////////
2
2
  //ACTION MODULE
3
3
  ///////////////////////////////////////
4
- import { ODManager, ODSystemError, ODManagerData } from "./base.js";
4
+ import { ODManager, ODManagerData } from "./base.js";
5
5
  import { ODWorkerManager, ODWorker } from "./worker.js";
6
6
  /**## ODActionImplementation `class`
7
7
  * This is an Open Discord action implementation.
@@ -19,10 +19,6 @@ export class ODActionImplementation extends ODManagerData {
19
19
  if (callback)
20
20
  this.workers.add(new ODWorker(callbackId ? callbackId : id, priority ?? 0, callback));
21
21
  }
22
- /**Execute all workers & return the result. */
23
- async run(origin, params) {
24
- throw new ODSystemError("Tried to build an unimplemented ODResponderImplementation");
25
- }
26
22
  }
27
23
  /**## ODActionManager `class`
28
24
  * This is an Open Discord action manager.
@@ -52,11 +52,14 @@ export type ODNoGeneric<T extends Record<string | number | symbol, any>> = {
52
52
  * You can use this class to assign a unique id when creating configs, databases, languages & more!
53
53
  */
54
54
  export declare class ODId {
55
- #private;
55
+ /**The raw value of this `ODId` as a `string`. */
56
+ private rawValue;
57
+ /**The change listener for the parent `ODManager` of this `ODId`. */
58
+ private changeListener;
59
+ constructor(id: ODValidId);
56
60
  /**The full value of this `ODId` as a `string`. */
57
61
  set value(id: string);
58
62
  get value(): string;
59
- constructor(id: ODValidId);
60
63
  /**Returns a string representation of this id. (same as `this.value`) */
61
64
  toString(): string;
62
65
  /**The namespace of the id before `:`. (e.g. `opendiscord` for `opendiscord:autoclose-enabled`) */
@@ -74,8 +77,8 @@ export declare class ODId {
74
77
  * It is used to let the "onChange" event in the `ODManager` class work.
75
78
  * You can use this class when extending your own `ODManager`
76
79
  */
77
- export declare class ODManagerChangeHelper {
78
- #private;
80
+ export declare abstract class ODManagerChangeHelper {
81
+ private changeListener;
79
82
  /**Trigger an `onChange()` event in the parent `ODManager` of this class. */
80
83
  protected _change(): void;
81
84
  /****(❌ SYSTEM ONLY!!)** Set the callback executed when a value inside this class changes. */
@@ -88,7 +91,7 @@ export declare class ODManagerChangeHelper {
88
91
  *
89
92
  * There is an `id:ODId` property & also some events used in the manager.
90
93
  */
91
- export declare class ODManagerData extends ODManagerChangeHelper {
94
+ export declare abstract class ODManagerData extends ODManagerChangeHelper {
92
95
  /**The id of this data. */
93
96
  id: ODId;
94
97
  constructor(id: ODValidId);
@@ -111,7 +114,18 @@ export type ODManagerAddCallback<DataType extends ODManagerData> = (data: DataTy
111
114
  * This class has many useful functions based on `ODId` (add, get, remove, getAll, getFiltered, exists, loopAll, ...)
112
115
  */
113
116
  export declare class ODManager<DataType extends ODManagerData> extends ODManagerChangeHelper {
114
- #private;
117
+ /**Alias to Open Discord debugger. */
118
+ protected debug?: ODDebugger;
119
+ /**The message to send when debugging this manager. */
120
+ protected debugname?: string;
121
+ /**The map storing all data classes in this manager. */
122
+ private data;
123
+ /**An array storing all listeners when data is added. */
124
+ private addListeners;
125
+ /**An array storing all listeners when data has changed. */
126
+ private changeListeners;
127
+ /**An array storing all listeners when data is removed. */
128
+ private removeListeners;
115
129
  constructor(debug?: ODDebugger, debugname?: string);
116
130
  /**Add data to the manager. The `ODId` in the data class will be used as identifier! You can optionally select to overwrite existing data!*/
117
131
  add(data: DataType | DataType[], overwrite?: boolean): boolean;
@@ -149,8 +163,9 @@ export declare class ODManager<DataType extends ODManagerData> extends ODManager
149
163
  * The `getSafe()` function will always return data, because when it doesn't find an id, it returns pre-configured backup data.
150
164
  */
151
165
  export declare class ODManagerWithSafety<DataType extends ODManagerData> extends ODManager<DataType> {
152
- #private;
153
- constructor(backupCreator: () => DataType, debug?: ODDebugger, debugname?: string);
166
+ /**The function that creates backup data returned in `getSafe()` when an id is missing in this manager. */
167
+ protected backupGenerator: () => DataType;
168
+ constructor(backupGenerator: () => DataType, debug?: ODDebugger, debugname?: string);
154
169
  /**Get data that matches the `ODId`. Returns the backup data when not found.
155
170
  *
156
171
  * ### ⚠️ This should only be used when the data doesn't need to be written/edited
@@ -234,10 +249,13 @@ export declare class ODVersion extends ODManagerData {
234
249
  * It shouldn't be used by plugins because this is an internal API feature!
235
250
  */
236
251
  export declare class ODVersionMigration {
237
- #private;
238
252
  /**The version to migrate data to */
239
253
  version: ODVersion;
240
- constructor(version: ODVersion, func: () => void | Promise<void>, afterInitFunc: () => void | Promise<void>);
254
+ /**The migration function */
255
+ private migrateFunc;
256
+ /**The migration function */
257
+ private migrateAfterInitFunc;
258
+ constructor(version: ODVersion, migrateFunc: () => void | Promise<void>, migrateAfterInitFunc: () => void | Promise<void>);
241
259
  /**Run this version migration as a plugin. Returns `false` when something goes wrong. */
242
260
  migrate(): Promise<boolean>;
243
261
  /**Run this version migration as a plugin (after other plugins have loaded). Returns `false` when something goes wrong. */
@@ -309,7 +327,6 @@ export declare class ODHTTPPostRequest {
309
327
  * const variableA = envHelper.getVariable("value-c","env") //only get from process.env
310
328
  */
311
329
  export declare class ODEnvHelper {
312
- #private;
313
330
  /**All variables found in the `.env` file */
314
331
  dotenv: Record<string, any>;
315
332
  /**All variables found in `process.env` */
@@ -317,6 +334,7 @@ export declare class ODEnvHelper {
317
334
  constructor(customEnvPath?: string);
318
335
  /**Get a variable from the env */
319
336
  getVariable(name: string, source?: "dotenv" | "env"): any | undefined;
337
+ protected readDotEnv(src: Buffer): Record<string, any>;
320
338
  }
321
339
  /**## ODSystemError `class`
322
340
  * A wrapper for the node.js `Error` class that makes the error look better in the console!