Add io-ts config schemas to all guild plugins
This commit is contained in:
parent
2f3dfa96db
commit
74c78f51ce
23 changed files with 373 additions and 294 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue