🤖 Levatain-MD
WhatsApp Bot built on Baileys
✨ Features
- 🤖 AI Assistant — Chat with Levatain using trigger words
lev,levatain, orleva - 🧠 AI Self-Aware — AI knows the bot's own structure and source code (sanitized)
- ⚠️ Smart Error Handler — Friendly error messages to users + auto report to owner
- ⚔️ RPG System — Full RPG with jobs, battles, dungeons, quests, inventory, and leaderboard
- 🎮 Games — Brain Teaser, Cak Lontong, Guess the Word, Lyric, Flag, Continent, Picture, Number Bomb
- 📰 Auto Broadcast — Auto news broadcast from CNBC Indonesia at 04:00, 10:00, 16:00, 22:00 WIB
- 👥 Group Management — Welcome, antilink, mute, tagall
- ⭐ Premium System — Daily limit, auto reset at 00:00
- 💰 Economy — Balance, daily reward, spin, transfer
- 🔒 Anti Spam — Per-command cooldown
- 📁 Plugin System — Upload plugins directly from chat
🚀 Installation
git clone https://github.com/username/Levatain-MD.git
cd Levatain-MD
npm install
node index.js
⚙️ Configuration
Edit src/config/config.js:
export const config = {
sessionName: 'session',
pairingNumber: 'YOUR_NUMBER',
};
global.owner = 'OWNER_NUMBER';
global.ownerid = 'OWNER_LID';
global.botName = 'Levatain-MD';
global.thumb = 'THUMBNAIL_URL';
global.link = 'LINK_URL';
📁 Folder Structure
Levatain-MD/
├── index.js
├── re.js
├── package.json
├── src/
│ ├── handler.js
│ ├── ai-handler.js
│ ├── api.js
│ ├── bot-structure.js ← AI bot self-awareness
│ ├── error-handler.js ← Centralized error handler
│ ├── broadcaster.js
│ ├── levelup.js
│ ├── library.js
│ ├── logger.js
│ ├── news.js
│ ├── magiceraser.js
│ ├── scheduler.js
│ ├── config/
│ │ ├── config.js
│ │ └── rpg-config.js
│ └── data/
│ ├── schema.js
│ ├── game-sessions.js
│ ├── rpg-data.js
│ └── rpg-activity.js
├── plugins/
│ ├── ai/
│ ├── download/
│ ├── event/
│ │ ├── ai/ ← noprefix AI handler
│ │ └── game/ ← noprefix game answer checkers
│ ├── games/
│ ├── group/
│ ├── owner/
│ ├── rpg/
│ ├── search/
│ └── tools/
└── database/
└── db.json
🔌 Plugin System
Prefix Plugin
Command-based plugins in plugins/<category>/:
export default {
name: 'Plugin Name',
cmd: ['command'],
tag: 'category',
isOwner: false,
isPremium: false,
isGroup: false,
isAdmin: false,
isLimit: false,
alias: false,
cooldown: 3,
run: async ({ sock, message, body, db, gdb, saveDb, isOwner, isPrem, mentionedJid, quoted, command }) => {
const { from, raw } = message;
await sock.sendMessage(from, { text: 'Hello!' });
}
};
Event Plugin (No Prefix)
Non-command plugins in plugins/event/<category>/. Triggered on every message without prefix. Return true to stop further processing, false to pass through.
export default {
name: 'Event Name',
run: async ({ sock, from, body, raw, db, saveDb, primaryId, isPrem, isOwner }) => {
return false;
}
};
Upload plugins directly from chat using .make plugins/ while attaching the file.
⚔️ RPG System
| Command | Description |
|---|---|
.rpg create [name] [job] |
Create character |
.rpg |
View character stats |
.battle |
Fight a random monster |
.dungeon |
Enter a dungeon |
.shop |
Buy items |
.inventory |
View inventory |
.quest |
View & complete quests |
.rest |
Recover HP |
.leaderboard |
Top RPG players |
Available jobs: warrior, mage, archer, assassin
🎮 Games
| Command | Description | Reward |
|---|---|---|
.asahotak |
Brain teaser | +50 balance |
.caklontong |
Cak Lontong riddles | +40 balance |
.tebakkata |
Guess the word | +45 balance |
.tebaklirik |
Guess the lyric | +60 balance |
.tebakbendera |
Guess the flag | +35 balance |
.tebakbenua |
Guess the continent | +35 balance |
.tebakgambar |
Guess the picture | +70 balance |
.bom [max] |
Number bomb | +30~100 balance |
Game answers are replied directly to the question message to reduce spam. Fuzzy matching enabled — typos up to 25% still accepted.
📊 Limit System
- Free users get 20 limit per day
- Limit auto resets daily at 00:00
- Premium & Owner users have unlimited usage
- Plugins that consume limit are marked with
isLimit: true
📝 Changelog
v2.3.0
- 🧠 AI Self-Awareness — AI can now read the bot's own sanitized source code to answer technical questions about the bot
- ⚠️ Centralized Error Handler (
src/error-handler.js) — All plugin errors now send friendly messages to the user and an automatic error report to the owner - 🔒 Sensitive Data Sanitizer (
src/bot-structure.js) — API keys, tokens, and secrets are automatically redacted before being passed to AI - 🖼️ Level-Up Card — Replaced canvacord dependency with a pure SVG card generator (no external dependency needed)
- 🐛 Fix: RPG Inventory — Fixed
inventory.join is not a functionerror caused by inventory format inconsistency (array vs object) - 🗑️ Removed
canvacorddependency
v2.2.0
- RPG system expanded with pets, clan, crafting, farming, fishing, hunting, mining
- Blackjack and Suit multiplayer games added
- Scheduler system added
- AI intent system with command routing
v2.0.2
- Initial public release
📜 License
MIT License — see LICENSE
Made with ❤️ by onepunya