summary refs log tree commit diff
path: root/src/util/plugin/Plugin.ts
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-13 12:22:26 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-09-04 10:48:54 +0200
commit6d17f44f9b16fb78abf8a5689b63c88550b9b1a8 (patch)
tree898248e60883dceac343c93e6b4348ce5d5394bd /src/util/plugin/Plugin.ts
parentGit workflow - partial list of Ubuntu dependencies (diff)
downloadserver-6d17f44f9b16fb78abf8a5689b63c88550b9b1a8.tar.xz
Plugins finally load!
Diffstat (limited to 'src/util/plugin/Plugin.ts')
-rw-r--r--src/util/plugin/Plugin.ts35
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) { + } }