-
-
Save StephanBijzitter/6cee238bf73042ca37666ed2b5384df1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export abstract class StephanPlugin<O, D> { | |
/** | |
* Called right after Stephan loads the plugin file. | |
* | |
* Avoid performing any heavy actions here, as that will present | |
* significant performance implications for Stephan's startup time! | |
* | |
* @example | |
*```typescript | |
* type Options = { | |
* verbose?: boolean; | |
* token?: string; | |
* } | |
* | |
* export const defaultOptions = { | |
* verbose: false | |
* }; | |
* | |
* class StephanPluginExample extends Plugin<Options, typeof defaultOptions> { | |
* | |
* public constructor(args) { | |
* super(args, myDefaultOptions); | |
* } | |
* } | |
* ``` | |
* | |
* Note that your Options type should only have optional properties for your own | |
* convenience, as Stephan will provide an empty object in case the user did | |
* not specify their own options! | |
* | |
* @param args Arguments compiled and provided by StephanClient. | |
* @param args.options The options as provided by the user, or an empty object if not provided. | |
* @param defaultOptions The default options as provided by the plugin, or an empty object. | |
*/ | |
public constructor({options, client}: { | |
options: O; | |
client: unknown; | |
}, defaultOptions: D) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment