fix: Update version to 2.60.0 and enhance documentation with new commands and troubleshooting tips

This commit is contained in:
2025-11-13 23:34:20 +01:00
parent 67388539b2
commit be826f4d12
6 changed files with 285 additions and 20 deletions

189
README.md
View File

@@ -8,7 +8,7 @@
[![Discord](https://img.shields.io/badge/💬_Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/k5uHkx9mne)
[![GitHub](https://img.shields.io/badge/⭐_Star-yellow?style=for-the-badge&logo=github&logoColor=black)](https://github.com/Obsidian-wtf/Microsoft-Rewards-Bot)
[![Version](https://img.shields.io/badge/v2.56.3-blue?style=for-the-badge)](https://github.com/Obsidian-wtf/Microsoft-Rewards-Bot/releases)
[![Version](https://img.shields.io/badge/v2.60.0-blue?style=for-the-badge)](https://github.com/Obsidian-wtf/Microsoft-Rewards-Bot/releases)
</div>
@@ -61,6 +61,126 @@ npm run setup
**That's it!** The wizard will guide you through account setup and start earning points.
---
## 🎮 Essential Commands
Here are the most useful commands for daily usage:
### **🚀 Main Commands**
| Command | Description |
|---------|-------------|
| `npm run go` | **⭐ Ultimate command** — Installs browser if needed, builds, and starts the bot |
| `npm start` | **Quick start** — Runs the bot (builds automatically if needed) |
| `npm run setup` | **Interactive wizard** — Guides you through initial setup |
| `npm run dev` | **Development mode** — Watch mode with auto-reload |
### **🔧 Build & Maintenance**
| Command | Description |
|---------|-------------|
| `npm run build` | Compile TypeScript to JavaScript (`dist/` folder) |
| `npm run typecheck` | Check TypeScript errors without building |
| `npm run clean` | Remove build artifacts (`dist/` folder) |
| `npm run install:browser` | Install Playwright Chromium (smart: only installs once) |
### **🎯 Specialized Tools**
| Command | Description |
|---------|-------------|
| `npm run dashboard` | Start web dashboard on `http://localhost:3000` |
| `npm run creator` | Launch account creation wizard |
| `npm run test` | Run test suite |
### **💡 Quick Recipes**
```bash
# First time setup
npm run go
# Daily usage (after first setup)
npm start
# Create new accounts
npm run creator -- -y backup@gmail.com https://rewards.bing.com/welcome?rh=CODE
# Monitor with dashboard
npm run dashboard
# Then open http://localhost:3000 in your browser
# Fix issues / rebuild
npm run clean ; npm run build
```
**📖 [Complete Commands Reference →](docs/commands.md)**
---
## 🔄 Typical Workflows
### **First-Time Setup** (New User)
```bash
# 1. Install dependencies
npm install
# 2. Run the ultimate setup command
npm run go
# This will guide you through account setup, install browser, build, and start!
```
### **Daily Usage** (Regular User)
```bash
# Just start the bot - it builds automatically if needed
npm start
```
Or use the ultimate command if you want to be extra safe:
```bash
npm run go
```
### **After Git Pull** (Updating the Bot)
```bash
# Quick method (recommended)
npm run go
# Or manual method
npm install # Update dependencies (if package.json changed)
npm run build # Rebuild if code changed
npm start # Run
```
### **Creating New Accounts**
```bash
# Interactive mode (asks everything)
npm run creator
# Quick mode with recovery email + referral
npm run creator -- -y backup@gmail.com https://rewards.bing.com/welcome?rh=CODE
```
### **Troubleshooting** (When Things Break)
```bash
# Clean rebuild
npm run clean
npm run build
# Or full reset
rm -rf node_modules dist
npm install
npm run go
```
### **Monitoring** (Check Status)
```bash
# Start web dashboard
npm run dashboard
# Then open http://localhost:3000
```
---
### 📖 Need Help?
**First time using the bot?** → [📘 Getting Started Guide](docs/getting-started.md)
@@ -314,6 +434,73 @@ All while maintaining **natural behavior patterns** to minimize detection risk.
---
## 🔧 Common Issues & Quick Fixes
### **"Error: Cannot find module"**
```bash
# Solution: Rebuild the project
npm run clean
npm run build
npm start
```
### **"Browser executable not found"**
```bash
# Solution: Install Chromium browser
npm run install:browser
# Or use the ultimate command
npm run go
```
### **"Account credentials invalid"**
- ✅ Check `src/accounts.jsonc` has correct email/password
- ✅ If 2FA enabled, verify `totp` field has correct secret
- ✅ Test manual login at https://login.live.com/
### **"Bot hangs or freezes"**
```bash
# Windows: Kill stuck Chrome processes
npm run kill-chrome-win
# Then restart
npm start
```
### **"TypeScript compilation errors"**
```bash
# Check errors without building
npm run typecheck
# Full rebuild
npm run clean
npm install
npm run build
```
### **"Chromium keeps reinstalling on every build"**
This is now fixed in v2.60.0! The bot creates a `.playwright-chromium-installed` marker file to prevent unnecessary reinstallations.
If it still happens:
```bash
# Manually create the marker file
touch .playwright-chromium-installed # Mac/Linux
New-Item -Path .playwright-chromium-installed -ItemType File # Windows PowerShell
```
### **"Update system not working"**
```bash
# Manually check for updates
npm run build
# Watch the output for any TypeScript errors
```
### **"Scheduler not running immediately"**
This is fixed in v2.60.0! The bot now runs tasks immediately on startup before activating the schedule.
**[📖 Complete Troubleshooting Guide →](docs/troubleshooting.md)**
---
## 🆘 Need Help?
- 💬 **[Discord Community](https://discord.gg/k5uHkx9mne)** — Get support & updates

View File

@@ -2,6 +2,29 @@
This guide explains all available npm commands and when to use them.
## ⚡ **NEW - Ultimate Command** (v2.60.0)
### `npm run go` ⭐
**THE simplest way to run the bot** - Does EVERYTHING automatically!
```bash
npm install # Install dependencies (first time only)
npm run go # Does EVERYTHING else!
```
**What it does:**
1. ✅ Checks if Chromium browser is installed → Installs if missing
2. ✅ Checks if project is built (`dist/`) → Builds if missing
3. ✅ Starts the bot immediately
**When to use:**
- **First time setup** (after `npm install`)
- **After git pull** (ensures browser + build are ready)
- **Daily use** (simplest command)
- **When unsure** (it checks everything!)
---
## 🚀 Essential Commands
### `npm start`

5
package-lock.json generated
View File

@@ -1,13 +1,12 @@
{
"name": "microsoft-rewards-bot",
"version": "2.56.15",
"version": "2.60.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "microsoft-rewards-bot",
"version": "2.56.15",
"hasInstallScript": true,
"version": "2.60.0",
"license": "CC-BY-NC-SA-4.0",
"dependencies": {
"axios": "^1.8.4",

View File

@@ -1,6 +1,6 @@
{
"name": "microsoft-rewards-bot",
"version": "2.56.15",
"version": "2.60.0",
"description": "Automate Microsoft Rewards points collection",
"private": true,
"main": "index.js",
@@ -16,24 +16,30 @@
},
"homepage": "https://github.com/Obsidian-wtf/Microsoft-Rewards-Bot#readme",
"scripts": {
"go": "node -e \"const fs = require('fs'); const cp = require('child_process'); console.log('🚀 Running complete setup and start...'); if (!fs.existsSync('.playwright-chromium-installed')) { console.log('📦 Installing Chromium...'); cp.execSync('npx playwright install chromium --with-deps', {stdio: 'inherit'}); fs.writeFileSync('.playwright-chromium-installed', new Date().toISOString()); } if (!fs.existsSync('dist/index.js')) { console.log('🔨 Building project...'); cp.execSync('npm run build', {stdio: 'inherit'}); } console.log('✅ Setup complete! Starting bot...'); cp.execSync('npm start', {stdio: 'inherit'});\"",
"clean": "rimraf dist",
"typecheck": "tsc --noEmit",
"install:browser": "node -e \"const fs = require('fs'); if (!fs.existsSync('.playwright-chromium-installed')) { console.log('📦 Installing Chromium browser...'); require('child_process').execSync('npx playwright install chromium --with-deps', {stdio: 'inherit'}); fs.writeFileSync('.playwright-chromium-installed', new Date().toISOString()); } else { console.log('✓ Chromium already installed (use npm run install:browser:force to reinstall)'); }\"",
"install:browser:force": "npx playwright install chromium --with-deps",
"build": "tsc",
"postbuild": "node -e \"console.log('\\n Build complete! Run \\\"npm start\\\" to launch the bot.\\n')\"",
"postinstall": "npm run build",
"prebuild": "node -e \"const fs = require('fs'); if (!fs.existsSync('node_modules/@playwright/browser-chromium') && process.env.SKIP_BROWSER_INSTALL !== '1') { console.log('📦 Installing Chromium browser...'); require('child_process').execSync('npx playwright install chromium --with-deps', {stdio: 'inherit'}); }\"",
"test": "node --test --loader ts-node/esm tests/**/*.test.ts",
"build:clean": "npm run clean && npm run build",
"prestart": "node -e \"const fs = require('fs'); if (!fs.existsSync('dist/index.js')) { console.log('⚠️ Compiled files not found, building...'); require('child_process').execSync('npm run build', {stdio: 'inherit'}); }\"",
"start": "node --enable-source-maps ./dist/index.js",
"dev": "ts-node ./src/index.ts -dev",
"test": "node --test --loader ts-node/esm tests/**/*.test.ts",
"creator": "ts-node ./src/account-creation/cli.ts",
"dashboard": "node --enable-source-maps ./dist/index.js -dashboard",
"dashboard-dev": "ts-node ./src/index.ts -dashboard",
"lint": "eslint \"src/**/*.{ts,tsx}\"",
"dashboard:dev": "ts-node ./src/index.ts -dashboard",
"setup": "node ./scripts/installer/setup.mjs",
"kill-chrome": "node -e \"const { execSync } = require('child_process'); const isWin = process.platform === 'win32'; try { execSync(isWin ? 'taskkill /F /IM chrome.exe 2>nul || exit 0' : 'pkill -f chrome || true', {stdio: 'inherit'}); } catch(e) {}\"",
"update": "node ./scripts/installer/update.mjs",
"lint": "eslint \"src/**/*.{ts,tsx}\"",
"lint:fix": "eslint \"src/**/*.{ts,tsx}\" --fix",
"docker:build": "docker build -f docker/Dockerfile -t microsoft-rewards-bot .",
"docker:run": "docker run -d --name ms-rewards microsoft-rewards-bot",
"docker:compose": "docker compose -f docker/compose.yaml up -d"
"docker:compose": "docker compose -f docker/compose.yaml up -d",
"docker:logs": "docker logs -f ms-rewards",
"docker:stop": "docker stop ms-rewards && docker rm ms-rewards",
"kill:chrome": "node -e \"const { execSync } = require('child_process'); const isWin = process.platform === 'win32'; try { execSync(isWin ? 'taskkill /F /IM chrome.exe 2>nul || exit 0' : 'pkill -f chrome || true', {stdio: 'inherit'}); } catch(e) {}\""
},
"keywords": [
"Bing Rewards",

View File

@@ -571,8 +571,9 @@ async function performUpdate() {
}
process.stdout.write(' ✓\n')
process.stdout.write('🔨 Building project...')
const buildCode = await run('npm', ['run', 'build'], { stdio: 'ignore' })
// FIXED: Show build output to detect TypeScript errors and verify compilation
process.stdout.write('🔨 Building project...\n')
const buildCode = await run('npm', ['run', 'build'], { stdio: 'inherit' })
if (buildCode !== 0) {
// Build failed - rollback
@@ -603,7 +604,7 @@ async function performUpdate() {
process.stdout.write(' ✓\n')
// Step 11: Verify integrity (check if critical files exist)
// Step 11: Verify integrity (check if critical files exist AND were recently updated)
process.stdout.write('🔍 Verifying integrity...')
const criticalPaths = [
'dist/index.js',
@@ -612,11 +613,31 @@ async function performUpdate() {
]
let integrityOk = true
const buildTime = Date.now()
for (const path of criticalPaths) {
if (!existsSync(join(process.cwd(), path))) {
const fullPath = join(process.cwd(), path)
if (!existsSync(fullPath)) {
console.log(`\n ❌ Missing: ${path}`)
integrityOk = false
break
}
// IMPROVED: For compiled files, verify they were recently updated (within last 2 minutes)
if (path.startsWith('dist/')) {
try {
const stats = statSync(fullPath)
const fileAge = buildTime - stats.mtimeMs
if (fileAge > 120000) { // 2 minutes
console.log(`\n ⚠️ ${path} not recently updated (${Math.round(fileAge / 1000)}s old)`)
integrityOk = false
break
}
} catch {
integrityOk = false
break
}
}
}
if (!integrityOk) {

View File

@@ -13,6 +13,7 @@ interface ErrorReportPayload {
arch: string
nodeVersion: string
timestamp: string
botMode?: string // DESKTOP, MOBILE, or MAIN
}
}
@@ -173,7 +174,9 @@ export async function sendErrorReport(
platform: process.platform,
arch: process.arch,
nodeVersion: process.version,
timestamp: new Date().toISOString()
timestamp: new Date().toISOString(),
// IMPROVED: Extract bot mode from additionalContext before sanitization
botMode: (additionalContext?.platform as string) || 'UNKNOWN'
}
}
@@ -190,6 +193,27 @@ export async function sendErrorReport(
Object.assign(payload.context, sanitizedContext)
}
// Detect Docker environment
const isDockerEnv = (() => {
try {
return fs.existsSync('/.dockerenv') ||
(fs.existsSync('/proc/1/cgroup') && fs.readFileSync('/proc/1/cgroup', 'utf8').includes('docker'))
} catch {
return false
}
})()
// Format OS platform display
const osPlatform = (() => {
if (isDockerEnv) return '🐳 Docker'
switch (payload.context.platform) {
case 'win32': return '🪟 Windows'
case 'darwin': return '🍎 macOS'
case 'linux': return '🐧 Linux'
default: return payload.context.platform
}
})()
// Build Discord embed with improved formatting
const embed = {
title: '🐛 Automatic Error Report',
@@ -202,8 +226,13 @@ export async function sendErrorReport(
inline: true
},
{
name: '💻 Platform',
value: `${payload.context.platform} ${payload.context.arch}`,
name: '🤖 Bot Mode',
value: payload.context.botMode || 'UNKNOWN',
inline: true
},
{
name: '💻 OS Platform',
value: `${osPlatform} ${payload.context.arch}`,
inline: true
},
{