Giter VIP home page Giter VIP logo

cosmos-governance-bot's Introduction

CosmosGovernanceProposalBot

REFACTOR IN THE WORKS FOR COSMOS DIRECTORY, SEE LATEST PR but the team doesn't want to add twitter accounts to cosmos directoy :(


A twitter + discord webhook bot to notify users of governance proposals when in voting period

Twitter: @CosmosGovNotifs
twitter

Discord Notifications: ChandraStation Discord
discord

Configuration

git clone https://github.com/Reecepbcups/cosmos-governance-bot.git
cd cosmos-governance-bot

cp secrets.example.json secrets.json

# 1) 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.*

#2) 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 cosmpy_chain CHAIN_APIs*


#3) python3 -m pip install -r requirements/requirements.txt

#4) run 'python src/gov-bot.py'

# if you want to run every 30 minutes, here is that crontab example:
# */30 * * * * cd /root/cosmos-governance-bot && python src/gov-bot.py

USE_PYTHON_RUNNABLE a

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/cosmos-governance-bot && python3 src/gov-bot.py

LOG_RUNS Just adds logs.txt for when the script is run to ensure success

Discord Threads

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 your THREAD_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 :)

  • https://discord.com/developers/applications

  • 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)

  • In Bot Permissions, select the following: bot-values

  • Then at the bottom you should have a generated URL, copy this into your browser & invite it to the server

cosmos-governance-bot's People

Contributors

reecepbcups avatar defi-suffrage avatar

Stargazers

 avatar

Forkers

pnpn1212

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.