diff --git a/readme.md b/readme.md index 74a2fad..144ac16 100644 --- a/readme.md +++ b/readme.md @@ -1,64 +1,274 @@ -# Papo Discord Bot +# 🚀 Papo Discord Bot -Discord-Bot (discord.js 14, TypeScript) mit Web-Dashboard, Prisma/PostgreSQL und Docker-Support.. +

+ + + + + +

-## Highlights -- Ticketsystem mit Panels, Transcripts und Support-Login (Slash-Commands wie `/ticket`, `/claim`, `/close`). -- Automod (Link-Whitelist, Spam/Caps, Bad-Word-Listen), Logging für relevante Events. -- Musik (play/skip/stop/pause/resume/loop) pro Guild aktivierbar. -- Welcome, Leveling, dynamische Voice, Birthdays, Reaction Roles, Events mit Remindern. -- Statuspage-Modul, Rich Presence und modulbasierte Dashboard-Navigation. +A modern, feature-rich Discord bot built with **discord.js v14**, **TypeScript**, **Prisma**, and **PostgreSQL**, featuring a powerful web dashboard and modular architecture. -## Tech-Stack -- Node.js 20, TypeScript (CommonJS) -- discord.js 14, play-dl, @discordjs/voice -- Express + OAuth2-Login -- Prisma ORM (PostgreSQL) -- Dockerfile + docker-compose +--- -## Quickstart (lokal) -1. Repo klonen, in das Verzeichnis wechseln. -2. `.env` anlegen: `cp .env.example .env` und Werte setzen. -3. Abhängigkeiten: `npm ci` (oder `npm install`). -4. Prisma: `npx prisma generate --schema=src/database/schema.prisma` und `npx prisma migrate dev --name init`. -5. Start Dev: `npm run dev` (ts-node-dev). Dashboard/Bot auf `PORT` (Standard 3000). -6. Slash-Commands werden beim Start für `DISCORD_GUILD_IDS` (oder `DISCORD_GUILD_ID`) registriert. +# ✨ Features -## Quickstart (Docker) -- Dev-Stack: `docker-compose up --build` (Dockerfile + Postgres 15, env aus `.env`, startet `npm run dev`). -- Eigenes Image: `docker build .` (Prisma-Generate läuft im Build). `.dockerignore` blendet lokale `node_modules`/`.env` aus. +## 🎫 Ticket System +- Interactive ticket panels +- Ticket claiming +- Ticket transcripts +- Support login sessions +- Slash commands (`/ticket`, `/claim`, `/close`, ...) -## Environment-Variablen (Auswahl) -- `DISCORD_TOKEN` (Pflicht, Bot Token) -- `DISCORD_CLIENT_ID` / `DISCORD_CLIENT_SECRET` (Dashboard-OAuth) -- `DISCORD_GUILD_ID` (optional Einzel-Guild) / `DISCORD_GUILD_IDS` (kommagetrennt) -- `DATABASE_URL` (Pflicht, Postgres) -- `PORT` (Dashboard/Bot, default 3000) -- `SESSION_SECRET` (Express Session Secret, default `papo_dev_secret`) -- `DASHBOARD_BASE_URL` (Public Base URL für OAuth Redirect) -- `WEB_BASE_PATH` (Default `/ucp`, ohne Slash am Ende) -- `OWNER_IDS` (kommagetrennte Owner für Admin-UI) -- `SUPPORT_ROLE_ID` (optional Ticket/Support-Login Rolle) +## 🛡️ Moderation +- Link whitelist +- Anti-Spam +- Anti-Caps +- Bad word filtering +- Comprehensive server logging -## Datenbank / Prisma -- Hauptschema: `src/database/schema.prisma` (zweites in `prisma/schema.prisma` für Binary Targets). -- Migrationen: `npx prisma migrate dev --name `; danach `npx prisma generate --schema=src/database/schema.prisma`. -- Kern-Tabellen: GuildSettings, Ticket, TicketSupportSession, Event/EventSignup, RegisterForm/RegisterApplication, Birthday, ReactionRoleSet, Level. +## 🎵 Music +- Play music from multiple sources +- Queue support +- Pause / Resume +- Skip +- Stop +- Loop +- Enable/Disable per server -## Scripts -- `npm run dev` – Entwicklung (ts-node-dev) -- `npm run build` – TypeScript build -- `npm start` – Start aus `dist` -- Prisma-CLI: `npx prisma ...` (nutzt Schema aus `src/database/schema.prisma`) +## 👋 Community Features +- Welcome messages +- Leveling system +- Birthday reminders +- Reaction Roles +- Dynamic Voice Channels +- Event system with reminders -## API/Dashboard Kurzinfo -- Auth-Gate (`/api/*`), Login `/auth/discord`, Callback `/auth/callback`, Logout `/auth/logout`. -- `/api/guilds` filtert auf Guilds, die der eingeloggte User besitzt oder managen darf **und** in denen der Bot ist. -- Settings/Module über `/api/settings`, `/api/modules`, Tickets unter `/api/tickets*`, weitere Endpoints für Events, Reaction Roles, Birthday, Statuspage. +## 📊 Dashboard +- Discord OAuth2 Login +- Guild management +- Modular settings +- Status Page integration +- Rich Presence management +- Modern responsive interface -## Deployment-Hinweise -- Produktion: `npm run build` + `npm start` oder Docker-Image nutzen. -- Transcripts liegen unter `./transcripts` (bei Containern als Volume mounten). +--- -## Credits/Lizenz -- Autoren/Lizenz nicht hinterlegt – bitte vor Nutzung prüfen. +# 🛠️ Tech Stack + +| Technology | Version | +|------------|---------| +| Node.js | 20+ | +| TypeScript | Latest | +| discord.js | v14 | +| Express | Latest | +| Prisma ORM | Latest | +| PostgreSQL | 15+ | +| Docker | Supported | + +--- + +# 📦 Installation + +## Local Development + +Clone the repository + +```bash +git clone https://github.com/yourname/papo-discord-bot.git +cd papo-discord-bot +``` + +Create your environment file + +```bash +cp .env.example .env +``` + +Install dependencies + +```bash +npm install +``` + +Generate Prisma Client + +```bash +npx prisma generate --schema=src/database/schema.prisma +``` + +Run database migrations + +```bash +npx prisma migrate dev --name init +``` + +Start the development server + +```bash +npm run dev +``` + +The bot and dashboard will start on the configured **PORT** (default: `3000`). + +Slash commands are automatically registered for the guilds defined in: + +- `DISCORD_GUILD_IDS` +- or `DISCORD_GUILD_ID` + +--- + +# 🐳 Docker + +Start the complete development stack + +```bash +docker-compose up --build +``` + +Build the Docker image manually + +```bash +docker build -t papo-discord-bot . +``` + +The Docker image automatically generates the Prisma Client during the build process. + +--- + +# ⚙️ Environment Variables + +| Variable | Description | +|-----------|-------------| +| `DISCORD_TOKEN` | Discord Bot Token | +| `DISCORD_CLIENT_ID` | Discord OAuth Client ID | +| `DISCORD_CLIENT_SECRET` | Discord OAuth Secret | +| `DATABASE_URL` | PostgreSQL Connection String | +| `PORT` | Dashboard Port (default: 3000) | +| `SESSION_SECRET` | Express Session Secret | +| `DASHBOARD_BASE_URL` | Public Dashboard URL | +| `WEB_BASE_PATH` | Base path (default: `/ucp`) | +| `OWNER_IDS` | Comma-separated Bot Owners | +| `SUPPORT_ROLE_ID` | Support Role ID | +| `DISCORD_GUILD_ID(S)` | Guild(s) for command registration | + +--- + +# 🗄️ Database + +Main Prisma schema + +``` +src/database/schema.prisma +``` + +Generate Prisma Client + +```bash +npx prisma generate --schema=src/database/schema.prisma +``` + +Create a migration + +```bash +npx prisma migrate dev --name your-migration +``` + +### Core Models + +- GuildSettings +- Ticket +- TicketSupportSession +- Event +- EventSignup +- RegisterForm +- RegisterApplication +- Birthday +- ReactionRoleSet +- Level + +--- + +# 📜 Available Scripts + +| Command | Description | +|---------|-------------| +| `npm run dev` | Development Mode | +| `npm run build` | Compile TypeScript | +| `npm start` | Run Production Build | +| `npx prisma ...` | Prisma CLI | + +--- + +# 🌐 Dashboard API + +Authentication + +``` +/auth/discord +/auth/callback +/auth/logout +``` + +Protected API + +``` +/api/* +``` + +Main Endpoints + +- `/api/guilds` +- `/api/settings` +- `/api/modules` +- `/api/tickets` +- `/api/events` +- `/api/reactionroles` +- `/api/birthday` +- `/api/statuspage` + +Only guilds where the authenticated user has **Manage Server** permissions and where the bot is present are accessible. + +--- + +# 🚀 Deployment + +Production build + +```bash +npm run build +npm start +``` + +or simply use Docker. + +Ticket transcripts are stored in + +``` +./transcripts +``` + +When running inside Docker, mount this directory as a volume to persist transcripts. + +--- + +# ❤️ Contributing + +Contributions, feature requests, and bug reports are always welcome! + +Feel free to open an Issue or submit a Pull Request. + +--- + +# 📄 License + +No license has been specified yet. + +Please add an appropriate open-source license before publishing this project. + +--- + +

+Built with ❤️ using TypeScript, Discord.js, Prisma & PostgreSQL +

\ No newline at end of file