https://github.com/dipinknair/lfc_twitter_bot
This is a Twitter bot made to retweet #LFC tagged tweets. Written in python and running on Hiroku cloud platform
https://github.com/dipinknair/lfc_twitter_bot
bot hiroku twitter-bot
Last synced: 11 months ago
JSON representation
This is a Twitter bot made to retweet #LFC tagged tweets. Written in python and running on Hiroku cloud platform
- Host: GitHub
- URL: https://github.com/dipinknair/lfc_twitter_bot
- Owner: dipinknair
- License: mit
- Created: 2021-01-08T00:24:08.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-05-25T01:45:25.000Z (about 3 years ago)
- Last Synced: 2025-03-02T16:49:14.937Z (over 1 year ago)
- Topics: bot, hiroku, twitter-bot
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Twitter Bot: Auto Retweet with #LFC
This is a Twitter bot written in Python using the Tweepy library that automatically retweets any tweet containing the hashtag #LFC (Liverpool Football Club). It uses the Twitter API to authenticate and interact with the Twitter platform.
## Prerequisites
Before running the bot, make sure you have the following:
- Python 3.x installed on your machine
- Tweepy library installed (`pip install tweepy`)
- Twitter API credentials (consumer key, consumer secret, access token, and access token secret) obtained from the Twitter Developer Portal.
## Installation
1. Clone this repository to your local machine:
```bash
git clone [repository_url]
```
2. Navigate to the project directory:
```bash
cd [project_directory]
```
3. Install the required dependencies using pip:
```bash
pip install -r requirements.txt
```
## Configuration
To configure the Twitter API credentials, you have two options:
### Option 1: Environment Variables
1. Create a `.env` file in the project directory.
2. Open the `.env` file and add the following lines:
```plaintext
consumer_key=[your_consumer_key]
consumer_secret=[your_consumer_secret]
access_token=[your_access_token]
access_token_secret=[your_access_token_secret]
```
3. Replace `[your_consumer_key]`, `[your_consumer_secret]`, `[your_access_token]`, and `[your_access_token_secret]` with your actual Twitter API credentials.
### Option 2: Direct Configuration
Alternatively, you can directly modify the `create_api()` function in the code and replace the corresponding variables with your Twitter API credentials:
```python
consumer_key = 'your_consumer_key'
consumer_secret = 'your_consumer_secret'
access_token = 'your_access_token'
access_token_secret = 'your_access_token_secret'
```
## Usage
To run the bot, execute the following command:
```bash
python bot.py
```
The bot will start streaming tweets with the given keywords and automatically retweet any tweet that contains the hashtag #LFC. It will also mark those tweets as Liked.
To customize the keywords, modify the `main()` function in the code and provide a list of desired keywords:
```python
if __name__ == "__main__":
main(["#LFC", "#Liverpool", "#YNWA"])
```
## Deploying to Heroku
To deploy the Twitter bot to Heroku, follow these steps:
1. Create a new Heroku app either through the Heroku website or using the Heroku CLI.
2. Set the required environment variables (`consumer_key`, `consumer_secret`, `access_token`, and `access_token_secret`) in your Heroku app's settings.
3. Push the code to your Heroku app's repository:
```bash
git push heroku main
```
4. Scale up the worker dyno:
```bash
heroku ps:scale worker=1
```
Your bot will now be deployed on Heroku and start retweeting tweets with the specified keywords.
**Note:** Make sure your Heroku account is verified to use the worker dyno.
## License
[Include license information for your project, if applicable.]