-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
71 lines (49 loc) · 1.44 KB
/
example.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
const Nitelite = require('./index.js')
const launcher = new Nitelite();
function launcherSignIn(email, password, authCode, callback){
launcher.signin(email, password, function(state){
if(state.state){
state.mainWindowLauncher.openFriendsWindow(function(state){
state.friendsWindow.openAddFriendsWindow(function(state){
return callback(state.addFriendsWindow);
});
});
}else{
state.authenticationWindow.insertCode(authCode, function(state){
if(state.state){
state.mainWindowLauncher.openFriendsWindow(function(state){
state.friendsWindow.openAddFriendsWindow(function(state){
return callback(state.addFriendsWindow);
});
});
}else{
console.log("Error? Did your authcode reset")
}
})
}
});
}
function logout(addFriendsWindow){
addFriendsWindow.close(function(state){
state.friendsWindow.close(function(state){
state.mainWindowLauncher.signout(function(state){
console.log("Logged out!")
})
})
})
}
let i = 0;
const friends = ["friend1", "friend2", "friend3", "friend4", "friend5"]
launcherSignIn('your-epicgames-email', 'your-epicgames-password', 'your-auth-code-if-prompted', function(addFriendsWindow){
addFriend(addFriendsWindow)
});
function addFriend(addFriendsWindow){
if (i < friends.length){
addFriendsWindow.addFriend(friends[i], function(e){
i++;
addFriend(addFriendsWindow);
});
}else{
logout(addFriendsWindow)
}
}