Git Product home page Git Product logo

discord-twitter-bot's Introduction

discord-twitter-bot

Posts Twitter Tweets to Discord through Webhook

Invite Link License: MIT Build Status Code style: black Last Commit Pull Requests Docker Pulls

Preview

Heroku Deployment

Deploy

Remember to activate the app. View the logs here.
Use this to initially deploy your discord-twitter-bot.

To further configure the bot get Heroku CLI and run launcher.py. (Warning: This is not recommended for inexperienced users since a lot of things could go wrong.)

heroku login
heroku create <your heroku app name>
cd <your heroku app name>
git remote add origin https://github.com/NNTin/discord-twitter-bot
git pull origin master
python bot/launcher.py
git add .
git commit -am "updated configuration"
git push heroku

This will create a data.json and the bot will ignore any set environment variable.

YT Video to Heroku Deployment

YT Video

Docker Setup

(Warning: This is only recommended for experienced users who have some basic experience with Docker.)

nano .env
docker run --env-file ./.env nntin/discord-twitter-bot

.env file example

ACCESS_TOKEN=XXX-XXX
ACCESS_TOKEN_SECRET=XXX
CONSUMER_KEY=XXX
CONSUMER_SECRET=XXX
TWITTER_ID=123,456,789
TWITTER_LIST=https://twitter.com/rokxx/lists/dota-2
TWITTER_HANDLE=discordapp
WEBHOOK_URL=https://discordapp.com/api/webhooks/123456789/XXXX-XXXX

Optional environment variables: INCLUDE_REPLY_TO_USER, INCLUDE_RETWEET, INCLUDE_USER_REPLY, CUSTOM_MESSAGE, KEYWORDS

One of the 3 environment variables are required: TWITTER_ID, TWITTER_LIST and TWITTER_HANDLE. You can specify all three.

Normal Setup

(Warning: This is only recommended for experienced users who have some basic experience with CLI.)

Get Python >=3.6.0

git clone https://github.com/NNTin/discord-twitter-bot.git
cd discord-twitter-bot      # ^ download the project and cd into it
python3 -m venv venv        # optional virtual environment, recommended
source venv/bin/activate    # only run if you did venv
python3 bot/launcher.py     # configure the bot, this create a config.json
python3 bot/main.py         # run the bot

Once you have set everything up you can run main.py directly. (Useful in combination with systemd, Upstart, PM2, etc.)

Useful links:

Why?

Q: Why Heroku?
A: Heroku has a lot of bad reputation for being an inferior hosting service. The heroku dynos restart roughly every 24 hours and data are lost. However Heroku can be incredibly user friendly once it is properly set up. No knowledge about git, ssh and python is required. I personally don't host anything on Heroku but I appreciate Heroku since it is a free hosting solution and it can be very user friendly (but not developer friendly).

Q: Why add automated testing and automated docker image deployment for a relatively simple solo project? Isn't this overkill?
A: Continuous integration/deployment is incredible useful in bigger projects. It cuts down development time. I contributed to other FOSS projects that had CI/CD and I was interested how the flow was actually implemented.

Q: Why Travis and Azure Pipelines?
I added Travis CI support first. But then I learned about how they were acquired by another company and there was a massive layoff. I then looked for alternatives in case the Travis becomes less user friendly and Azure Pipelines seemed like a good choice. I have migrated from Travis to Azure Pipelines but I will keep both around for educational purposes.

Credits

Rokxx for providing the dota 2 twitter list.
JacobWolf for providing the twitter lists for CS:GO, LoL, Overwatch, CoD and SSMB.

discord-twitter-bot's People

Contributors

nntin avatar pyup-bot avatar paveliarch avatar likewhoa avatar

Watchers

James Cloos avatar

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.