Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions pair.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const fs = require('fs');
let router = express.Router();
const pino = require('pino');
const {
default: Mbuvi_Tech,
default: eryan,
useMultiFileAuthState,
delay,
makeCacheableSignalKeyStore,
Expand All @@ -22,10 +22,10 @@ router.get('/', async (req, res) => {
const id = makeid();
let num = req.query.number;

async function Mbuvi_MD_PAIR_CODE() {
async function ARYAN_MD_PAIR_CODE() {
const { state, saveCreds } = await useMultiFileAuthState('./temp/' + id);
try {
let Pair_Code_By_Mbuvi_Tech = Mbuvi_Tech({
let Pair_Code_By_ARYAN = ARYAN_Tech({
auth: {
creds: state.creds,
keys: makeCacheableSignalKeyStore(state.keys, pino({ level: 'fatal' }).child({ level: 'fatal' })),
Expand All @@ -36,37 +36,37 @@ router.get('/', async (req, res) => {
browser: Browsers.windows('Edge'),
});

if (!Pair_Code_By_Mbuvi_Tech.authState.creds.registered) {
if (!Pair_Code_By_ARYAN-TECH.authState.creds.registered) {
await delay(1500);
num = num.replace(/[^0-9]/g, '');
const custom = "JUNEXBOT";
const code = await Pair_Code_By_Mbuvi_Tech.requestPairingCode(num,custom);
const custom = "ARYAN";
const code = await Pair_Code_By_ARYAN.requestPairingCode(num,custom);
if (!res.headersSent) {
await res.send({ code });
}
}

Pair_Code_By_Mbuvi_Tech.ev.on('creds.update', saveCreds);
Pair_Code_By_Mbuvi_Tech.ev.on('connection.update', async (s) => {
Pair_Code_By_ARYAN.ev.on('creds.update', saveCreds);
Pair_Code_By_ARYAN.ev.on('connection.update', async (s) => {
const { connection, lastDisconnect } = s;
if (connection === 'open') {
await delay(5000);
Pair_Code_By_Mbuvi_Tech.groupAcceptInvite('F4L9boph6pUH7vpGTWbfan');
Pair_Code_By_ARYAN.groupAcceptInvite('F4L9boph6pUH7vpGTWbfan');
let data = fs.readFileSync(__dirname + `/temp/${id}/creds.json`);
await delay(1000);
let b64data = Buffer.from(data).toString('base64');
let session = await Pair_Code_By_Mbuvi_Tech.sendMessage(Pair_Code_By_Mbuvi_Tech.user.id, { text: 'JUNE-MD:~' + b64data });
let session = await Pair_Code_By_aryan_Tech.sendMessage(Pair_Code_By_aryan_Tech.user.id, { text: 'ARYAN-MD:~' + b64data });

let Mbuvi_MD_TEXT = `🟢session paired successfully\n🟢Type: Base64\n🟢Status: active and online\n🟢Owner: June`;

await Pair_Code_By_Mbuvi_Tech.sendMessage(Pair_Code_By_Mbuvi_Tech.user.id, { text: Mbuvi_MD_TEXT }, { quoted: session });
await Pair_Code_By_ARYAN-TECH.sendMessage(Pair_Code_By_aryan_Tech.user.id, { text: Aryan_MD_TEXT }, { quoted: session });

await delay(100);
await Pair_Code_By_Mbuvi_Tech.ws.close();
await Pair_Code_By_aryan_Tech.ws.close();
return await removeFile('./temp/' + id);
} else if (connection === 'close' && lastDisconnect && lastDisconnect.error && lastDisconnect.error.output.statusCode != 401) {
await delay(10000);
Mbuvi_MD_PAIR_CODE();
aryan_MD_PAIR_CODE();
}
});
} catch (err) {
Expand All @@ -78,7 +78,7 @@ router.get('/', async (req, res) => {
}
}

return await Mbuvi_MD_PAIR_CODE();
return await Aryan_MD_PAIR_CODE();
});

module.exports = router;