![A screenshot of a Discord bot in action](https://images.mitch.science/i/40ebc4e7-028c-471e-910c-b6f20b143176.jpg) # Perplexica Discord Bot This is a Python-based Discord bot that acts as a client for the Perplexica API. It allows users to perform searches and get answers directly in Discord. ## Features - **/search**: Perform a search using the Perplexica API. - **/mode**: Switch between `Balanced` and `Fast` search modes. - Beautifully formatted responses using Discord embeds. - Includes citations and sources. ## Prerequisites - Python 3.8 or higher - A running instance of the Perplexica application. - A Discord Bot Token. ## Setup 1. **Clone the repository (or download the files into a `perplexica-discord-bot` directory):** ```bash git clone https://github.com/your-username/perplexica-discord-bot.git cd perplexica-discord-bot ``` 2. **Install the required Python libraries:** ```bash pip install -r requirements.txt ``` 3. **Configure the Bot:** - Rename the `.env.example` file to `.env` (or create a new `.env` file). - Open the `.env` file and replace `"YOUR_DISCORD_BOT_TOKEN_HERE"` with your actual Discord bot token. ```env DISCORD_BOT_TOKEN="YOUR_DISCORD_BOT_TOKEN_HERE" ``` 4. **Ensure your Perplexica instance is running.** - By default, the bot will try to connect to the Perplexica API at `http://localhost:3000/api/search`. If your Perplexica instance is running on a different address, update the `PERPLEXICA_API_URL` variable in `bot.py`. ## Running the Bot Once the setup is complete, you can run the bot with the following command: ```bash python bot.py ``` You should see a message in your console confirming that the bot has logged in and is ready. ## Usage Once the bot is running and has joined your Discord server, you can use the following slash commands: - `/search `: Get an answer to your question. - Example: `/search Who is the founder of Microsoft?` - `/mode `: Change your preferred search mode. - Example: `/mode Fast` Enjoy using Perplexica in Discord!