level-system-phoenix
Version:
Ein Levelsystem für WhatsApp Bots mit Baileys und Command-Handlern inklusive Cheat-Schutz, XP, Ränge und Speicher.
56 lines (46 loc) • 1.44 kB
Markdown
# level-system-phoenix
Levelsystem für WhatsApp-Bots (z.B. mit phoenix-baileys-v2) – sicher & cheat-resistent.
## Struktur
```
level-system-phoenix/
├── package.json
├── README.md
└── src/
├── index.js
├── storage.js
├── level.js
└── event/
└── onCommandXP.js
```
## Features
- XP nur für Commands mit `/` (z.B. `/help`)
- Pro Command: 10 XP (anpassbar)
- 1 Command/30s für XP (anpassbar)
- Exponentielles Levelsystem (Level 2 = 400 XP, Level 3 = 900 XP, ...)
- Sicher gegen Spamming
- Erweiterbar (DB-Support, eigene Events etc.)
## Installation & Nutzung
1. **Installiere das Modul** (lokal im Bot-Projekt verwenden):
```bash
npm install level-system-phoenix
```
2. **Integriere das Levelsystem:**
```js
const LevelSystem = require('level-system-phoenix');
const levelSystem = new LevelSystem();
// In deiner Baileys Message-Event-Loop:
if (text.startsWith('/')) {
const { xpGained, levelUp, level } = levelSystem.processCommand(userId);
if (xpGained > 0) {
let msg = `Du bekommst ${xpGained} XP.`;
if (levelUp) msg += ` 🎉 Level Up! Du bist jetzt Level ${level}.`;
// sende msg an User
}
}
```
3. **Eigene Events nutzen:**
```js
const onCommandXP = require('level-system-phoenix/src/event/onCommandXP');
// Beispiel:
const result = onCommandXP(levelSystem, userId);
```