3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-11 04:45:02 +00:00

Add case icons. Clean up !cases. Allow customizing case colors and icons.

This commit is contained in:
Dragory 2020-08-11 04:16:06 +03:00
parent ad24d166ce
commit 131a79ffd4
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
24 changed files with 138 additions and 22 deletions

View file

@ -37,6 +37,7 @@ import { either } from "fp-ts/lib/Either";
import moment from "moment-timezone";
import { SimpleCache } from "./SimpleCache";
import { logger } from "./logger";
import { unsafeCoerce } from "fp-ts/lib/function";
const fsp = fs.promises;
@ -152,6 +153,29 @@ function tDeepPartialProp(prop: any) {
// https://stackoverflow.com/a/49262929/316944
export type Not<T, E> = T & Exclude<T, E>;
// io-ts partial dictionary type
// From https://github.com/gcanti/io-ts/issues/429#issuecomment-655394345
export interface PartialDictionaryC<D extends t.Mixed, C extends t.Mixed>
extends t.DictionaryType<
D,
C,
{
[K in t.TypeOf<D>]?: t.TypeOf<C>;
},
{
[K in t.OutputOf<D>]?: t.OutputOf<C>;
},
unknown
> {}
export const tPartialDictionary = <D extends t.Mixed, C extends t.Mixed>(
domain: D,
codomain: C,
name?: string,
): PartialDictionaryC<D, C> => {
return unsafeCoerce(t.record(t.union([domain, t.undefined]), codomain, name));
};
/**
* Mirrors EmbedOptions from Eris
*/