{"id":19242304,"url":"https://github.com/1dev-hridoy/nexalo","last_synced_at":"2025-04-11T06:08:36.654Z","repository":{"id":261836251,"uuid":"885488655","full_name":"1dev-hridoy/Nexalo","owner":"1dev-hridoy","description":"A powerful Node.js Telegram bot offering advanced moderation, fun commands, music downloads, and MongoDB integration for data persistence.","archived":false,"fork":false,"pushed_at":"2024-12-01T09:19:04.000Z","size":2020,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-01T09:30:55.501Z","etag":null,"topics":["api","automation","chatbot","communitysupport","customcommands","database","devtools","funcommands","javascript","mitlicense","moderation","mongodb","musicbot","nodejs","opensource","telegrambot","tgbot","utilities"],"latest_commit_sha":null,"homepage":"https://t.me/NexaloBot","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1dev-hridoy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-08T17:23:15.000Z","updated_at":"2024-12-01T09:12:41.000Z","dependencies_parsed_at":"2024-12-02T01:16:12.213Z","dependency_job_id":null,"html_url":"https://github.com/1dev-hridoy/Nexalo","commit_stats":null,"previous_names":["1dev-hridoy/nexalo"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1dev-hridoy%2FNexalo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1dev-hridoy%2FNexalo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1dev-hridoy%2FNexalo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1dev-hridoy%2FNexalo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1dev-hridoy","download_url":"https://codeload.github.com/1dev-hridoy/Nexalo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232544043,"owners_count":18539439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","automation","chatbot","communitysupport","customcommands","database","devtools","funcommands","javascript","mitlicense","moderation","mongodb","musicbot","nodejs","opensource","telegrambot","tgbot","utilities"],"created_at":"2024-11-09T17:13:54.781Z","updated_at":"2025-01-05T03:25:25.317Z","avatar_url":"https://github.com/1dev-hridoy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿\u003cimg src=\"https://i.ibb.co.com/gDF63b8/nexalo.jpg\" alt=\"Nexalo Bot Banner\"\u003e\r\n\r\n\u003ccenter\u003e\u003ch1\u003eNexalo - Advanced Telegram Bot\u003c/h1\u003e\u003c/center\u003e\r\n\u003cp align=\"center\"\u003e\r\n\u003cimg src=\"https://img.shields.io/badge/Node.js%20Support-20.x-blue\" alt=\"Node.js Support\"\u003e\r\n\u003cimg src=\"https://img.shields.io/badge/project_version-7ZHV92MN4L-red\" alt=\"Project Version\"\u003e\r\n\u003cimg src=\"https://img.shields.io/badge/code_version-1.0.0-yeelow\" alt=\"Code Version\"\u003e\r\n\u003cimg src=\"https://img.shields.io/badge/license-MIT-gray\" alt=\"MIT LICENSE\"\u003e\r\n\u003c/p\u003e\r\n\r\nA feature-rich Telegram bot built with Node.js that provides various utility, moderation, and entertainment commands.\r\n\r\n\u003cp align=\"center\"\u003e\r\n  \u003ca href=\"https://www.youtube.com/@bdnoobra\" target=\"_blank\"\u003e\r\n    \u003cimg src=\"https://i.ibb.co.com/LntSL4y/20241109-124517.png\" alt=\"Nexalo Setup Tutorial\" style=\"width:300px; height:80px; border-radius:10px;\"\u003e\r\n  \u003c/a\u003e\r\n    \u003ca href=\"https://cmd.nexalo.xyz/\" target=\"_blank\"\u003e\r\n    \u003cimg src=\"https://i.ibb.co.com/DbzLFsN/20241109-124743.png\" alt=\"Nexalo Setup Tutorial\" style=\"width:300px; height:80px; border-radius:10px;\"\u003e\r\n  \u003c/a\u003e\r\n    \u003ca href=\"https://t.me/nexalo\" target=\"_blank\"\u003e\r\n    \u003cimg src=\"https://i.ibb.co.com/YL5C4YX/20241109-124634.png\" alt=\"Nexalo Setup Tutorial\" style=\"width:300px; height:80px; border-radius:10px;\"\u003e\r\n  \u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\n## Table of Contents\r\n- [Features](#features)\r\n- [Prerequisites](#prerequisites)\r\n- [Installation](#installation)\r\n- [Configuration](#configuration)\r\n- [Command Structure](#command-structure)\r\n- [Creating Commands](#creating-commands)\r\n- [Available Commands](#available-commands)\r\n- [Database Setup](#database-setup)\r\n- [Contributing](#contributing)\r\n- [License](#license)\r\n\r\n## Features\r\n\r\n- 🛡️ Advanced group moderation (kick, ban, mute, warn)\r\n- 🎵 Music and video downloads\r\n- 🎮 Fun commands and games\r\n- 🔧 Utility functions\r\n- 📊 MongoDB integration for data persistence\r\n- ⚡ Fast and efficient command handling\r\n\r\n## Prerequisites\r\n\r\n- Node.js v16.x or higher\r\n- MongoDB v4.x or higher\r\n- A Telegram Bot Token (get it from [@BotFather](https://t.me/BotFather))\r\n- Basic knowledge of JavaScript/Node.js\r\n\r\n## Installation\r\n\r\n1. Clone the repository:\r\n```bash\r\ngit clone https://github.com/1dev-hridoy/Nexalo.git\r\ncd nexalo\r\n```\r\n\r\n2. Install dependencies:\r\n```bash\r\nnpm install\r\n```\r\n\r\n3. Rename a `example.env` To `.env` file in the root directory:\r\n```env\r\nBOT_TOKEN=YOUR_BOT_TOKEN\r\nOWNER_ID=OWNER_ID_HERE\r\nADMIN_IDS=comma_separated_admin_ids\r\nMONGODB_URI=YOUR_MONGODB_URI\r\n```\r\n\r\n4. Start the bot:\r\n```bash\r\nnpm start\r\n```\r\n\r\n## Configuration\r\n\r\nThe bot uses environment variables for configuration. Create a `.env` file with the following variables:\r\n\r\n- `BOT_TOKEN`: Your Telegram bot token\r\n- `MONGODB_URI`: MongoDB connection string\r\n- `OWNER_ID`: Your Telegram user ID (for owner-only commands)\r\n\r\n## Command Structure\r\n\r\nCommands should be created in the `commands` directory with the following structure:\r\n\r\n```javascript\r\nmodule.exports = {\r\n  name: 'commandname',\r\n  adminOnly: false,\r\n  ownerOnly: false,\r\n  category: 'Category',\r\n  description: 'Command description',\r\n  guide: 'How to use the command',\r\n  execute: async (bot, msg, args) =\u003e {\r\n    // Command logic here\r\n  }\r\n};\r\n```\r\n\r\n### Command Properties\r\n\r\n- `name`: Command name (without the / prefix)\r\n- `adminOnly`: Whether the command requires admin privileges\r\n- `ownerOnly`: Whether the command is restricted to bot owner\r\n- `category`: Command category for help menu organization\r\n- `description`: Brief description of what the command does\r\n- `guide`: Usage instructions\r\n- `execute`: Async function containing command logic\r\n\r\n## Creating Commands\r\n\r\nHere's a step-by-step guide to creating new commands:\r\n\r\n1. Create a new file in the `commands` directory:\r\n```javascript\r\n// commands/hello.js\r\nmodule.exports = {\r\n  name: 'hello',\r\n  adminOnly: false,\r\n  ownerOnly: false,\r\n  category: 'Fun',\r\n  description: 'Sends a greeting',\r\n  guide: 'Use /hello to receive a greeting',\r\n  execute: async (bot, msg, args) =\u003e {\r\n    await bot.sendMessage(msg.chat.id, 'Hello! 👋');\r\n  }\r\n};\r\n```\r\n\r\n2. The command will be automatically loaded by the bot.\r\n\r\n### Advanced Command Example\r\n\r\nHere's an example of a more complex command with argument handling and error checking:\r\n\r\n```javascript\r\n// commands/remind.js\r\nmodule.exports = {\r\n  name: 'remind',\r\n  adminOnly: false,\r\n  ownerOnly: false,\r\n  category: 'Utility',\r\n  description: 'Set a reminder',\r\n  guide: 'Use /remind \u003ctime\u003e \u003cmessage\u003e',\r\n  execute: async (bot, msg, args) =\u003e {\r\n    if (args.length \u003c 2) {\r\n      return bot.sendMessage(msg.chat.id, 'Please provide time and message');\r\n    }\r\n\r\n    const time = parseInt(args[0]);\r\n    const message = args.slice(1).join(' ');\r\n\r\n    if (isNaN(time)) {\r\n      return bot.sendMessage(msg.chat.id, 'Please provide a valid time in minutes');\r\n    }\r\n\r\n    setTimeout(() =\u003e {\r\n      bot.sendMessage(msg.chat.id, `Reminder: ${message}`);\r\n    }, time * 60000);\r\n\r\n    await bot.sendMessage(msg.chat.id, `Reminder set for ${time} minutes from now`);\r\n  }\r\n};\r\n```\r\n\r\n\r\n## Database Setup\r\n\r\nThe bot uses MongoDB for data persistence. Here's how to set up your database:\r\n\r\n1. Create a MongoDB database\r\n2. Set up collections:\r\n   - `warnings`: Store user warnings\r\n   - `settings`: Store group settings\r\n   - `userdata`: Store user-specific data\r\n\r\n### Database Schema Examples\r\n\r\nWarnings Collection:\r\n```javascript\r\n{\r\n  userId: String,\r\n  username: String,\r\n  chatId: String,\r\n  reason: String,\r\n  timestamp: Date\r\n}\r\n```\r\n\r\nSettings Collection:\r\n```javascript\r\n{\r\n  chatId: String,\r\n  welcomeMessage: String,\r\n  antiSpam: Boolean,\r\n  maxWarnings: Number\r\n}\r\n```\r\n\r\n## Mongo DB Add Balance To User Account \r\n\r\n```javascript \r\nconst { ObjectId } = require('mongodb');\r\n\r\nmodule.exports = {\r\n  name: 'addCoins',\r\n  adminOnly: false, // Set to true if only admins should use this command\r\n  ownerOnly: false, // Set to true if only the bot owner should use this command\r\n  category: 'Economy',\r\n  description: 'Add coins to a user\\'s balance',\r\n  guide: 'Use /addCoins to add coins to your account',\r\n  execute: async (bot, msg, args, db) =\u003e {\r\n    const userId = msg.from.id;\r\n    const chatId = msg.chat.id;\r\n    const coinAmount = 10; // Amount to add\r\n\r\n    try {\r\n      const user = await db.collection('users').findOne({ userId });\r\n\r\n      if (user) {\r\n        await db.collection('users').updateOne(\r\n          { userId },\r\n          { $inc: { balance: coinAmount } }\r\n        );\r\n      } else {\r\n        await db.collection('users').insertOne({\r\n          userId,\r\n          balance: coinAmount,\r\n          lastDaily: new Date(0) // Initialize lastDaily if not needed immediately\r\n        });\r\n      }\r\n\r\n      bot.sendMessage(chatId, `10 coins have been added to your balance!`);\r\n    } catch (error) {\r\n      console.error('Error in addCoins command:', error);\r\n      bot.sendMessage(chatId, 'An error occurred while processing your request.');\r\n    }\r\n  }\r\n};\r\n\r\n\r\n```\r\n\r\n## Use User Account Balance/Coin\r\n\r\n```javascript\r\nconst { ObjectId } = require('mongodb');\r\n\r\nmodule.exports = {\r\n  name: 'usecoin',\r\n  adminOnly: false,\r\n  ownerOnly: false,\r\n  category: 'Economy',\r\n  description: 'Use 10 coins for a special action!',\r\n  guide: 'Use /usecoin to spend 10 coins on an action',\r\n  execute: async (bot, msg, args, db) =\u003e {\r\n    const userId = msg.from.id;\r\n    const chatId = msg.chat.id;\r\n    const coinCost = 10; // Cost of the action in coins\r\n\r\n    try {\r\n      // Check user balance\r\n      const user = await db.collection('users').findOne({ userId });\r\n      if (!user || user.balance \u003c coinCost) {\r\n        return bot.sendMessage(chatId, `Insufficient balance. You need at least ${coinCost} coins to perform this action.`);\r\n      }\r\n\r\n      // Perform the action (e.g., sending a confirmation message)\r\n      await bot.sendMessage(chatId, 'You have successfully used 10 coins for this special action!');\r\n\r\n      // Deduct 10 coins from user's balance\r\n      await db.collection('users').updateOne(\r\n        { userId },\r\n        { $inc: { balance: -coinCost } }\r\n      );\r\n\r\n      bot.sendMessage(chatId, `${coinCost} coins have been deducted from your account.`);\r\n    } catch (error) {\r\n      console.error('Error in usecoin command:', error);\r\n      bot.sendMessage(chatId, 'An error occurred while processing your request. Please try again later.');\r\n    }\r\n  }\r\n};\r\n\r\n\r\n```\r\n\r\n## Contributing\r\n\r\n1. Fork the repository\r\n2. Submit a pull request\r\n\r\n\r\n### Coding Standards\r\n\r\n- Use ES6+ features\r\n- Maintain consistent error handling\r\n- Add comments for complex logic\r\n- Follow the existing command structure\r\n- Test thoroughly before submitting\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## Support\r\n\r\nIf you need help or have questions:\r\n- Open an issue on GitHub\r\n- Contact the bot owner through Telegram\r\n- Check the [Wiki](#) for additional documentation\r\n\r\n---\r\n\r\n## Contact Options \r\n  \u003ctable border=\"1\" cellpadding=\"10\" cellspacing=\"0\"\u003e\r\n    \u003ctr\u003e\r\n      \u003cth\u003eDiscord\u003c/th\u003e\r\n      \u003cth\u003eTelegram\u003c/th\u003e\r\n      \u003cth\u003eInstagram\u003c/th\u003e\r\n      \u003cth\u003eYouTube\u003c/th\u003e\r\n    \u003c/tr\u003e\r\n    \u003ctr\u003e\r\n      \u003ctd align=\"center\"\u003e\r\n        \u003cimg src=\"https://github.com/user-attachments/assets/6b381b30-861d-4a3c-859a-367da4956347\" alt=\"Facebook QR\" width=\"150\"\u003e\u003cbr\u003e\r\n        \u003ca href=\"https://discord.gg/yfBx5GU9Xr\"\u003eEliana Support Server\u003c/a\u003e\r\n      \u003c/td\u003e\r\n      \u003ctd align=\"center\"\u003e\r\n        \u003cimg src=\"https://github.com/user-attachments/assets/0bd6fcf3-332b-400b-8edf-0aa613c2d7bc\" alt=\"Telegram QR\" width=\"150\"\u003e\u003cbr\u003e\r\n        \u003ca href=\"https://t.me/BD_NOOBRA\"\u003eBD_NOOBRA\u003c/a\u003e\r\n      \u003c/td\u003e\r\n      \u003ctd align=\"center\"\u003e\r\n        \u003cimg src=\"https://github.com/user-attachments/assets/727d205c-3f31-494b-ba2e-a594122d2b20\" alt=\"Twitter QR\" width=\"150\"\u003e\u003cbr\u003e\r\n        \u003ca href=\"https://www.instagram.com/hridoycode/\"\u003eHridoyCode\u003c/a\u003e\r\n      \u003c/td\u003e\r\n      \u003ctd align=\"center\"\u003e\r\n        \u003cimg src=\"https://github.com/user-attachments/assets/f9dedbbb-606c-4ab5-b67b-73ab2f640ebb\" alt=\"YouTube QR\" width=\"150\"\u003e\u003cbr\u003e\r\n        \u003ca href=\"https://www.youtube.com/@hridoy-code\"\u003eHridoy Code\u003c/a\u003e\r\n      \u003c/td\u003e\r\n    \u003c/tr\u003e\r\n  \u003c/table\u003e\r\n\r\nMade with ❤️ by Hridoy\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1dev-hridoy%2Fnexalo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1dev-hridoy%2Fnexalo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1dev-hridoy%2Fnexalo/lists"}