Twitter Mention bot

Image by Jordi, Made with AI

Twitter Mention bot

Twitter Bot README

GitHub Code 🤖 Twitter Bot Screenshot

Twitter bot Project: when you use a specific #Hashtag, it will send you a random recipe. 🗨️

Table of Contents

Description

I’m learning Python, so I’m making bots to practice. This bot replies when mentioned with a specific hashtag. You can customize the reply content. Feel free to use it!

How To Use

  1. Create a Twitter account and mention the bot (before running the code) so it has mentions to track.
  2. Run Get_mention_ID.py to fetch mention IDs and store them in last_seen.txt.
  3. Add your Twitter API keys to credentials.py.
  4. Run recipe_bot.py to enable automated replies.

Back To The Top

Requirements

  1. Install Python on your computer.
  2. Sign in to Twitter Developers.
  3. Install Tweepy with pip:
pip install tweepy
  1. Add your API keys in Get_mention_ID.py:
CONSUMER_KEY = "YOUR_CONSUMER_KEY"
CONSUMER_SECRET = "YOUR_CONSUMER_SECRET"
ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"
ACCESS_TOKEN_SECRET = "YOUR_ACCESS_TOKEN_SECRET"

Back To The Top

Installation

  1. Run Get_mention_ID.py.
  2. Copy the mention ID and save it in last_seen.txt.
  3. In recipe_bot.py, change the hashtag:
store_last_seen_id(since_id, FILE_NAME)
if '#randomrecipe' in mention.full_text.lower():
    print('found #randomrecipe')
  1. Run recipe_bot.py.
  2. Verify if the bot responds correctly.

Back To The Top

License

MIT License © [2022] [Chory Codes]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.

Back To The Top