This discord bot is intended to disburse a HTS token known as $PACT. To minimize costs, it will be deployed on DigitalOcean as a Droplet (Ubuntu version 22.04) and utilizes Supabase for its database.
- DigitalOcean: https://www.digitalocean.com
- Supabase: https://supabase.com/
Using the two platforms should minimize the cost of running the bot.
Refer to the tutorial here
Create a table named prayers, then locate your service key.
DO NOT SHARE YOUR SERVICE KEY AND KEEP IT ONLY TO THE BACKEND!!!
Make a copy of the .env.sample and rename it as .env. Leave it in the root directory of the project. The names should be self explanatory, but refer to the comments below for additional details.
DISCORD_CLIENT_ID
Your Discord bot's ID from the Discord Developer Portal
DISCORD_CHANNEL_ID
Your Discord Channel's ID obtained after enabling Developer Mode
DISCORD_SERVER_ID
Your Discord Server's ID obtained after enabling Developer Mode
DISCORD_TOKEN
Your Discord bot's token given upon bot creation
HEDERA_NETWORK
Testnet, Mainnet, and Previewnet are all valid choices here
HEDERA_OPERATOR_ID
Your Hedera Account ID that will be paying for all TX fees
HEDERA_OPERATOR_PRIVATE_KEY
Your Hedera Private Key associated to the account ID above
REMEMBER NOT TO SHARE THIS, AND KEEP IT TO THE BACKEND TO NOT LEAK OF THIS CRUCIAL SECRET
HEDERA_TOKEN_DECIMALS
The decimals of the HTS token that will be disbursed
HEDERA_TOKEN_DRIP_RATE
Can be a float or integer, depends on how much of the token you want to be disbursed
HEDERA_TOKEN_ID
The token of the HTS token that will be disbursed
HEDERA_REST_API_VERSION
Set this to v1, as Hedera does not have any other versions of the rest api at this time
SUPABASE_SERVICE_KEY
Obtained from your Supabase settings after starting a new project
REMEMBER NOT TO SHARE THIS, AND KEEP IT TO THE BACKEND TO NOT LEAK OF THIS CRUCIAL SECRET
SUPABASE_URL
Obtained from your Supabase settings after starting a new project
-
Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash -
Logout of the terminal and back in
-
Run the last of the installs below:
nvm install node
node -e "console.log('Running Node.js ' + process.version)"
sudo apt install git
git clone https://github.com/hhe44/pactbot.git
cd pactbot
npm install
- Create the service
sudo nano /etc/systemd/system/pactbot.service
[Unit]
Description=Pactbot
After=multi-user.target
[Service]
ExecStart=/root/.nvm/versions/node/v19.6.1/bin/node /root/pactbot/src/main.js
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=pactbot
User=root
[Install]
WantedBy=multi-user.target
- Start the service
sudo systemctl start pactbot.service