A twitter + discord webhook bot to notify users of governance proposals when in voting period
https://envy-cosmos.neocities.org/post/deploying-a-discord-governance-bot/
Twitter: @CosmosGovNotifs
Discord Notifications: ChandraStation Discord
ATOM, OSMO, JUNO, AKT, SECRET, TERRA, HUAHUA, STARS, CMDX, CRO, EVMOS, GRAVITY, INJ, IRIS, LUM, REGEN
DIG, DVPN, KAVA, LIKE, XPRT, BCNA, BITSONG, BOSTROM, CHEQD, PB, SIF, UMEE, Starname (iov), Band, FetchAI
-
Update secrets.json to your own values. If you do not plan on using one of the bots, you do not need to fill out the values.
-
If you want to allow all tickers to be announced, leave TICKERS_TO_ANNOUNCE as
[]
To specify tickers, add them in a list as["dig","osmo","huahua"]
matching tickers in the GovBot.py script chainIds* -
Open the .py script and edit the following:
IN_PRODUCTION
DISCORD
TWITTER
USE_PYTHON_RUNNABLE
if true, run the script in a screen such as screen -S bot python3 GovBot.py
if false, use a cronjob to auto run it when you want, use https://crontab.guru/examples.html for help, must cd to directory first
such as: */30 * * * * cd /root/CosmosBot && python3 GovBot.py
LOG_RUNS
Just adds logs.txt for when the script is run to ensure success
For threads, you must set DISCORD = True
in GovBot.py. Within your discord client you will need 2 things:
-
The Channel_ID (right click the channel and it should be at the very bottom. If not, settings > Advanced > Developer Mode)
-
Guild ID (right click the server icon, and copy ID)
NOTE: You must use the same channel_id as the webhook is generated on
Next you need to set yourTHREAD_ARCHIVE_MINUTES
. There are 4 values you can do:60, 1440, 4320, 10080
-
By default level 0 servers only have 60 and 1440 (24hours). To get access to other values, you have to increase your server boost.
Finally you must setup a bot application, HOWEVER it is not actually run like a normal bot. We just pass it through discords endpoints & simulate it being on. So no hassle :) -
New Application in the top (Then name it, create)
-
On the left, click "Bot"
-
On the right, "Add Bot", then "Yes Do It"
-
Click on "Reset Token' to get the Bots Token, then "Yes Do It" (You may be required to enter a 2fa code here)
-
Example Token: OTUyMDgwOTQ5NzcwODUwMzY1.Yiw0ew.8Fsxi4I4IMgmAICyh_HdsIXL_jo
-
Paste this token into the secret.json file under "DISCORD_THREADS" -> "BOT_TOKEN"
-
Now back on the browser, click on "OAuth2" on the left
-
Under the "URL Generator" tab, in scopes select "bot" (center, middle)
-
Then at the bottom you should have a generated URL, copy this into your browser & invite it to the server