-
Notifications
You must be signed in to change notification settings - Fork 7
Home
Hridoy edited this page Nov 11, 2024
·
1 revision
Welcome to the Nexalo wiki! This page provides comprehensive information about setting up, configuring, and using the Nexalo Telegram bot.
- Features
- Prerequisites
- Installation
- Configuration
- Command Structure
- Creating Commands
- Database Setup
- Contributing
- License
- Support
- 🛡️ Advanced group moderation (kick, ban, mute, warn)
- 🎵 Music and video downloads
- 🎮 Fun commands and games
- 🔧 Utility functions
- 📊 MongoDB integration for data persistence
- ⚡ Fast and efficient command handling
- Node.js v16.x or higher
- MongoDB v4.x or higher
- A Telegram Bot Token (get it from @BotFather)
- Basic knowledge of JavaScript/Node.js
- Clone the repository:
git clone https://github.com/1dev-hridoy/Nexalo.git cd nexalo
- Install dependencies:
npm install
- Rename example.env to .env in the root directory and fill in your details:
BOT_TOKEN=YOUR_BOT_TOKEN OWNER_ID=OWNER_ID_HERE ADMIN_IDS=comma_separated_admin_ids MONGODB_URI=YOUR_MONGODB_URI
- Start the bot:
npm start
The bot uses environment variables for configuration. Create a .env file with the following variables:
- BOT_TOKEN: Your Telegram bot token
- MONGODB_URI: MongoDB connection string
- OWNER_ID: Your Telegram user ID (for owner-only commands)
Commands should be created in the commands directory with the following structure:
module.exports = {
name: 'commandname',
adminOnly: false,
ownerOnly: false,
category: 'Category',
description: 'Command description',
guide: 'How to use the command',
execute: async (bot, msg, args) => {
// Command logic here
}
};
- name: Command name (without the / prefix)
- adminOnly: Whether the command requires admin privileges
- ownerOnly: Whether the command is restricted to bot owner
- category: Command category for help menu organization
- description: Brief description of what the command does
- guide: Usage instructions
- execute: Async function containing command logic
Here's a step-by-step guide to creating new commands:
- Create a new file in the commands directory:
// commands/hello.js module.exports = { name: 'hello', adminOnly: false, ownerOnly: false, category: 'Fun', description: 'Sends a greeting', guide: 'Use /hello to receive a greeting', execute: async (bot, msg, args) => { await bot.sendMessage(msg.chat.id, 'Hello! 👋'); } };
- The command will be automatically loaded by the bot.
Here's an example of a more complex command with argument handling and error checking:
// commands/remind.js
module.exports = {
name: 'remind',
adminOnly: false,
ownerOnly: false,
category: 'Utility',
description: 'Set a reminder',
guide: 'Use /remind <time> <message>',
execute: async (bot, msg, args) => {
if (args.length < 2) {
return bot.sendMessage(msg.chat.id, 'Please provide time and message');
}
const time = parseInt(args[0]);
const message = args.slice(1).join(' ');
if (isNaN(time)) {
return bot.sendMessage(msg.chat.id, 'Please provide a valid time in minutes');
}
setTimeout(() => {
bot.sendMessage(msg.chat.id, `Reminder: ${message}`);
}, time * 60000);
await bot.sendMessage(msg.chat.id, `Reminder set for ${time} minutes from now`);
}
};
The bot uses MongoDB for data persistence. Here's how to set up your database:
- Create a MongoDB database
- Set up collections:
- warnings: Store user warnings
- settings: Store group settings
- userdata: Store user-specific data
Warnings Collection:
{
userId: String,
username: String,
chatId: String,
reason: String,
timestamp: Date
}
Settings Collection:
{
chatId: String,
welcomeMessage: String,
antiSpam: Boolean,
maxWarnings: Number
}
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a pull request
- Use ES6+ features
- Maintain consistent error handling
- Add comments for complex logic
- Follow the existing command structure
- Test thoroughly before submitting
This project is licensed under the MIT License - see the LICENSE file for details.
If you need help or have questions:
- Open an issue on GitHub
- Contact the bot owner through Telegram
- Check the Wiki for additional documentation
Platform | Contact |
---|---|
Discord | Eliana Support Server |
Telegram | BD_NOOBRA |
HridoyCode | |
YouTube | Hridoy Code |
Made with ❤️ by Hridoy