Click thumbnail to watch full tutorial.
name: Node.js CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
# Step to check out the repository code
- uses: actions/checkout@v2
# Step to set up the specified Node.js version
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
# Step to install dependencies
- name: Install dependencies
run: npm install
# Step to run the bot with the correct port
- name: Start the bot
env:
PORT: 8080
run: npm start
·
This repository is a custom fork of the original miraiv2 framework.
I do NOT claim ownership of the original project.
All original rights and credits go to the original developer:
https://github.com/m1raibot/miraiv2.git
This project is shared strictly for educational and personal use only.
🚫 I am not responsible for any misuse, account bans, platform restrictions,
or violations of rules, policies, or terms of service.
Feature Description Status 🤖 Automated Messaging Send automated responses ✅ 📁 File Handling Support for various file types ✅ ⚡ Fast Performance Optimized Node.js runtime ✅ 🔒 Secure AppState authentication ✅ 📊 Logging Detailed activity logs ✅ 🔧 Customizable Easy to modify and extend ✅ 🌐 Multi-platform Works on various systems ✅
Prerequisites
· Node.js (v16 or higher) · Git · Facebook Developer Account (for testing)
Step-by-Step Installation
# 1. Clone the repository
git clone https://github.com/XrahatX/Xrahat.git
# 2. Navigate to project directory
cd Xrahat-Mirai
# 3. Install dependencies
npm install
# 4. Install additional packages if needed
npm install chalk fs-extra axios- AppState Setup
// Create appstate.json in root directory
{
"cookies": [
// Your Facebook cookies here (for educational purposes only)
]
}- Environment Variables
Create a .env file:
PORT=3000
NODE_ENV=development
PREFIX=!
ADMIN_ID=your_facebook_id
AUTO_REPLY=true- Bot Configuration
Edit config.json:
{
"autoReply": true,
"listenEvents": true,
"selfListen": false,
"online": true,
"markRead": true,
"logMessageEvents": false
}Starting the Bot
# Development mode
npm run dev
# Production mode
npm start
# With debugging
DEBUG=* node Xrahat.js!help - Show all commands
!info - Bot information
!ping - Check bot status
!admin - Admin commands
!uptime - Check bot uptime
!version - Show bot version
Xrahat-Mirai/
├── Xrahat.js # Main bot file
├── package.json # Dependencies
├── config.json # Configuration
├── appstate.json # Authentication
├── commands/ # Command modules
├── events/ # Event handlers
├── utils/ # Utility functions
├── plugins/ # Additional plugins
└── README.md # Documentation
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 3000
CMD ["node", "Xrahat.js"]# Install PM2 globally
npm install -g pm2
# Start bot with PM2
pm2 start Xrahat.js --name "rahat-bot"
# Save process list
pm2 save
# Set up startup script
pm2 startup
# Monitor logs
pm2 logs rahat-botQ1: Is this bot safe to use?
A: Only in controlled, educational environments. Never use on production accounts.
Q2: Will my account get banned?
A: Using automation tools violates Facebook's ToS. Use at your own risk with test accounts only.
Q3: How to get appstate?
A: Use browser developer tools to extract cookies from a Facebook session (for educational purposes only).
Q4: Can I add custom commands?
A: Yes! Create new files in the commands/ directory following existing patterns.
Q5: Error: Cannot find module
A: Run npm install to ensure all dependencies are installed.
Q6: How to update the bot?
A: Pull latest changes and run npm install again.
We welcome ethical contributions for educational purposes:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Contribution Guidelines
· Add clear comments · Update documentation · Follow existing code style · Include tests if applicable · Respect privacy and security
This project is licensed under the MIT License - see the LICENSE file.
Resource Link 📚 Documentation GitHub Wiki 🐛 Issue Tracker GitHub Issues 💬 Discussion Facebook Group 📢 Updates Follow on GitHub
Connect with Developer
· Facebook: Rahat Islam · GitHub: @XrahatX
· Rx Abdullah - For guidance and support · Open Source Community - For inspiration · All Contributors - For educational improvements
https://img.shields.io/github/stars/XrahatX/Xrahat?style=for-the-badge https://img.shields.io/github/forks/XrahatX/Xrahat?style=for-the-badge https://img.shields.io/github/issues/XrahatX/Xrahat?style=for-the-badge https://img.shields.io/github/license/XrahatX/Xrahat?style=for-the-badge
```
{
"name": "xrahat-mirai",
"version": "1.0.0",
"description": "Facebook Messenger Bot for educational purposes",
"main": "Xrahat.js",
"scripts": {
"start": "node Xrahat.js",
"dev": "nodemon Xrahat.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"messenger",
"bot",
"facebook",
"automation",
"educational"
],
"author": "Rahat Islam",
"license": "MIT",
"dependencies": {
"axios": "^1.6.0",
"chalk": "^4.1.2",
"facebook-chat-api": "github:Schmavery/facebook-chat-api",
"fs-extra": "^11.1.1",
"moment": "^2.29.4",
"node-cron": "^3.0.3"
},
"devDependencies": {
"nodemon": "^3.0.1"
}
}{
"prefix": "!",
"admin": "100000000000000",
"autoReply": true,
"autoMarkRead": true,
"listenEvents": true,
"selfListen": false,
"logLevel": "info",
"online": true
}node_modules/
appstate.json
.env
*.log
.DS_Store
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.vscode/
.idea/
MIT License
Copyright (c) 2026 XrahatX
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- Create a new GitHub repository
- Copy each section above separately
- Create corresponding files in your repository
- Paste the content into each file
- Commit and push to GitHub
Files to create:
· README.md (copy the main README content) · package.json · config.json · .gitignore · LICENSE · .github/workflows/node.js.yml
Note: Remember to replace placeholder links and IDs with your actual information.

