mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-12 21:05:02 +00:00
Add support for server-specific timezone and date format settings
This commit is contained in:
parent
ddbbc543c2
commit
c67a1df11d
51 changed files with 326 additions and 168 deletions
|
@ -1,16 +1,47 @@
|
|||
import { BaseConfig, Knub } from "knub";
|
||||
import * as t from "io-ts";
|
||||
|
||||
export interface IZeppelinGuildConfig extends BaseConfig<any> {
|
||||
export const DateFormatsSchema = t.type({
|
||||
date: t.string,
|
||||
time: t.string,
|
||||
pretty_datetime: t.string,
|
||||
});
|
||||
|
||||
export type DateFormats = t.TypeOf<typeof DateFormatsSchema>;
|
||||
|
||||
export interface ZeppelinGuildConfig extends BaseConfig<any> {
|
||||
success_emoji?: string;
|
||||
error_emoji?: string;
|
||||
timezone?: string;
|
||||
date_formats?: Partial<DateFormats>;
|
||||
}
|
||||
|
||||
export interface IZeppelinGlobalConfig extends BaseConfig<any> {
|
||||
export const ZeppelinGuildConfigSchema = t.type({
|
||||
// From BaseConfig
|
||||
prefix: t.string,
|
||||
levels: t.record(t.string, t.number),
|
||||
plugins: t.record(t.string, t.unknown),
|
||||
|
||||
// From ZeppelinGuildConfig
|
||||
success_emoji: t.string,
|
||||
error_emoji: t.string,
|
||||
timezone: t.string,
|
||||
date_formats: t.partial(DateFormatsSchema.props),
|
||||
});
|
||||
export const PartialZeppelinGuildConfigSchema = t.partial(ZeppelinGuildConfigSchema.props);
|
||||
|
||||
export interface ZeppelinGlobalConfig extends BaseConfig<any> {
|
||||
url: string;
|
||||
owners?: string[];
|
||||
}
|
||||
|
||||
export type TZeppelinKnub = Knub<IZeppelinGuildConfig, IZeppelinGlobalConfig>;
|
||||
export const ZeppelinGlobalConfigSchema = t.type({
|
||||
url: t.string,
|
||||
owners: t.array(t.string),
|
||||
plugins: t.record(t.string, t.unknown),
|
||||
});
|
||||
|
||||
export type TZeppelinKnub = Knub<ZeppelinGuildConfig, ZeppelinGlobalConfig>;
|
||||
|
||||
/**
|
||||
* Wrapper for the string type that indicates the text will be parsed as Markdown later
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue