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.
Product Architecture and Related Technologies
Using: React + Tailwindcss
Using: Express + MongoDB Atlas + DiscordJS
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.
- 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.)
Note that the code
string in the generated url must be replaced with token
.
- To set up the database, MongoDB - Atlas is used here.
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.
- 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 runnpm start
directly for testing purpose.
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
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"
}
}
Use a reverse proxy server such as Nginx to set up the relevant parameters to run.
See how to deploy your files to Nginx:
Verification page and updates in Discord
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.
For all other assets not restricted above, use Apache-2.0 License.