170 lines
3.8 KiB
Markdown
170 lines
3.8 KiB
Markdown
# 🐸 Dank Bot
|
|
|
|
A Discord bot built with [discord.py](https://github.com/Rapptz/discord.py), featuring a plugin-based architecture for extensible functionality.
|
|
|
|
## Features
|
|
|
|
- **Plugin System**: Easily add new features by dropping a plugin into the `plugins/` directory
|
|
- **BotChat Plugin**: AI-powered chat responses with configurable prompts
|
|
- **Pepe Plugin**: Classic Pepe meme reactions
|
|
- **Logging**: Full command and message logging via Python's `logging` module
|
|
|
|
## Current Plugins
|
|
|
|
| Plugin | Description |
|
|
|--------|-------------|
|
|
| `botchat` | AI chat plugin with prompt templates and censorship support |
|
|
| `pepe` | Pepe meme reaction plugin |
|
|
|
|
## Prerequisites
|
|
|
|
- [Python 3.12+](https://www.python.org/downloads/)
|
|
- A [Discord Bot Token](https://discord.com/developers/docs/topics/oauth2#bot)
|
|
- A Discord application with the `MESSAGE CONTENT INTENT` enabled
|
|
|
|
## Quick Start (Docker)
|
|
|
|
### 1. Create a token file
|
|
|
|
Create a `.token` file with your Discord bot token:
|
|
|
|
```bash
|
|
echo "YOUR_DISCORD_BOT_TOKEN_HERE" > .token
|
|
```
|
|
|
|
### 2. Build and run
|
|
|
|
```bash
|
|
# Build the Docker image
|
|
docker build -t dank-bot .
|
|
|
|
# Run the bot
|
|
docker run -d \
|
|
--name dank-bot \
|
|
--env DISCORD_TOKEN=$(cat .token) \
|
|
dank-bot
|
|
```
|
|
|
|
> **Note:** The bot reads its token from a `.token` file at runtime. Mount it as a volume:
|
|
> ```bash
|
|
> docker run -d \
|
|
> --name dank-bot \
|
|
> -v $(pwd)/.token:/app/.token:ro \
|
|
> dank-bot
|
|
> ```
|
|
|
|
## Prerequisites (Local)
|
|
|
|
- [Python 3.12+](https://www.python.org/downloads/)
|
|
- [pip](https://pip.pypa.io/)
|
|
|
|
## Local Setup
|
|
|
|
### 1. Create a token file
|
|
|
|
Create a `.token` file with your Discord bot token:
|
|
|
|
```bash
|
|
echo "YOUR_DISCORD_BOT_TOKEN_HERE" > .token
|
|
```
|
|
|
|
### 2. Install dependencies
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
### 3. Run the bot
|
|
|
|
```bash
|
|
python main.py
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
dank-bot-py/
|
|
├── main.py # Bot entry point
|
|
├── requirements.txt # Python dependencies
|
|
├── start.sh # Quick start script
|
|
├── .token # Discord bot token (DO NOT COMMIT)
|
|
├── .gitignore
|
|
├── .dockerignore
|
|
├── Dockerfile
|
|
├── README.md
|
|
└── plugins/
|
|
├── botchat/ # AI chat plugin
|
|
│ ├── plugin.py
|
|
│ ├── settings.yaml
|
|
│ └── prompts/ # Prompt templates
|
|
│ ├── default.txt
|
|
│ ├── default-censored.txt
|
|
│ ├── summarize.txt
|
|
│ └── summarize-search.txt
|
|
└── pepe/ # Pepe meme plugin
|
|
├── plugin.py
|
|
└── pepes.txt
|
|
```
|
|
|
|
## Adding a New Plugin
|
|
|
|
1. Create a new directory under `plugins/`
|
|
2. Add a `plugin.py` file with your bot extension code
|
|
3. The bot will auto-discover and load it on startup
|
|
|
|
## Commands
|
|
|
|
| Command | Description |
|
|
|---------|-------------|
|
|
| `!help` | List available commands |
|
|
| `!chat <message>` | Send a message to the AI chat (via botchat plugin) |
|
|
| `!pepe` | Trigger a Pepe meme reaction |
|
|
|
|
## Configuration
|
|
|
|
- **BotChat**: Edit `plugins/botchat/settings.yaml` for plugin settings
|
|
- **Prompts**: Modify files in `plugins/botchat/prompts/` to customize AI behavior
|
|
- **Token**: Store in `.token` (never commit this file)
|
|
|
|
## Docker
|
|
|
|
### Build
|
|
|
|
```bash
|
|
docker build -t dank-bot .
|
|
```
|
|
|
|
### Run
|
|
|
|
```bash
|
|
docker run -d \
|
|
--name dank-bot \
|
|
--restart unless-stopped \
|
|
-v $(pwd)/.token:/app/.token:ro \
|
|
dank-bot
|
|
```
|
|
|
|
### Logs
|
|
|
|
```bash
|
|
docker logs -f dank-bot
|
|
```
|
|
|
|
### Stop
|
|
|
|
```bash
|
|
docker stop dank-bot
|
|
```
|
|
|
|
## Environment Variables
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `LOG_LEVEL` | Logging verbosity | `INFO` |
|
|
|
|
## Security
|
|
|
|
- **Never commit your `.token` file** — it's included in `.gitignore` for this reason
|
|
- The Docker image runs as a non-root user (`botuser`) for added security
|
|
- Use Docker volume mounts for sensitive files instead of baking them into the image
|