summary refs log tree commit diff
path: root/src/util/plugin/Plugin.ts
blob: 0fb1732f8c06b0b04c526135ff8e38e3e970c9eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import EventEmitter from "events";
import { PluginLoadedEventArgs, TypedEventEmitter } from "@fosscord/util";

type PluginEvents = {
	error: (error: Error | unknown) => void;
	loaded: () => void;
};

//this doesnt work, check later:
 //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) {
		
	}
}