Skip to content

sid6i7/perplexed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Perplexed

A Discord bot that answers your questions by reading Reddit comments. Built in Python, powered by Gemini and the Reddit API.

What it does

Drop /question <your question> in a Discord channel where the bot is added. It:

  1. Searches Reddit for posts relevant to the question (via PRAW).
  2. Pulls the top comments from those posts.
  3. Sends the comments to Gemini 1.5 with a prompt that grounds the answer in what real people on Reddit actually said.
  4. Returns the answer in chat.

There is also a /search <query> command that just returns the relevant subreddit / post URLs without generating an answer.

Why

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.

Stack

  • Language: Python
  • Bot framework: discord.py
  • Reddit API: PRAW
  • LLM: Google Gemini (via google-generativeai)

Running it yourself

  1. Clone and install:

    git clone https://github.com/sid6i7/perplexed
    cd perplexed
    pip install -r requirements.txt
  2. Create a .env file with:

    DISCORD_BOT_TOKEN=...
    GEMINI_API_KEY=...
    REDDIT_CLIENT_ID=...
    REDDIT_CLIENT_SECRET=...
    REDDIT_USER_AGENT=...
  3. Run:

    python app.py
  4. Add the bot to a Discord server and try /question why is rust so loved?.

Project layout

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)

About

A chatbot which uses comments on reddit posts to answer your questions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages