fix horrors
This commit is contained in:
parent
8299c02ed4
commit
2f8fbbb03e
1 changed files with 16 additions and 9 deletions
25
index.tsx
25
index.tsx
|
@ -14,6 +14,13 @@ import { Message } from "discord-types/general";
|
|||
|
||||
let userFlags = new Map<string, Flag>();
|
||||
|
||||
enum FlagType {
|
||||
DANGER = "danger",
|
||||
WARNING = "warning",
|
||||
INFO = "info",
|
||||
POSITIVE = "positive"
|
||||
}
|
||||
|
||||
type FlagRegistryEntry = {
|
||||
label: string;
|
||||
color: string;
|
||||
|
@ -21,32 +28,32 @@ type FlagRegistryEntry = {
|
|||
};
|
||||
|
||||
// worst typing ever?
|
||||
const flagRegistry = {
|
||||
danger: {
|
||||
const flagRegistry: { [key in FlagType]: FlagRegistryEntry } = {
|
||||
[FlagType.DANGER]: {
|
||||
label: "Danger",
|
||||
color: "#ff7473",
|
||||
emoji: "🛑"
|
||||
} as FlagRegistryEntry,
|
||||
warning: {
|
||||
[FlagType.WARNING]: {
|
||||
label: "Warning",
|
||||
color: "#ffb02e",
|
||||
emoji: "⚠️"
|
||||
} as FlagRegistryEntry,
|
||||
info: {
|
||||
[FlagType.INFO]: {
|
||||
label: "Info",
|
||||
color: "#62a8ff",
|
||||
emoji: "🔵"
|
||||
} as FlagRegistryEntry,
|
||||
positive: {
|
||||
[FlagType.POSITIVE]: {
|
||||
label: "Positive",
|
||||
color: "#62ff74",
|
||||
emoji: "✅"
|
||||
} as FlagRegistryEntry
|
||||
} as const;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
type Flag = {
|
||||
type: keyof typeof flagRegistry;
|
||||
type: FlagType;
|
||||
text: string;
|
||||
};
|
||||
|
||||
|
@ -117,7 +124,7 @@ export default definePlugin({
|
|||
],
|
||||
execute: async (args: Argument[], ctx: CommandContext) => {
|
||||
const user = findOption(args, "user", "");
|
||||
const type: Flag["type"] = findOption(args, "type", "info");
|
||||
const type = findOption<FlagType>(args, "type", FlagType.INFO);
|
||||
const text = findOption(args, "message", "");
|
||||
userFlags.set(user, {
|
||||
type,
|
||||
|
|
Loading…
Reference in a new issue