-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
28 lines (19 loc) · 962 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
process.stderr.isTTY = true;
const credentialsHandler = require('./lib/credentials-handler');
const instagram = require('./lib/instagram-manage/connection');
const rootOptions = require('./lib/options/root-options');
const { colorStr } = require('./lib/interface/interface-tools/colors');
async function start(forceCredentialsChange = false) {
try {
const credentialsChanged = await credentialsHandler.changeCredentials({ force: forceCredentialsChange });
await instagram.connect(credentialsChanged);
await rootOptions();
} catch (error) {
if (error.name == 'IgLoginBadPasswordError' || error.name == 'IgLoginInvalidUserError') {
console.log(colorStr('\n >>> Incorrect Username or Password', 'red'));
return await start(true);
};
return console.log(colorStr(`\n >>> Error: ${colorStr(error?.stack || error, 'gray')}\n`, 'red'));
};
};
start();