diff options
| author | Andrew Lee <andrew@alee14.me> | 2025-03-23 16:24:32 -0400 |
|---|---|---|
| committer | Andrew Lee <andrew@alee14.me> | 2025-03-23 16:24:32 -0400 |
| commit | a19b6ed4ef829697fd0be153af5e27c99f267787 (patch) | |
| tree | e0fbd044f2cdfb937d43ff26e6958aadf91ebde7 /web/src/app/components | |
| parent | d7c46a9eae28046bb26da182abc298dc18ed5a10 (diff) | |
| download | AleeBot-a19b6ed4ef829697fd0be153af5e27c99f267787.tar.gz AleeBot-a19b6ed4ef829697fd0be153af5e27c99f267787.tar.bz2 AleeBot-a19b6ed4ef829697fd0be153af5e27c99f267787.zip | |
Fundementials of the new dashboard
Diffstat (limited to 'web/src/app/components')
| -rw-r--r-- | web/src/app/components/Guilds.jsx | 25 | ||||
| -rw-r--r-- | web/src/app/components/sign-in.jsx | 2 |
2 files changed, 26 insertions, 1 deletions
diff --git a/web/src/app/components/Guilds.jsx b/web/src/app/components/Guilds.jsx new file mode 100644 index 0000000..50baa98 --- /dev/null +++ b/web/src/app/components/Guilds.jsx @@ -0,0 +1,25 @@ + +export default async function Guilds({session}) { + + const response = await fetch("https://discord.com/api/users/@me/guilds", { + headers: { + Authorization: `Bearer ${session.accessToken}`, + }, + }); + const guilds = await response.json(); + + const MANAGE_GUILD = 0x00000020; + + const filteredGuilds = guilds.filter((guild) => { + // Convert permissions string to a BigInt for bitwise operations + const permissions = BigInt(guild.permissions); + // Check if MANAGE_GUILD bit is set + return (permissions & BigInt(MANAGE_GUILD)) === BigInt(MANAGE_GUILD); + }); + + return filteredGuilds.map((guild) => ( + <div key={guild.id}> + <h2>{guild.name}</h2> + </div> + )) +} diff --git a/web/src/app/components/sign-in.jsx b/web/src/app/components/sign-in.jsx index bb891c7..3d7142f 100644 --- a/web/src/app/components/sign-in.jsx +++ b/web/src/app/components/sign-in.jsx @@ -8,7 +8,7 @@ export default function SignIn() { await signIn("discord") }} > - <button type="submit">Login with Discord</button> + <button type="submit" className="bg-discord-blurple p-3 rounded-md hover:bg-discord-blurple">Login with Discord</button> </form> ) } |
