Coder Social home page Coder Social logo

pinkdiamond1 / world-id-discord-bot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from worldcoin/world-id-discord

0.0 1.0 0.0 2.32 MB

Improve your Discord server by verifying unique people with World ID.

Home Page: https://worldidbot.com

License: MIT License

Shell 0.07% JavaScript 3.67% TypeScript 94.01% CSS 1.25% HTML 0.99%

world-id-discord-bot's Introduction

World ID Discord Bot logo

World ID Discord Bot

This project is a demonstration of serverless Discord Bot that uses World ID to verify humans. Verified humans get a special role assigned which can then be used to manage special permissions.

Project is built using AWS CDK IaC and projen.

⚙️ Running frontend in development (landing & config page)

   npx projen
   cd src/landing-page
   npm run src/dev

🚀 Using the bot

Note We are working on publishing this bot on Discord so it can be installed in your own server with one-click. Coming soon! You can deploy your own version in the meantime.

🏆 Deploying your own bot

1. Create an action on Developer Portal

  1. Head over to Worldcoin's Developer Portal and create an action.
  2. You'll need to create an action that runs on Cloud. Select Production mode if you want to run it with actual human verification, otherwise use Staging to test with the simulator.

2. Bootstrap your Discord Bot App

  1. Go to Discord Developer Portal and create new application.
    • Take note of the application ID (e.g. 984381699360161823)
  2. Create a new Bot for the application and make sure your save the Bot Token!
    • Take note of the Bot public key (e.g. aa4f7f5e1affd2c054ca07a2733007d44775826c821f6c0ddc3d3826a54eeb1a)
  3. Go to the OAuth2 page and create a client secret.
    • Take note of the OAuth2 client secret (e.g. 4CqPc0000UwqP1234Wd7r81kUm6k3LA)

3. Deploy to AWS

  1. Make sure you have Node.js installed. Version 16.14.0 recommended (or above).

  2. Install project dependencies:

    npm install
    npx projen
  3. Ensure you have latest version of AWS CLI and configure your AWS CLI (we recommend you create a profile specific for your AWS account). If you create a named profile instead of using default, be sure to use that profile name in all aws or cdk commands below:

    brew update && brew upgrade awscli
    aws configure # or aws sso login (if applicable)
  4. If this is your first deployment using AWS CDK, you'll need to bootstrap it in your AWS account:

    cdk bootstrap
  5. Create relevant secrets.

    a) Create secret with name WorldIdDiscordBotToken and the bot token as the value:

    aws secretsmanager create-secret --name WorldIdDiscordBotToken --description "Bot token for World ID Discord Bot" --secret-string <your 60+ chars long bot token saved during bot creation> --profile default

    b) Create secret with name WorldIdDiscordBotClientSecret and the OAuth2 client secret as the value:

    aws secretsmanager create-secret --name WorldIdDiscordBotClientSecret --description "Client secret for World ID Discord Bot" --secret-string <your bot client secret> --profile default
  6. [Optional]. Set CDK Context values at project.ts (or set them below using the CLI command)

  7. Install project dependencies:

    npx projen
  8. Run CDK deployment (set the proper deployment values if you didn't set them in project.ts):

    npx cdk deploy
      --context bot_app_id=12345678 \
      --context bot_public_key=fdced6398cf4c6c96700069237df19ed393083f \
      --context roles_for_verified_user="Validated Human,World ID" \
      --context signal="<none>" \
      --context action_id="wid_XC36mm99KFeXh2p9P" \
      --profile=default
  9. Grab WorldID-Discord-Bot.discordbotapiEndpoint<some hash> output (it should be an url similar to https://3dhsrvte6f.execute-api.us-east-1.amazonaws.com/prod/) and save it into Interactions endpoint URL on your Bot settings at Discord Developers Portal.

    If you are seeing interactions_endpoint_url: The specified interactions endpoint url could not be verified error during this step then make sure that you provided proper bot_app_id and bot_public_key CDK context values (carefully review steps above).

  10. Grab OAuth2CallbackUrl output (similar to https://2rrg16x6qh.execute-api.us-east-1.amazonaws.com/prod/oauth2callback) and save it into Redirects field on the bot OAuth2 General settings.

  11. Head over to the URL Generator tab of OAuth2 and create a link with the following scopes:

    • Scopes: guilds, bot, applications.commands
    • Redirect URL: Select the URL you added in the previous step.
    • Bot permissions: Manage Roles, Send Messages, Embed Links, Attach Files.
  12. Visit the generated URL to install the bot in your server.

About World ID

World ID is a protocol that lets you prove a human is doing an action only once without revealing any personal data. Stop bots, stop abuse.

World ID uses a device called the Orb which takes a picture of a person's iris to verify they are a unique and alive human. The protocol uses Zero-knowledge proofs so no traceable information is ever public.

World ID is meant for on-chain web3 apps, traditional cloud applications, and even IRL verifications.

Diagram of how World ID works.

Getting started with World ID

Regardless of how you landed here, the easiest way to get started with World ID is through the the Dev Portal.

Get started

World ID Demos

Want to see World ID in action? We have a bunch of Examples.

Click here to see examples

📄 Documentation

We have comprehensive docs for World ID at https://id.worldcoin.org/docs.

Visit documentation

🗣 Feedback

World ID is in Beta, help us improve! Please share feedback on your experience. You can find us on Discord, look for the #world-id channel. You can also open an issue or a PR directly on this repo.

Join Discord

world-id-discord-bot's People

Contributors

denis-bushaev avatar igorosip0v avatar paolodamico avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.