1 files changed, 26 insertions, 9 deletions
diff --git a/src/util/plugin/Plugin.ts b/src/util/plugin/Plugin.ts
index 1c86a006..0fb1732f 100644
--- a/src/util/plugin/Plugin.ts
+++ b/src/util/plugin/Plugin.ts
@@ -1,5 +1,5 @@
import EventEmitter from "events";
-import { TypedEventEmitter } from "@fosscord/util";
+import { PluginLoadedEventArgs, TypedEventEmitter } from "@fosscord/util";
type PluginEvents = {
error: (error: Error | unknown) => void;
@@ -7,14 +7,31 @@ type PluginEvents = {
};
//this doesnt work, check later:
- //(EventEmitter as new () => TypedEventEmitter<PluginEvents>) {
-export class Plugin extends EventEmitter {
- private _untypedOn = this.on
- private _untypedEmit = this.emit
- public on = <K extends keyof PluginEvents>(event: K, listener: PluginEvents[K]): this => this._untypedOn(event, listener)
- public emit = <K extends keyof PluginEvents>(event: K, ...args: Parameters<PluginEvents[K]>): boolean => this._untypedEmit(event, ...args)
-
- async init() {
+ //EventEmitter as new () => TypedEventEmitter<PluginEvents>
+export class Plugin {
+ /**
+ * Path the plugin resides in.
+ *
+ * @type {string}
+ * @memberof Plugin
+ */
+ pluginPath: string;
+ /**
+ *
+ *
+ * @memberof Plugin
+ */
+ async initConfig() {
// insert default config into database?
+ console.log("did you forget to implement initConfig?");
+ }
+ /**
+ *
+ *
+ * @param {PluginLoadedEventArgs} args Info about plugin environment
+ * @memberof Plugin
+ */
+ onPluginLoaded?(args?: PluginLoadedEventArgs) {
+
}
}
|