3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-18 15:45:03 +00:00

Add io-ts config schemas to all guild plugins

This commit is contained in:
Dragory 2019-07-21 21:15:52 +03:00
parent 21402b2ea4
commit 039f0452fb
23 changed files with 373 additions and 294 deletions

View file

@ -12,16 +12,19 @@ import {
sorter,
successMessage,
} from "../utils";
import * as t from "io-ts";
const ConfigSchema = t.type({
can_use: t.boolean,
});
type TConfigSchema = t.TypeOf<typeof ConfigSchema>;
const REMINDER_LOOP_TIME = 10 * 1000;
const MAX_TRIES = 3;
interface IRemindersPluginConfig {
can_use: boolean;
}
export class RemindersPlugin extends ZeppelinPlugin<IRemindersPluginConfig> {
export class RemindersPlugin extends ZeppelinPlugin<TConfigSchema> {
public static pluginName = "reminders";
protected static configSchema = ConfigSchema;
protected reminders: GuildReminders;
protected tries: Map<number, number>;
@ -29,7 +32,7 @@ export class RemindersPlugin extends ZeppelinPlugin<IRemindersPluginConfig> {
private postRemindersTimeout;
private unloaded = false;
getDefaultOptions(): IPluginOptions<IRemindersPluginConfig> {
getDefaultOptions(): IPluginOptions<TConfigSchema> {
return {
config: {
can_use: false,