Skip to content

OVL-MD-V2, développé par Ainz, est un bot WhatsApp multi-device performant, offrant de nombreuses fonctionnalités.

License

Notifications You must be signed in to change notification settings

Ainz-devs/OVL-MD-V2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OVL-MD-V2

OVL

Un bot WhatsApp multi-appareil. N'oubliez pas de laisser une ⭐ (star) pour le projet.

MIT License Using Baileys Web API Stars Forks


🚀 Déploiement de OVL-MD-V2

🧬 Étape 1 : Fork du dépôt GitHub

Fork GitHub


🔐 Étape 2 : Générer une SESSION ID

📌 Conserve la Session-ID dans un endroit sécurisé.

Obtenir SESSION-ID


🗄️ Étape 3 : Créer une base de données (au besoin)

Créer Base de Données

Ou utilise une base de données existante.

🚀 Étape 4 : Méthodes de déploiement

  • Créez un serveur
  • Ajoutez le fichier index.js ou main.js
  • Démarrez le bot

  • Ajoutez un fichier .env
  • Créez le fichier .github/workflows/deploy.yml

📝 Fichier index.js ou main.js pour déploiement sur panel
const { spawnSync, spawn } = require('child_process');
const { existsSync, mkdirSync, writeFileSync } = require('fs');

// Ajoutez ici vos variables d'environnement
const env_file = ``;

if (!env_file.trim()) {
  console.error("❌ 'env_file' est vide. Veuillez renseigner vos variables d'environnement avant de lancer le script.");
  process.exit(1);
}

let crashCount = 0;
const crashLimit = 5;
let lastCrashTime = Date.now();
const crashResetDelay = 30000;

function setupProject() {
  if (!existsSync('ovl')) {
    const clone = spawnSync('git', ['clone', 'https://github.com/Ainz-devs/OVL-MD-V2', 'ovl'], { stdio: 'inherit' });
    if (clone.status !== 0) process.exit(1);
  }

  if (!existsSync('ovl/.env')) {
    mkdirSync('ovl', { recursive: true });
    writeFileSync('ovl/.env', env_file);
    console.log("✅ Fichier .env créé avec succès.");
  }

  const install = spawnSync('npm', ['install'], { cwd: 'ovl', stdio: 'inherit' });
  if (install.status !== 0) process.exit(1);
}

function validateSetup() {
  if (!existsSync('ovl/package.json')) {
    process.exit(1);
  }

  const check = spawnSync('npm', ['ls'], { cwd: 'ovl', stdio: 'ignore' });

  if (check.status !== 0) {
    const reinstall = spawnSync('npm', ['install'], { cwd: 'ovl', stdio: 'inherit' });
    if (reinstall.status !== 0) {
      process.exit(1);
    }
  }
}

function launchApp() {
  const pm2 = spawn('npx', ['pm2', 'start', 'Ovl.js', '--name', 'ovl-md', '--attach'], {
    cwd: 'ovl',
    stdio: ['pipe', 'pipe', 'pipe'],
  });

  let restartAttempts = 0;

  pm2.stdout?.on('data', (chunk) => {
    const output = chunk.toString();
    console.log(output);
    if (output.includes('Connexion') || output.includes('ready')) {
      restartAttempts = 0;
    }
  });

  pm2.stderr?.on('data', (chunk) => {
    const output = chunk.toString();
    if (output.includes('restart')) {
      restartAttempts++;
      if (restartAttempts > 3) {
        spawnSync('npx', ['pm2', 'delete', 'ovl-md'], { cwd: 'ovl', stdio: 'inherit' });
        startNodeFallback();
      }
    }
  });

  pm2.on('exit', () => {
    startNodeFallback();
  });

  pm2.on('error', () => {
    startNodeFallback();
  });
}

function startNodeFallback() {
  const child = spawn('node', ['Ovl.js'], { cwd: 'ovl', stdio: 'inherit' });

  child.on('exit', (code) => {
    const now = Date.now();
    if (now - lastCrashTime > crashResetDelay) crashCount = 0;
    crashCount++;
    lastCrashTime = now;

    if (crashCount > crashLimit) {
      return;
    }

    startNodeFallback();
  });
}

setupProject();
validateSetup();
launchApp();

⚙️ Fichier .github/workflows/deploy.yml
name: OVL-MD Bot CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  schedule:
    - cron: '0 */5 * * *'

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [20.x]
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
      - run: |
          sudo apt update
          sudo apt install -y ffmpeg
          npm i
      - run: timeout 18300s npm run Ovl

🔐 Exemple de fichier .env
PREFIXE=.
NOM_OWNER=Ainz
NUMERO_OWNER=226xxxxxxxx
MODE=public
SESSION_ID=
STICKER_PACK_NAME=ᴏᴠʟ-ᴍᴅ-ᴠ𝟸
STICKER_AUTHOR_NAME=ᴀɪɴᴢ🔅✨

🌍 Rejoins la Communauté OVL

WhatsApp Support Telegram Channel WhatsApp Channel

Partage, pose tes questions, et reste à jour avec toutes les nouveautés du projet !


👨‍💻 Développeur Principal

  • Ainz

🙌 Remerciements

  • Haibo_lugh – pour son soutien et aide dans la gestion du bot au support.
  • Nathan Harmone – pour ses tutoriels YouTube.
  • Dr Djibi – pour son soutien.

📄 Licence

Distribué sous la licence MIT. Voir le fichier LICENSE pour plus d’informations.

About

OVL-MD-V2, développé par Ainz, est un bot WhatsApp multi-device performant, offrant de nombreuses fonctionnalités.

Resources

License

Stars

Watchers

Forks