feat: flag component

This commit is contained in:
nin0dev 2024-10-12 12:57:36 -04:00
parent 67314116c6
commit 059301dcab
Signed by: nin0
GPG key ID: 3FA8F96ABAE04214

View file

@ -17,11 +17,14 @@ type Flag = {
text: string; text: string;
}; };
function Flag({ message }: { message: Message; }) { function Flag({ id }: { id: string; }) {
if (message.author.id === "886685857560539176") return ( return (
<div> <div>
<Text color="text-danger" variant="text-sm/semibold"> <Text
🛑 This link is explosive variant="text-md/semibold"
style={{ color: flags.get(id)?.type === "danger" ? "#f8312f" : flags.get(id)?.type === "warning" ? "#ffb02e" : flags.get(id)?.type === "info" ? "#62A8FF" : "#62FF74" }}
>
{flags.get(id)?.type === "danger" ? "🛑" : flags.get(id)?.type === "warning" ? "⚠️" : flags.get(id)?.type === "info" ? "🔵" : "✅"} {flags.get(id)?.text}
</Text> </Text>
</div> </div>
); );
@ -34,9 +37,10 @@ export default definePlugin({
dependencies: ["MessageAccessoriesAPI"], dependencies: ["MessageAccessoriesAPI"],
start() { start() {
addAccessory("flag", (props: Record<string, any>) => { addAccessory("flag", (props: Record<string, any>) => {
return ( if (flags.has((props.message as Message).author.id)) {
<Flag message={props.message as Message} /> return <Flag id={props.message.author.id} />;
); }
return null;
}, 4); }, 4);
}, },
commands: [ commands: [