Simple versatile Discord bot to automate dOrg tweets through emoji votes. You can deploy on your own cloud using docker.
-
Get API keys for Twitter
-
Set up Discord Bot account and add it to your server. Make sure roles and permissions allow the bot to see the channel where you're sending your commands.
-
Create a MongoAtlas database and configure connections.
-
Clone this repo
-
Set your
.env
file with these variables,
DISCORD_TOKEN=yourdiscordtoken
DISCORD_GUILD=name of your server
TWITTER_SECRET=twitterapi
TWITTER_CLIENT=twitterkey
ATLAS=database
MONGO_DB_NAME=collection
- Deploy the Docker container with the command
docker build -t boteki .
anddocker run boteki
.
Once the bot is running you can call the following commands:
!tweet
: Set up an emoji vote poll of the tweett and log it in a database!validate
: Looks up all the tweets logged on the database, updates the score if possible, and tweets or schedules the tweet.!plznuke
: Resets the existing database. use this if the bot breaks during development. Remove this function from the bot before bringing to production to avoid trouble.
Set up variables on the config.py file, also create a .env with discord, modgo atlas and twitter keys.
- Connect Discord bot through official API.
- Receinve
!tweet
specific commands on Discord #Twitter channel. - Log tweets to a MongoAtlas cloud server.
- Query database for received tweets.
- Created basic
mongo.py
to interact with the cloud server - Create a function to nuke the database if needed
mogo.nukeDB()
- Update data on tweets with the
!validate
command - Connect to Twitter through Tweepy
- Add tweets to queue when
!validate
is called () - Confirm tweet length and other error handling
- Make this reproducible witha docker container
Next steps:
- Create a queue of tweets to post
- create a
!preview
command to show the queued tweets before sending them - Try to link to hubspot profiles and ethereum addresses
- Establish versions to the Docker requirements to reproduce correct builds
- Bash script that builds the docker image and runs it
- Update mongo documents with link to succesfully posted tweets