mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-18 07:35:02 +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
|
@ -4,21 +4,24 @@ import { GuildPingableRoles } from "../data/GuildPingableRoles";
|
|||
import { PingableRole } from "../data/entities/PingableRole";
|
||||
import { errorMessage, successMessage } from "../utils";
|
||||
import { ZeppelinPlugin } from "./ZeppelinPlugin";
|
||||
import * as t from "io-ts";
|
||||
|
||||
const ConfigSchema = t.type({
|
||||
can_manage: t.boolean,
|
||||
});
|
||||
type TConfigSchema = t.TypeOf<typeof ConfigSchema>;
|
||||
|
||||
const TIMEOUT = 10 * 1000;
|
||||
|
||||
interface IPingableRolesPluginConfig {
|
||||
can_manage: boolean;
|
||||
}
|
||||
|
||||
export class PingableRolesPlugin extends ZeppelinPlugin<IPingableRolesPluginConfig> {
|
||||
export class PingableRolesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||
public static pluginName = "pingable_roles";
|
||||
protected static configSchema = ConfigSchema;
|
||||
|
||||
protected pingableRoles: GuildPingableRoles;
|
||||
protected cache: Map<string, PingableRole[]>;
|
||||
protected timeouts: Map<string, any>;
|
||||
|
||||
getDefaultOptions(): IPluginOptions<IPingableRolesPluginConfig> {
|
||||
getDefaultOptions(): IPluginOptions<TConfigSchema> {
|
||||
return {
|
||||
config: {
|
||||
can_manage: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue