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
|
@ -3,17 +3,20 @@ import { GuildChannel, Message, TextChannel } from "eris";
|
|||
import { GuildSavedMessages } from "../data/GuildSavedMessages";
|
||||
import { successMessage } from "../utils";
|
||||
import { ZeppelinPlugin } from "./ZeppelinPlugin";
|
||||
import * as t from "io-ts";
|
||||
|
||||
interface IMessageSaverPluginConfig {
|
||||
can_manage: boolean;
|
||||
}
|
||||
const ConfigSchema = t.type({
|
||||
can_manage: t.boolean,
|
||||
});
|
||||
type TConfigSchema = t.TypeOf<typeof ConfigSchema>;
|
||||
|
||||
export class MessageSaverPlugin extends ZeppelinPlugin<IMessageSaverPluginConfig> {
|
||||
export class MessageSaverPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||
public static pluginName = "message_saver";
|
||||
protected static configSchema = ConfigSchema;
|
||||
|
||||
protected savedMessages: GuildSavedMessages;
|
||||
|
||||
getDefaultOptions(): IPluginOptions<IMessageSaverPluginConfig> {
|
||||
getDefaultOptions(): IPluginOptions<TConfigSchema> {
|
||||
return {
|
||||
config: {
|
||||
can_manage: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue