From d638dc7a0caf486b4142bac3bcb627cb9e984aae Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 4 Dec 2025 23:08:43 +0100 Subject: [PATCH] feat: Discord id verification --- app/verify/page.tsx | 174 ++++++++++++++++++++++++++++++++++++++++++ components/Navbar.tsx | 12 +++ data/verify-data.ts | 43 +++++++++++ 3 files changed, 229 insertions(+) create mode 100644 app/verify/page.tsx create mode 100644 data/verify-data.ts diff --git a/app/verify/page.tsx b/app/verify/page.tsx new file mode 100644 index 0000000..ad47474 --- /dev/null +++ b/app/verify/page.tsx @@ -0,0 +1,174 @@ +"use client"; + +import { + useState, + ChangeEvent, + FormEvent, + MouseEvent, +} from "react"; +import { verifyPeople } from "@/data/verify-data"; + +export default function VerifyPage() { + const [inputValue, setInputValue] = useState(""); + const [result, setResult] = useState(null); + const [status, setStatus] = useState(null); + const [showHowModal, setShowHowModal] = useState(false); + + type StatusType = "success" | "error" | "warning" | null; + + + const handleChange = (e: ChangeEvent) => { + setInputValue(e.target.value); + setResult(null); + }; + + const handleSubmit = (e: FormEvent) => { + e.preventDefault(); + const trimmed = inputValue.trim(); + + if (!trimmed) { + setResult("Please enter a Discord user ID."); + setStatus("warning"); + return; + } + + const person = verifyPeople.find((p) => p.ids.includes(trimmed)); + + if (person) { + setResult(`This Discord ID belongs to ${person.name}.`); + setStatus("success"); + } else { + setResult( + "Unknown ID. If this is an impersonator, please report this in the Discord server!" + ); + setStatus("error"); + } + }; + + const statusColor = + status === "success" + ? "text-emerald-400" + : status === "warning" + ? "text-amber-300" + : status === "error" + ? "text-red-400" + : ""; + + const openModal = (e: MouseEvent) => { + e.preventDefault(); + setShowHowModal(true); + }; + + const closeModal = () => setShowHowModal(false); + + return ( +
+
+
+

+ Cobalt +

+

Discord ID Verification

+
+ +
+
+
+ + +
+ + +
+ +
+ + + {result !== null && ( +

+ {result} +

+ )} +
+
+ +

+ Always use common sense. +

+

+ Only use Discord IDs you obtain by yourself. +

+ + {showHowModal && ( +
+
e.stopPropagation()} + > +
+

+ Getting a Discord user ID +

+ +
+ +
+
    +
  1. + Open Discord settings > Advanced and enable + Developer Mode. +
  2. +
  3. + Right‑click the user's name or avatar (or long‑press on + mobile) and choose + Copy User ID. +
  4. +
  5. + Paste that numeric ID here to verify you are talking to the + correct account. +
  6. +
+
+
+
+ )} +
+
+ ); +} diff --git a/components/Navbar.tsx b/components/Navbar.tsx index cc0715a..b4bebcf 100644 --- a/components/Navbar.tsx +++ b/components/Navbar.tsx @@ -38,6 +38,12 @@ export default function Navbar() { > About + + Verify + @@ -89,6 +95,12 @@ export default function Navbar() { > About + + Verify +
diff --git a/data/verify-data.ts b/data/verify-data.ts new file mode 100644 index 0000000..cc2c317 --- /dev/null +++ b/data/verify-data.ts @@ -0,0 +1,43 @@ +export type VerifyPerson = { + name: string; + ids: string[]; +}; + +export const verifyPeople: VerifyPerson[] = [ + { + name: "quiteboring", + ids: ["1441859003708866601", "1367543367277219840"] + }, + { + name: "Twiston", + ids: ["855798460593733652"] + }, + { + name: "oblongboot", + ids: ["768481984242253904"] + }, + { + name: "EpsilonPhoenix", + ids: ["899647076370092042"] + }, + { + name: "Duck", + ids: ["578318043143340042"] + }, + { + name: "Hidrate", + ids: ["923188049314189343"] + }, + { + name: "Osama", + ids: ["1198974310040211528"] + }, + { + name: "pyro", + ids: ["1382022366040686763", "753636591544565832"] + }, + { + name: "the Cobalt discord bot", + ids: ["1441864552936636519"] + } +];