/cuckoo

Cuckoo is a twitter bot that can save threads and send them to your DM. Developed as a part Tinkerhub Build From Home

Primary LanguagePython

BFH Banner

CUCKOO 🐦

Cuckoo the twitter bot

Ever wished about a bot which can save a twitter thread for you after having an interesting debate on twitter?🤔

Well, cuckoo can help you.😉

Mention her in the thread which you want to save, She will DM you the thread, OR,comeback and log in to the cuckoo console with your twitter id, you can simply download the thread. 😀

Team Members

  1. Shine Santhosh | GitHub | Twitter
  2. JayaSurya Jayandan | GitHub | Twitter
  3. Aswin Anish | GitHub | Twitter

Team ID

BFH/recyBx9eaZvAwGquP/2021

Product walkthrough

Product walkthrough

Deployed code (How to use)

Cuckoo is not currently hosted anywhere

The web console repo

This repo holds the basic code for fetching threads and code to run the bot on repl.it. The web app/console is deployed uding flask and can be found at : Cuckoo Web console

Libraries used

  • Tweepy - 3.10.0
  • python-dotenv - 0.17.1
  • replit - 3.1.0

Check requirements.txt for details

Deploying cuckoo (How to configure)

  • Cuckoo is built using python and tweepy
  • Install the required packages and run main.py
  • Make sure you have twitter developer account
  • Make sure to set the environment variables
  • This bot uses replit db to keep track fo mentions. Make sure to create a key in replit db as described in How to run
  • The main function checks for mentions every minute
  • The thread_fetch function can be used to import mentions and threads to other python files
  • thread_fetch also has a function writeThread, which can be called by passing in the twitter handle, it'll write the thread to a text file

How to run

  • Install the requirements
  • Set the environment variables
  • Create a replit db item with key last_id and set value to 1
  • Run main.py

How it works

  • The bot uses the mentions timeline endpoint provided by the twitter API to fetch mentions
  • The conversation id is retrieved from the mentions
  • Using the conversation id the thread is fetched
  • Then the thread is sent through DM

Environment

  • The following environment variables must be set beforehand if you want to run cuckoo on your machine:
    • API_KEY : Your twitter dev account api key
    • API_SECRET: Your twitter dev account api secret
    • BEARER_TOKEN: Your BearerToken
    • ACCESS_TOKEN: Your app's access token
    • ACCESS_TOKEN_SECRET: Your app's access token secret
    • ID_OFFSET : Set a tweet id here, any mention before that will not be considered

Commiting to the repo

Do you love this project? 😄

You think it has some bugs and know how to fix it? 😮

Or, you think this can be improved? 🤔

You're always welcome to fork, commit and send a pull request 😊

Any pull request, which helps to:

  • Fix bugs
  • Add more features

will be merged after reviews and conflict inspection from other contributors