1. Core Architecture
Pranata Kernel is built on top of @whiskeysockets/baileys. Unlike typical bots, it uses
ES Modules (ESM) for dynamic loading.
The kernel is strictly separated from logic. It loads files from the /modules directory at runtime.
This structure prevents a single command error from crashing the entire process and enables
hot-reloading without restarting the Node process.
2. Basic Module Structure
To ensure your contribution works, follow this structure. Files must be valid ES Modules.
| Path | Description |
|---|---|
/modules |
Folder containing all command logic files (e.g., ping.js, stickers.js). |
/auth_info |
Baileys MultiFileAuthState storage (do not touch). |
3. Command Categories
Commands are grouped by the category property in the module object.
🎐 Core
Essential commands for bot functionality.
⚖️ Group Admin
Tools for managing groups and administration.
🎲 Games & Fun
Entertainment and game-related commands.
🔭 Utility
Helpful utilities and tools.
🛡️ Security
Security features and protections.
👑 Owner
Privileged commands for bot owners.
4. Example Command Module
Create a file in /modules/mycommand.js.
Important: You must use export default.
// modules/ping.js
export default {
name: "ping",
alias: ["p", "tes"] // Optional aliases
category: "Utility",
description: "Replies with Pong!",
// RECEIVE 'send' function here
execute: async ({ send, remoteJid, msg }) => {
// USE 'send' instead of sock.sendMessage
await send(remoteJid, { text: "Pong!" }, { quoted: msg });
}
};
5. execute() Context Parameters
The kernel passes a single object containing these properties to your execute function:
| Parameter | Description |
|---|---|
sock |
The raw Baileys socket instance. Use this for low-level actions. |
send |
Recommended. A wrapper function that automatically appends the "ꦥꦿꦤꦠ ꦮꦶꦕꦏ꧀ꦱꦤ" watermark to text messages. |
msg |
The raw message object (contains key, message content, etc). |
remoteJid |
The ID of the chat where the command was sent (User ID or Group ID). |
participant |
The ID of the user who sent the command. |
args |
Array of strings (command arguments). E.g., !kick @user -> ['@user']. |
commands |
A Map of all loaded commands (useful for help menus or executing other commands). |
text |
The full raw text of the message (excluding the prefix). |
6. Message Handlers (Listeners)
Handlers run on every message, regardless of prefix. They are used for anti-spam, auto-reply,
or logging. Set isMessageHandler: true.
// modules/logger.js
export default {
name: "logger",
isMessageHandler: true, // Mark this as a listener
async execute({ text, participant, isGroup }) {
if (!text) return;
console.log(`[MSG] From: ${participant} | Group: ${isGroup}`);
console.log(`Content: ${text}`);
}
};
Note: Handlers receive an extra parameter
fromListener: truein the context object.
7. Hot Reloading
Pranata Kernel supports live reloading. You do not need to restart the bot when editing files in
/modules.
Reload Modul Without Restart:
global.reloadCommands();
Can be called from the admin command, REPL, or debug mode.
8. Closing Notes
By strictly adhering to the module system, you ensure that the core kernel remains clean and upgradeable.
Ensure your filename ends in
.jsand is placed directly in the/modulesfolder.