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>();
|
let userFlags = new Map<string, Flag>();
|
||||||
|
|
||||||
|
enum FlagType {
|
||||||
|
DANGER = "danger",
|
||||||
|
WARNING = "warning",
|
||||||
|
INFO = "info",
|
||||||
|
POSITIVE = "positive"
|
||||||
|
}
|
||||||
|
|
||||||
type FlagRegistryEntry = {
|
type FlagRegistryEntry = {
|
||||||
label: string;
|
label: string;
|
||||||
color: string;
|
color: string;
|
||||||
|
@ -21,32 +28,32 @@ type FlagRegistryEntry = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// worst typing ever?
|
// worst typing ever?
|
||||||
const flagRegistry = {
|
const flagRegistry: { [key in FlagType]: FlagRegistryEntry } = {
|
||||||
danger: {
|
[FlagType.DANGER]: {
|
||||||
label: "Danger",
|
label: "Danger",
|
||||||
color: "#ff7473",
|
color: "#ff7473",
|
||||||
emoji: "🛑"
|
emoji: "🛑"
|
||||||
} as FlagRegistryEntry,
|
} as FlagRegistryEntry,
|
||||||
warning: {
|
[FlagType.WARNING]: {
|
||||||
label: "Warning",
|
label: "Warning",
|
||||||
color: "#ffb02e",
|
color: "#ffb02e",
|
||||||
emoji: "⚠️"
|
emoji: "⚠️"
|
||||||
} as FlagRegistryEntry,
|
} as FlagRegistryEntry,
|
||||||
info: {
|
[FlagType.INFO]: {
|
||||||
label: "Info",
|
label: "Info",
|
||||||
color: "#62a8ff",
|
color: "#62a8ff",
|
||||||
emoji: "🔵"
|
emoji: "🔵"
|
||||||
} as FlagRegistryEntry,
|
} as FlagRegistryEntry,
|
||||||
positive: {
|
[FlagType.POSITIVE]: {
|
||||||
label: "Positive",
|
label: "Positive",
|
||||||
color: "#62ff74",
|
color: "#62ff74",
|
||||||
emoji: "✅"
|
emoji: "✅"
|
||||||
} as FlagRegistryEntry
|
}
|
||||||
} as const;
|
};
|
||||||
|
|
||||||
|
|
||||||
type Flag = {
|
type Flag = {
|
||||||
type: keyof typeof flagRegistry;
|
type: FlagType;
|
||||||
text: string;
|
text: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -117,7 +124,7 @@ export default definePlugin({
|
||||||
],
|
],
|
||||||
execute: async (args: Argument[], ctx: CommandContext) => {
|
execute: async (args: Argument[], ctx: CommandContext) => {
|
||||||
const user = findOption(args, "user", "");
|
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", "");
|
const text = findOption(args, "message", "");
|
||||||
userFlags.set(user, {
|
userFlags.set(user, {
|
||||||
type,
|
type,
|
||||||
|
|
Loading…
Reference in a new issue