A Discord bot that answers your questions by reading Reddit comments. Built in Python, powered by Gemini and the Reddit API.
Drop /question <your question> in a Discord channel where the bot is added. It:
- Searches Reddit for posts relevant to the question (via PRAW).
- Pulls the top comments from those posts.
- Sends the comments to Gemini 1.5 with a prompt that grounds the answer in what real people on Reddit actually said.
- Returns the answer in chat.
There is also a /search <query> command that just returns the relevant subreddit / post URLs without generating an answer.
A lot of the time the genuinely useful answer to a question is already buried in a six-year-old Reddit thread. This is a thin wrapper that does the digging for you, summarises what people said, and gives it back in one paragraph.
- Language: Python
- Bot framework: discord.py
- Reddit API: PRAW
- LLM: Google Gemini (via
google-generativeai)
-
Clone and install:
git clone https://github.com/sid6i7/perplexed cd perplexed pip install -r requirements.txt -
Create a
.envfile with:DISCORD_BOT_TOKEN=... GEMINI_API_KEY=... REDDIT_CLIENT_ID=... REDDIT_CLIENT_SECRET=... REDDIT_USER_AGENT=...
-
Run:
python app.py
-
Add the bot to a Discord server and try
/question why is rust so loved?.
app.py entry point
discord_bots/perplexed_bot.py discord client + message handlers
model/model.py prompt construction + Gemini call
model/config.py model name + generation config
utils/reddit.py PRAW wrappers (search, comments)