MCPcopy Index your code
hub / github.com/Maccoder3/MAC-MD / connectToWA

Function connectToWA

index.js:55–418  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53 //=============================================
54
55 async function connectToWA() {
56
57 //mongo dp
58
59 const connectDB = require('./lib/mongodb')
60 connectDB();
61
62 //_______________
63
64 const {readEnv} = require('./lib/database')
65 const config =await readEnv();
66 const prefix = config.PREFIX
67 //=====≈=====≈
68
69
70 console.log("Connecting MAC 𝘔𝘋 𝘉𝘖𝘛✅...");
71 const { state, saveCreds } = await useMultiFileAuthState(__dirname + '/auth_info_baileys/')
72 var { version } = await fetchLatestBaileysVersion()
73
74 const conn = makeWASocket({
75 logger: P({ level: 'silent' }),
76 printQRInTerminal: false,
77 browser: Browsers.macOS("Firefox"),
78 syncFullHistory: true,
79 auth: state,
80 version
81 })
82
83 conn.ev.on('connection.update', (update) => {
84 const { connection, lastDisconnect } = update
85 if (connection === 'close') {
86 if (lastDisconnect.error.output.statusCode !== DisconnectReason.loggedOut) {
87 connectToWA()
88 }
89 } else if (connection === 'open') {
90 console.log('😼 Installing... ')
91 const path = require('path');
92 fs.readdirSync("./plugins/").forEach((plugin) => {
93 if (path.extname(plugin).toLowerCase() == ".js") {
94 require("./plugins/" + plugin);
95 }
96 });
97 console.log('Plugins installed successful ✅')
98 console.log('MAC 𝘔𝘋 𝘉𝘖𝘛 connected to whatsapp ✅')
99
100 let up = `*MAC 𝘔𝘋 𝘉𝘖𝘛 𝘊𝘖𝘕𝘕𝘌𝘊𝘛𝘌𝘋*
101
102> _.Menu = Get Bot All Commands_ ⤵
103
104> _.Settings = Customize Bot Settings Work For Owner Only._❄️
105
106𝘉𝘖𝘛 𝘖𝘞𝘕𝘌𝘙 𝘉𝘠 MAC
107*MAC - MD*
108
109 https://wa.me/94767096711`;
110
111 conn.sendMessage(ownerNumber + "@s.whatsapp.net", { image: { url: `https://files.catbox.moe/sti9pk.jpg` }, caption: up })
112

Callers 1

index.jsFile · 0.85

Calls 5

makeWASocketFunction · 0.85
smsFunction · 0.85
getGroupAdminsFunction · 0.85
getBufferFunction · 0.85
downloadMediaMessageFunction · 0.85

Tested by

no test coverage detected