Twitter Mention bot
Image by Jordi, Made with AI

Twitter Bot README
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
- Create a Twitter account and mention the bot (before running the code) so it has mentions to track.
- Run
Get_mention_ID.py
to fetch mention IDs and store them inlast_seen.txt
. - Add your Twitter API keys to
credentials.py
. - Run
recipe_bot.py
to enable automated replies.
Requirements
- Install Python on your computer.
- Sign in to Twitter Developers.
- Install Tweepy with pip:
pip install tweepy
- 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"
Installation
- Run
Get_mention_ID.py
. - Copy the mention ID and save it in
last_seen.txt
. - 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')
- Run
recipe_bot.py
. - Verify if the bot responds correctly.
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.
-
API and Pokemon
-
Creating Peachjar’s Help Center
-
Astro: Lessons & Wins
-
Twitter Mention bot
-
Astro Test Blog
-
Hubspot-Modules
-
HubSpot-Module-RichText
Related:
Written by

Jordi Comas
Senior Technical Writer
Industrial Designer