This Reddit bot automatically replies to comments in a specified subreddit with a gif you requested. The bot uses the Giphy API to fetch memes and responds to comments containing a specific trigger word.
- Monitors comments in a specified subreddit.
- Replies to comments containing a trigger word set by you.
- Fetches memes using the Giphy API.
- Configurable trigger word and subreddit.
- Python 3.x: Ensure you have Python 3.x installed on your system.
- Reddit Account: You need a Reddit account to create an application and get API credentials.
- Giphy API Key: Obtain an API key from Giphy.
-
Clone the repository
git clone https://github.com/dheerajcl/Reddit_meme_generator-bot.git cd <repository-directory>
-
Install the required packages
pip install praw requests
-
Configure the bot
Create a
config.py
file in the root directory of the project with the following content:# Reddit API credentials client_id = 'YOUR_REDDIT_CLIENT_ID' client_secret = 'YOUR_REDDIT_CLIENT_SECRET' username = 'YOUR_REDDIT_USERNAME' password = 'YOUR_REDDIT_PASSWORD' user_agent = 'YOUR_USER_AGENT' # Giphy API key giphy_api_key = 'YOUR_GIPHY_API_KEY'
Run the bot and set SUBREDDIT
variable to the subreddit you want to monitor and TRIGGER_WORD
to the word that will trigger the bot to reply with a meme.
If you set TRIGGER_WORD
to "gif"
followed by the word you want a gif on and the bot is running, it will reply to any comment in the specified subreddit containing the word "gif" with the gif you requested from Giphy.
-
Go to Reddit/apps and create a new app,
description
andabout url
are optional. -
redirect uri
can be set tohttp://localhost:8000
-
Get your
client_id
(under your app name) andclient_secret
-
Visit Giphy API and create a new api key