Giter VIP home page Giter VIP logo

discord-nft-verifier-client's Introduction

Discord NFT Verifier - Client

   

Source code


Overview

This bot provides NFT verification function. When the user is verified by the front-end, the user will get the corresponding role(s) set by the developer. The bot will be automatically verified once in a while. The relevant settings can be operated by the developer through local or cloud database, and this bot uses MongoDB - Atlas.

※This bot does not work across multiple Discord Guild, but this part can be easily added by adding the guild id field of the role collection and modifying the related code.


Architecture & Technology

Product Architecture and Related Technologies

- Client

Using: React + Tailwindcss

  • The user is redirected to the front-end verification page of the service via the discord verification link, and once the wallet is linked, information is sent to the back-end waiting for the verification result. After receiving the result, the result will be displayed to the user.

model


- Server

Using: Express + MongoDB Atlas + DiscordJS

  • After receiving user information from the front-end (discord-related and wallet address), *calls Moralis API to confirm whether the user's wallet contains the token contract set by the developer, and decides whether to give the user role(s) according to the aforementioned.
  • Verified user wallets are re-checked every cycle to determine whether to add or remove user role(s).
  • Developers can change the role settings by modifying the database data.
  • Provide Discord Slash Command(/reload) to load new role settings at any time.

Parallel requests - Use parallel requests for speed. The free API has a limit of 25 requests per second, so if you are using the free API, please keep the number of contracts to 25 or less, otherwise you will have to modify the code yourself and split it into multiple groups to verify in batches.

model


Setup

  1. Set the settings for the Discord bot. (※You must give this bot an role with higher privileges than the ones this bot can give, otherwise it will not work.)

- Add Discord verification API redirect page (your verification system home page)

Add redirects

- Select the URL of the verification page added above to generate a verification URL for users to use

Generate identy url

Note that the code string in the generated url must be replaced with token.

- Open the privileged gateway intents

Open privileged gateway intents

- Select the scopes and permissions to generate a bot invitation link and then invite the bot to your Guild

Select the bot scopes and permissions


  1. To set up the database, MongoDB - Atlas is used here.

- To configure role

Create a collection with the name role under the database you want to use for the connection, and insert a document in the following form.

{
  "tokenAddress": "0x0C5cEA99fEd27c98B505837A8E72cfDF70bcF8F0",
  "roles": [
    {
      "roleName": "Kaiju VIP", // Discord role name
      "roleId": "932197370173718578", // Discord role id
      "requiredAmount": {
        "$numberInt": "1"
      }
    },
    {
      "roleName": "Special Kaiju VIP",
      "roleId": "989098089216376832",
      "requiredAmount": {
        "$numberInt": "3"
      }
    }
  ]
}

When you want to add role(s) to an added contract, add json directly to the array in the following format.

{
  "roleName": "role name",
  "roleId": "discord role id",
  "requiredAmount": {
    "$numberInt": ">=0 number"
  }
}

After adding, remember to enter /reload in your Discord Guild to load the new settings, or restart the server.


  1. Create the client and server folders, then run git clone in each folder to copy the files from the repository, and then run the npm command. Finally, deploy the production environment through a reverse proxy server. You can also run npm start directly for testing purpose.

- Client folder

mkdir <projectfolderForClient> && cd <projectfolderForClient>
git clone https://github.com/0xmimiQ/Discord-NFT-Verifier-Client
npm install

Change the verifyApiUrl in ./src/App.js file with verifyApiUrl as your backend API Url.

const verifyApiUrl = "https://verify.0xmimiq.me";

Then run:

npm run build

- Server folder

mkdir <projectfolderForServer> && cd <projectfolderForServer>
git clone https://github.com/0xmimiQ/Discord-NFT-Verifier-Server
npm install

Change ./src/_configs.json to ./src/configs.json, and change the file parameters to your parameters:

{
  "clientURL": "", // It's your verify page url
  "serverPort": 11111,
  "mongoDBUri": "mongodb+srv://<UserName>:<Password>@cluster0.badrclk.mongodb.net/<DatabaseName>",
  "discord": {
    "ownerId": "",
    "token": "",
    "guildId": "", // The bot is going to run discord guild id
    "logChannelId": "", // A log channel id in the guild above
    "checkUserCycleTime": 1200000 // Check wallet cycle interval time in ms
  },
  "moralis": {
    // Apply api key in https://moralis.io/
    "apiKey": "",
    "logLevel": "info",
    "formatEvmChainId": "decimal",
    "formatEvmAddress": "checksum"
  }
}

- Set up reverse proxy server

Use a reverse proxy server such as Nginx to set up the relevant parameters to run.

See how to deploy your files to Nginx:


Demo

Verification page and updates in Discord


Reference

- Client

- Server


License

All artistic assets including but not limited to Logo, Banner, Background containing the following texts or related images are the property of Kaiju of Cronos, all rights reserved. Unauthorized use in its original form or reproduction is not allowed.

  • Kaiju of Cronos
  • クロノスの怪獣

For all other assets not restricted above, use Apache-2.0 License.

discord-nft-verifier-client's People

Contributors

mmqnym avatar

Stargazers

SCI avatar  avatar eldante avatar  avatar Tasos Meletlidis avatar Phạm Minh Đăng avatar  avatar CryptoLisboa avatar Molly Beach avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

discord-nft-verifier-client's Issues

README Unclear

The instructions for step-by-step on how to set this up for me are slightly unclear, for example, for Step 2 in the setup do I create a role.json file under database? Do I need to create a Moralis server and something with MongoDB? Another thing is what exactly would my verify API URL, client URL, and verification page URL all be? If possible could you update the README to be a bit more simple?

Apologies for the inconvenience.

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.