How to build a Substrate Faucet with Discord Bot and Node.js

Get started by creating a new application

Navigate to the application page then click New Application

How to build a Substrate Faucet with Discord Bot and Node.js

Create a bot

Create a Bot by navigating to the “Bot” tab and clicking “Add Bot”.
How to build a Substrate Faucet with Discord Bot and Node.js

How to build a Substrate Faucet with Discord Bot and Node.js

Copy the token using the Copy button. For some reason you want to change the token, click the Regenerate button as soon as possible. This revokes your old token and re-generates a new one. Now you need to use the new token to login.

Add Bot to the Server you are managing

How to build a Substrate Faucet with Discord Bot and Node.js

At tab OAuth2 you choose Bot as image. Now the resulting URL can be used to add your bot to a server. Copy and paste the URL into your browser, choose a server to invite the bot to, and click “Authorize”.

Download the source code and configuration

git clone https://github.com/GeekCash/substrate-faucet

Edit config

token: "", // discord bot token
prefix: '/',
symbol: 'GEEK',
decimals: 12,
ws: 'ws://127.0.0.1:9944', // 
address_type: 42, // https://github.com/paritytech/substrate/blob/e232d78dd5bafa3bbaae9ac9db08f99e238392db/primitives/core/src/crypto.rs#L444
mnemonic: 'link young ...',
amount: 100000,
limit: 12 // The time limit for sending requests is in hours.

After modifying config, compile the source code:

cd substrate-faucet
npm i
npm run dev

Before starting the application make sure you have started the Substrate Node.

npm run start

To compile production, you need to copy the development.js file and change the name to production.js, then change the configuration on the server.

npm run prod

Github: https://github.com/GeekCash/substrate-faucet

#nodejs #substrate #discord #blockchain #javascript

How to build a Substrate Faucet with Discord Bot and Node.js
32.00 GEEK