This is a simple script that reads the API that provides the total number of products that have been deployed with the DexAppBuilder tool.
Anyone can use this script, even adapt it to their needs. It can be useful for displaying information via an inaccessible voice channel on Discord whose name is updated every 10 minutes (given Discord's limitations).
-
First of all you need to create a new bot at Discord Developers portal and grab the bot token. Keep it private as long you don't want anyone sniffing in your server.
-
Fork this repo and download the code to your PC. We always recommend to test first in your local environment and then, if you liked the product, send it to your private VPS or cloud provider.
-
Extract the ZIP file and, inside the extracted folder, run
pip install -r requirements.txt
to install the necessary dependencies. -
Edit the
.env.example
file with the asked data and then rename it to.env
. IMPORTANT!!! Remember to keep your.env
file secure and hidden. The.gitignore
file of this repo excludes the.env
upload to GitHub but we always need to be special careful on this topic. -
On your Discord server create a new voice channel. Set the restrictions for read-only and forbid access to connect.
-
After this, let's edit our script in order to use our very own server channels. Go to the line 14 (CHANNEL_ID) and paste the ID you grabbed for your channel created above.
-
It's test time! Let's run the script with
python3 bot.py
and check the incoming logs for errors. If the script fails it will just crash and logs will be explicit enough to help you solve the problem. -
To keep this script persistent (for remote deployments mostly) use
nohup python3 bot.py -u &
and then press enter. Ifnohup
doesn not throwexit
message you are ready to go!
You have just deployed your API counter!