Simplicity WhatsApp Bot (Baileys)
Simplicity WhatsApp Bot is a lightweight and easy-to-use bot built using the Baileys library for WhatsApp. This bot allows you to interact with users on WhatsApp and respond to commands seamlessly.
Features
- Respond to user messages
- Support for multiple command prefixes
- Easy to extend with plugins
- Lightweight and efficient
Event Message Structure
The bot listens for incoming messages and processes them. Below is an example of the event message structure that the bot handles:
{
m: {
key: {
remoteJid: '628888375863@s.whatsapp.net',
fromMe: false,
id: 'NXN5E1FB9C33178CD11673178C46CA1E',
participant: undefined
},
messageTimestamp: 1689557472,
pushName: 'Kens Ransyah',
broadcast: false,
message: Message {
extendedTextMessage: [ExtendedTextMessage],
messageContextInfo: [MessageContextInfo]
},
id: 'NXN5E1FB9C33178CD11673178C46CA1E',
isBot: false,
chat: '628888375863@s.whatsapp.net',
fromMe: false,
isGroup: false,
sender: '628888375863@s.whatsapp.net',
mtype: 'extendedTextMessage',
msg: ExtendedTextMessage {
text: '.menu',
previewType: 0,
contextInfo: [ContextInfo],
inviteLinkGroupTypeV2: 0
},
quoted: null,
mentionedJid: [],
reply: [Function(anonymous)],
text: '.menu'
},
body: '.menu',
prefix: '.',
plugins: [],
commands: [],
args: [],
command: 'menu',
text: '',
prefixes: ['.', '#', '!', '/']
}
Explanation of the Structure
m: Contains the message metadata and content.
key: Unique identifier for the message.
- remoteJid: The WhatsApp ID of the sender.
- fromMe: Indicates if the message is sent by the bot.
- id: Unique ID of the message.
- participant: The participant in a group chat (if applicable).
- messageTimestamp: Timestamp of when the message was sent.
- pushName: The display name of the sender.
- broadcast: Indicates if the message is a broadcast.
- message: Contains the actual message content.
- extendedTextMessage: The type of message (in this case, extended text).
- id: Duplicate of the message ID.
- isBot: Indicates if the sender is a bot.
- chat: The chat ID where the message was sent.
- fromMe: Indicates if the message was sent by the bot.
- isGroup: Indicates if the message was sent in a group.
- sender: The sender's WhatsApp ID.
- mtype: The type of message (e.g., extended text).
- msg: The message object containing the text and other properties.
- quoted: Any quoted message (if applicable).
- mentionedJid: List of mentioned users in the message.
- reply: Function to reply to the message.
- text: The text content of the message.
body: The raw text of the message.
prefix: The command prefix used (e.g., .).
plugins: List of plugins used in the bot.
commands: List of commands available.
args: Arguments passed with the command.
command: The command that was executed (e.g., menu).
text: Additional text (if any).
prefixes: List of supported command prefixes.
Getting Started
To get started with the Simplicity WhatsApp Bot, follow these steps:
- Clone the repository:
git clone https://github.com/KensBot/nexon-bot.git
- Navigate to the project directory:
cd nexon-bot
- Install the required dependencies:
npm install
Configure your WhatsApp credentials and settings.
Run the bot
npm start
Contributing
Contributions are welcome! If you have suggestions or improvements, feel free to open an issue or submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Support
For support, please open an issue on the GitHub repository or contact the maintainer directly. Your feedback is valuable and helps improve the bot.
Acknowledgments
Thanks to the Baileys library for providing a robust framework for building WhatsApp bots. Special thanks to the open-source community for their contributions and support.