mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-19 08:05:01 +00:00
Add io-ts config schemas to all guild plugins
This commit is contained in:
parent
21402b2ea4
commit
039f0452fb
23 changed files with 373 additions and 294 deletions
|
@ -5,19 +5,22 @@ import { renderTemplate } from "../templateFormatter";
|
|||
import { createChunkedMessage, stripObjectToScalars } from "../utils";
|
||||
import { LogType } from "../data/LogType";
|
||||
import { GuildLogs } from "../data/GuildLogs";
|
||||
import * as t from "io-ts";
|
||||
|
||||
interface IWelcomeMessageConfig {
|
||||
send_dm: boolean;
|
||||
send_to_channel: string;
|
||||
message: string;
|
||||
}
|
||||
const ConfigSchema = t.type({
|
||||
send_dm: t.boolean,
|
||||
send_to_channel: t.string,
|
||||
message: t.string,
|
||||
});
|
||||
type TConfigSchema = t.TypeOf<typeof ConfigSchema>;
|
||||
|
||||
export class WelcomeMessagePlugin extends ZeppelinPlugin<IWelcomeMessageConfig> {
|
||||
export class WelcomeMessagePlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||
public static pluginName = "welcome_message";
|
||||
protected static configSchema = ConfigSchema;
|
||||
|
||||
protected logs: GuildLogs;
|
||||
|
||||
protected getDefaultOptions(): IPluginOptions<IWelcomeMessageConfig> {
|
||||
protected getDefaultOptions(): IPluginOptions<TConfigSchema> {
|
||||
return {
|
||||
config: {
|
||||
send_dm: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue