Skip to content

Uncover-it/id-lookup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord User/Guild Lookup

This is a Next.js project bootstrapped with create-next-app.

Get started

First, clone the repository:

git clone https://github.com/WarFiN123/id-lookup && cd id-lookup

Then, install all dependencies:

pnpm install

Create a .env.local file in the root directory with the value:

BOT_TOKEN=<BOT_TOKEN_HERE>

Finally, run the development environment by running:

pnpm run dev

Self-Hosting

Vercel (Recommended)

Step 1

Visit https://vercel.com/new/git/third-party, paste in https://github.com/WarFiN123/id-lookup/ and press Continue image

Step 2

Add your BOT_TOKEN as an environmental variable and hit Deploy image

Recommended settings

Go to the Firewall tab and enable Bot Protection image You can even set a custom domain

Cloudflare Pages (More complex)

Step 1: Fork this repo.

Step 2: Run pnpm uninstall botid

Step 3: Delete /src/instrumentation-client.ts

Step 4: Edit next.config.ts

Replace all the contents of next.config.ts with this:

import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  images: {
    remotePatterns: [
      {
        hostname: "cdn.discordapp.com",
      },
    ],
  },
};

export default nextConfig;

Step 5: Edit src/app/api/user/route.ts and src/app/api/guild/route.ts

  1. Delete the import { checkBotId } from "botid/server"; import on top of the page and delete
  const verification = await checkBotId();
  if (verification.isBot) {
    return NextResponse.json({ error: "Access denied" }, { status: 403 });
  }
  1. Define edge runtime below the imports
import { NextRequest, NextResponse } from "next/server";

const runtime = "edge"; // cloudflare pages only supports edge runtime for dynamic routes

Step 6: Head over to https://dash.cloudflare.com and the Workers & Pages tab under Compute (Workers)

image

Step 7: Create a new page

image

Step 8: Choose your GitHub/GitLab repo with the modified code above

image

Step 9: Select Next.js as your framework and declare environmental variables

image

Step 10: Add the nodejs_compat Compatibility flag under the pages settings

image

Similar Projects

About

Discord ID Lookup

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •