├── LICENSE ├── Procfile ├── README.md ├── app.json ├── auth_info_baileys └── suhail.jpg ├── index.js └── package.json /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Suhail Tech info 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: node index.js -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

WEB BASED MULTIDEVICE QR

2 | 3 | 4 | 5 |

6 | 7 | License: GPL-3 8 | 9 | 10 | SuhailTechInfo 11 | 12 |

SuhailTechInfo :: Visitor's Count

13 | 14 | 15 | 16 | 17 | 18 | 19 | ## Deployment Methods 20 | --- 21 | 1. ***Click [`FORK`](https://github.com/SuhailTechInfo/web-qr/fork) and `Star ⭐ Repository` if you get help from repo.*** 22 | 2. ***Deploy on [`HEROKU`](https://dashboard.heroku.com/new?template=https://github.com/SuhailTechInfo/web-qr).*** 23 | 3. ***Deploy on [`REPLIT`](https://replit.com/github/SuhailTechInfo/web-qr).*** 24 | 4. ***Deploy on [`RENDER`](https://dashboard.render.com/login).*** 25 | ``` 26 | RENDER PROCESS: 27 | 1: Click "NEW". 28 | 2: Select "Web Service". 29 | 3: Click "Build and deploy from a Git repository". 30 | 4: Now Choose this forked git repo from list. 31 | 5: And JUST CLICK "Connect". 32 | ``` 33 | 34 | 35 | 36 | 37 | - Dependencies 38 | ```sh 39 | "@hapi/boom": "^10.0.1", 40 | "@whiskeysockets/baileys": "6.5.0", 41 | "pino": "^8.1.0", 42 | "express": "^4.18.2", 43 | "qrcode": "latest" 44 | ``` 45 | 46 | 47 | - WASocket Options 48 | ```js 49 | let Smd =SuhailWASocket({ 50 | printQRInTerminal: false, // make it false if you're using web 51 | logger: pino({ level: "silent" }), // make it silent to prevent baileys buffering 52 | browser: Browsers.baileys("Desktop"), // awailable browsers : ubuntu, macOS, baileys. 53 | auth: state 54 | }); 55 | ``` 56 | 57 | 58 | 59 | - Getting Session in BASE64 60 | ```js 61 | let CREDS = fs.readFileSync(__dirname + '/auth_info_baileys/creds.json') 62 | var Scan_Id = Buffer.from(CREDS).toString('base64') // converting into Base64 ---- IMPLEMENT ACCOEDING TO YOUR NEED 63 | // res.json({status:true,Scan_Id }) 64 | ``` 65 | 66 | 67 | 68 | 69 | - Environment variable 70 | ```js 71 | const PORT = process.env.PORT || 5000 72 | const MESSAGE = process.env.MESSAGE || "Don't Provide your session id to someone!" 73 | // Set Confirmation Message According to your need! 74 | ``` 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | ## MADE WITH ❤️ 85 | [![SuhailTechIinfo](https://github.com/SuhailTechInfo.png?size=300)](https://github.com/SuhailTechInfo) 86 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "suhail-md", 3 | "description": "I am Suhail-Md Whatsapp Chuddy Buddy built in NodeJs to make experience better\n\t if Any Problem : www.youtube.com/c/SuhailTechInfo", 4 | "logo": "https://telegra.ph/file/d5b1c3544fedc23e11a06.jpg", 5 | "repository": "https://github.com/SuhailTechInfo/web-qr", 6 | "keywords": ["whatsappbot", "suhailMd", "suhail Md bot", "Suhail-Md", "SuhailMdWhatsaooBot", "SuhailWaBot","SuhailMD","Suhail Md Whatsapp Bot","multi device"], 7 | "success_url": "/", 8 | "buildpacks": [{ "url": "https://github.com/heroku/heroku-buildpack-nodejs#latest" } ], 9 | "env": { 10 | "PORT": { 11 | "description": "Port for web app.4000,5000,3000... any!", 12 | "value": "5000", 13 | "required": false 14 | }, 15 | "MESSAGE": { 16 | "description": "set session id conformation message", 17 | "value": "╔════◇\n║ *『 WAOW YOU CHOOSE SUHAIL-MD 』*\n║ _You complete first step to making Bot._\n╚════════════════════════╝\n╔═════◇\n║ 『••• 𝗩𝗶𝘀𝗶𝘁 𝗙𝗼𝗿 𝗛𝗲𝗹𝗽 •••』\n║ *Ytube:* _youtube.com/SuhailTechInfo_\n║ *Owner:* _https://wa.me/923184474176_\n║ *Note :*_Don't provide your SESSION_ID to_\n║ _anyone otherwise that can access chats_\n╚════════════════════════╝", 18 | "required": false 19 | } 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /auth_info_baileys/suhail.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SuhailTechInfo/web-qr/6c64d44181dda713aa7db3987ff04633ad81e230/auth_info_baileys/suhail.jpg -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 2 | const express = require("express"); 3 | const app = express(); 4 | 5 | 6 | 7 | 8 | 9 | const pino = require("pino"); 10 | let { toBuffer } = require("qrcode"); 11 | const path = require('path'); 12 | const fs = require("fs-extra"); 13 | const { Boom } = require("@hapi/boom"); 14 | const PORT = process.env.PORT || 5000 15 | const MESSAGE = process.env.MESSAGE || ` 16 | ╔════◇ 17 | ║ *『 WAOW YOU CHOOSE SUHAIL-MD 』* 18 | ║ _You complete first step to making Bot._ 19 | ╚════════════════════════╝ 20 | ╔═════◇ 21 | ║ 『••• 𝗩𝗶𝘀𝗶𝘁 𝗙𝗼𝗿 𝗛𝗲𝗹𝗽 •••』 22 | ║ *Ytube:* _youtube.com/SuhailTechInfo_ 23 | ║ *Owner:* _https://wa.me/923184474176_ 24 | ║ *Note :*_Don't provide your SESSION_ID to_ 25 | ║ _anyone otherwise that can access chats_ 26 | ╚════════════════════════╝ 27 | ` 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | if (fs.existsSync('./auth_info_baileys')) { 40 | fs.emptyDirSync(__dirname + '/auth_info_baileys'); 41 | }; 42 | 43 | app.use("/", async(req, res) => { 44 | 45 | const { default: SuhailWASocket, useMultiFileAuthState, Browsers, delay,DisconnectReason, makeInMemoryStore, } = require("@whiskeysockets/baileys"); 46 | const store = makeInMemoryStore({ logger: pino().child({ level: 'silent', stream: 'store' }) }) 47 | async function SUHAIL() { 48 | const { state, saveCreds } = await useMultiFileAuthState(__dirname + '/auth_info_baileys') 49 | try { 50 | let Smd =SuhailWASocket({ 51 | printQRInTerminal: false, 52 | logger: pino({ level: "silent" }), 53 | browser: Browsers.baileys("Desktop"), 54 | auth: state 55 | }); 56 | 57 | 58 | Smd.ev.on("connection.update", async (s) => { 59 | const { connection, lastDisconnect, qr } = s; 60 | if (qr) { res.end(await toBuffer(qr)); } 61 | 62 | 63 | if (connection == "open"){ 64 | await delay(3000); 65 | let user = Smd.user.id; 66 | 67 | 68 | //=========================================================================================== 69 | //=============================== SESSION ID =========================================== 70 | //=========================================================================================== 71 | 72 | let CREDS = fs.readFileSync(__dirname + '/auth_info_baileys/creds.json') 73 | var Scan_Id = Buffer.from(CREDS).toString('base64') 74 | // res.json({status:true,Scan_Id }) 75 | console.log(` 76 | ==================== SESSION ID ========================== 77 | SESSION-ID ==> ${Scan_Id} 78 | ------------------- SESSION CLOSED ----------------------- 79 | `) 80 | 81 | 82 | let msgsss = await Smd.sendMessage(user, { text: Scan_Id }); 83 | await Smd.sendMessage(user, { text: MESSAGE } , { quoted : msgsss }); 84 | await delay(1000); 85 | try{ await fs.emptyDirSync(__dirname+'/auth_info_baileys'); }catch(e){} 86 | 87 | 88 | } 89 | 90 | Smd.ev.on('creds.update', saveCreds) 91 | 92 | if (connection === "close") { 93 | let reason = new Boom(lastDisconnect?.error)?.output.statusCode 94 | // console.log("Reason : ",DisconnectReason[reason]) 95 | if (reason === DisconnectReason.connectionClosed) { 96 | console.log("Connection closed!") 97 | // SUHAIL().catch(err => console.log(err)); 98 | } else if (reason === DisconnectReason.connectionLost) { 99 | console.log("Connection Lost from Server!") 100 | // SUHAIL().catch(err => console.log(err)); 101 | } else if (reason === DisconnectReason.restartRequired) { 102 | console.log("Restart Required, Restarting...") 103 | SUHAIL().catch(err => console.log(err)); 104 | } else if (reason === DisconnectReason.timedOut) { 105 | console.log("Connection TimedOut!") 106 | // SUHAIL().catch(err => console.log(err)); 107 | } else { 108 | console.log('Connection closed with bot. Please run again.'); 109 | console.log(reason) 110 | //process.exit(0) 111 | } 112 | } 113 | 114 | 115 | 116 | }); 117 | } catch (err) { 118 | console.log(err); 119 | await fs.emptyDirSync(__dirname+'/auth_info_baileys'); 120 | } 121 | } 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | SUHAIL().catch(async(err) => { 131 | console.log(err) 132 | await fs.emptyDirSync(__dirname+'/auth_info_baileys'); 133 | 134 | 135 | //// MADE WITH 136 | 137 | }); 138 | 139 | 140 | }) 141 | 142 | 143 | app.listen(PORT, () => console.log(`App listened on port http://localhost:${PORT}`)); 144 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web-qr", 3 | "version": "0.0.1", 4 | "description": "A multi functional whatsapp bot Web Qr Scanner.", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node index.js" 9 | }, 10 | "keywords": ["baileysQr","MdLogin", "Suhail-Md","whatsapp-bot","BotWhatsapp","whatsappMdLogin","adiwajshing/baileys","baileys-md-qr","multi-device-qr","md-qr","bot-qr","baileysQrScanner","wabot" ], 11 | "author": "SuhailTechInfo", 12 | "license": "MIT", 13 | "dependencies": { 14 | "@hapi/boom": "^10.0.1", 15 | "@whiskeysockets/baileys": "6.5.0", 16 | "fs-extra": "latest", 17 | "pino": "^8.1.0", 18 | "express": "^4.18.2", 19 | "qrcode": "latest" 20 | }, 21 | "repository": { 22 | "type": "git", 23 | "url": "git+https://github.dev/SuhailTechInfo/web-qr.git" 24 | } 25 | } 26 | --------------------------------------------------------------------------------