Skip to content

moonshotcapital/twitter_bot

 
 

Repository files navigation

Twitter bot

Create your Keys and Access Tokens

Go to Twitter Application Management and click "Create New App".
Fill in the required fields on the website https://apps.twitter.com/app/new and click "Yes, I have read and agree to the Twitter Developer Agreement." then "Create your Twitter application".
Click "Keys and Access Tokens" and you look your Consumer Key (API Key) and Consumer Secret (API Secret).
Click "create my access token" and you give your Access Token and Access Token Secret.

Usage

Use generated keys and tokens for Tweepy authentication in /twitterbot/bot/settings.py.

You can add users for twitter automation in TWITTER_ACCOUNT_SETTINGS in the same file.

You can specify an automation strategy individually for each user.

Example

    'testuser': {
        'unfollow': ['utils.twitterbot.make_unfollow_for_current_account'],
        'follow': ['utils.twitterbot.make_follow_for_current_account',
                   'utils.twitterbot.follow_all_own_followers'],
        'followers_limit': 50,
        'retweet': True
    },
  • 'unfollow': [...] - a list of functions for unfollowing
  • 'follow': [...] - a list of functions for following
  • 'followers_limit': 10 - a number for limit followers and unfollowers for current account
  • 'retweet': True - bool value, if True - make retweets for current account
Note

If you want to follow all the users who follows you - use the function follow_all_own_followers() in twitterbot/utils/twitterbot.py.

Run bot using Docker

$ docker-compose -f docker-compose-dev.yml up -d --build

Optional features

Twitter bot uses celery tasks for making the operations:

  • follow users
  • unfollow users
  • retweet by a tag

However, you can also do this stuff with django-admin commands in /twitterbot/management/commands.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.3%
  • Other 1.7%