DEV Community

Cover image for How to make a Twitterbot?
Chandrika Deb
Chandrika Deb

Posted on

8 1

How to make a Twitterbot?

🚀 Installation

Clone the repo

$ git clone https://github.com/chandrikadeb7/Girlscript-Twitter-Bot.git

Install tweepy Python module

$ pip install tweepy

💡 Working

Sign up for a Twitter Developer Account

  • Create a separate Twitter account for your bot.
  • Sign up for Twitter Developer Account from this site - Apply for a Twitter Developer Account
  • Enter the necessary fields and await for email confirmation.
  • Click on Create an app
  • Enter the details and keep safe the access tokens generated.

Enter your generated access tokens and consumer keys in the file credentials.py

consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
Enter fullscreen mode Exit fullscreen mode

Edit the retweet and other details in the file config.py

# This is hastag which Twitter bot will search and retweet. You can edit this with any hastag .For example : '#javascript'
QUERY = '#anything'

# Twitter bot setting for liking Tweets
LIKE = True 

# Twitter bot setting for following user who tweeted
FOLLOW = True

# Twitter bot sleep time settings in seconds. For example SLEEP_TIME = 300 means 5 minutes.
# you can decrease it or increase it as you like.Please,use large delay if you are running bot all the time  so that your account does not get banned.

SLEEP_TIME = 300
Enter fullscreen mode Exit fullscreen mode

🔑 Deployment

  • Sign up for a free account in Heroku
  • Click on New -> Create new app
  • Enter the app-name in lower case and select your nearest region.
  • Choose Heroku CLI for deployment. Follow the steps given in Deploy tab.
  • Once the build is successful enable the Free Dynos option from Overview tab.

👏 And it's done!

Alt Text

👀 Checkout?

See here

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

👥 Ideal for solo developers, teams, and cross-company projects

Learn more

👋 Kindness is contagious

If this post resonated with you, feel free to hit ❤️ or leave a quick comment to share your thoughts!

Okay