-
Notifications
You must be signed in to change notification settings - Fork 4
/
botlike2.js
123 lines (106 loc) · 3.41 KB
/
botlike2.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
'use strict'
const Client = require('instagram-private-api').V1;
const delay = require('delay');
const chalk = require('chalk');
const inquirer = require('inquirer');
const User = [
{
type:'input',
name:'username',
message:'[>] Insert Username:',
validate: function(value){
if(!value) return 'Can\'t Empty';
return true;
}
},
{
type:'password',
name:'password',
message:'[>] Insert Password:',
mask:'*',
validate: function(value){
if(!value) return 'Can\'t Empty';
return true;
}
}
]
const Login = async function(User){
/** Save Account **/
const Device = new Client.Device(User.username);
const Storage = new Client.CookieMemoryStorage();
const session = new Client.Session(Device, Storage);
try {
await Client.Session.create(Device, Storage, User.username, User.password)
const account = await session.getAccount();
return Promise.resolve({session,account});
} catch (err) {
return Promise.reject(err);
}
}
const Timeline = async function(session,count,cursor){
var getCursor;
count++;
/** New Feed **/
const feed = new Client.Feed.Timeline(session);
/** Cursor Detect **/
if (cursor) {
feed.setCursor(cursor);
}
try {
const media = await feed.get();
console.log('\n[+] Cursor => %s\n', count);
await Promise.all(media.map(async(media) => {
Like(session,media);
}));
if (count < 3) {
getCursor = await feed.getCursor();
await Timeline(session,count,getCursor);
} else {
console.log('\n[-] Repeat from scratch (Delay 60s)\n');
await delay(60000);
count=0;
await Timeline(session,count);
}
} catch(err) {
return Promise.reject(err);
}
}
const Like = async function(session,media){
try {
if (media.params.hasLiked === false){
const Like = await Client.Like.create(session, media.params.id);
console.log(chalk`[{bold.cyan ${media.id}}] Username : ${media.params.user.username} => {bold.green Liked}`);
} else {
console.log(chalk`[{bold.cyan ${media.id}}] Username : ${media.params.user.username} => {bold.red Already Liked}`);
}
} catch (err) {
return Promise.reject(err);
}
}
const Excute = async function(User){
try {
const count = 0;
const doLogin = await Login(User);
await Timeline(doLogin.session,count);
} catch (err) {
console.log(err);
}
}
console.log(chalk`
{bold.cyan
—————————————————— [INFORMATION] ————————————————————
[?] {bold.green BOTLIKEv2 | Like/Love TL IG *AUTO!}
—————————————————— [THANKS TO] ————————————————————
[✓] CODE BY CYBER SCREAMER CCOCOT ([email protected])
[✓] FIXING & TESTING BY SYNTAX (@officialputu_id)
[✓] CCOCOT.CO | BC0DE.NET | NAONLAH.NET | WingkoColi
[✓] SGB TEAM REBORN | Zerobyte.id | [email protected]
—————————————————————————————————————————————————————}
`);
inquirer.prompt(User)
.then(answers => {
Excute({
username:answers.username,
password:answers.password
});
})