feat: flag component
This commit is contained in:
parent
67314116c6
commit
059301dcab
1 changed files with 11 additions and 7 deletions
18
index.tsx
18
index.tsx
|
@ -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: [
|
||||||
|
|
Loading…
Reference in a new issue