-
Notifications
You must be signed in to change notification settings - Fork 26
/
main.js
293 lines (231 loc) · 10.5 KB
/
main.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
//* - Aquatic Dashboard V3.0 : Made By Aquatic Development Team - *\\
//* - Tutorial On AQUA PLAY'S YouTube channel! - *\\
// [WARNING] If you dont know what your doing dont mess with the code!
//* Requirements *\\
const { Client } = require('discord.js');
const request = require("request-promise");
var readlineSync = require('readline-sync');
const path = require('path');
var client = new Client();
var fs = require('fs');
var config = require('./config.json');
//* Main Pogram *\\
console.log("\nFN Lobby Bot\n");
console.log("----------------------------------------------------------------- ")
console.log("If you need help join the Discord: discord.gg/7WPctqq")
console.log("A tutorial can be found on Youtube! ")
console.log("https://youtube.com/c/aquaplaysyt")
console.log("----------------------------------------------------------------- \n")
var ExchangeCode;
// Manual Exchange Code Login Via Kysunes Login Script!
var Email = readlineSync.question('Please Enter your bots Email: ');
var Password = readlineSync.question('Please Enter your bots Password: ', {
hideEchoBack: true,
});
StartClient();
function StartClient() {
// Default Cosmetics!
var CID = "CID_TBD_Athena_Commando_M_ConstructorTest"
var BID = ""
var EID = "eid_bendy"
var PICKAXE_ID = ""
// Netcl Auto Update
const ClientLoginAdapter = require('epicgames-client-login-adapter');
const request = require("request-promise");
const EGClient = require('epicgames-client').Client;
const Fortnite = require('epicgames-fortnite-client');
const { ESubGame } = Fortnite;
const { EPlatform } = require('epicgames-client');
const { EInputType } = require('epicgames-client');
const { EPartyPrivacy } = require('epicgames-client');
var rNetCL = request('https://fnserver.terax235.com/api/v1.2/build',{ json: true }, (err, res, body) => {
rNetCL = body.fortnite.netCL
});
console.log("[AUTO] " + rNetCL)
let eg = new EGClient({ // For this make a new account that has nothing and put the details in here.
email: "",
password: "",
debug: console.log,
defaultPartyConfig: {
privacy: EPartyPrivacy.PUBLIC,
joinConfirmation: false,
joinability: 'OPEN', // Opens the party and allows it to be joined
maxSize: 16,
subType: 'default',
type: 'default',
inviteTTL: 14400,
chatEnabled: true,
}
});
function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds) {
break;
}
}
}
eg.init().then(async (success) => {
// Login system reworked by Kysune
const clientLoginAdapter = await ClientLoginAdapter.init({
login: Email,
password: Password,
});
const exchangeCode = await clientLoginAdapter.getExchangeCode();
await clientLoginAdapter.close();
await eg.login(null, exchangeCode);
if(config.UseDiscord == true)
{
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
const account = eg.getProfile(eg.account.id);
client.user.setActivity(`Fortnite Custom Lobbies`);
});
client.login(config.DiscordBotToken);
}
var current_party;
if (!success)
throw new Error('Cannot initialize EpicGames launcher.');
const fortnite = await eg.runGame(Fortnite, {
netCL: '11567008',
partyBuildId: '1:1:11567008',
});
const br = await fortnite.runSubGame(ESubGame.BattleRoyale)
fortnite.communicator.on('party:member:joined', async (member) => {
console.log(`Member#${member.id} joined!`);
console.log(`Members count: ${fortnite.party.members.length}`);
fortnite.party.me.setOutfit("/Game/Athena/Items/Cosmetics/Characters/" + CID + "." + CID);
fortnite.party.me.setBackpack("/Game/Athena/Items/Cosmetics/Backpacks/" + BID + "." + BID);
fortnite.party.me.setPickaxe("/Game/Athena/Items/Cosmetics/Pickaxes/" + PICKAXE_ID + "." + PICKAXE_ID); // ALL OF THE THINGS ARE PULLED FROM ABOVE!
fortnite.party.me.setEmote("/Game/Athena/Items/Cosmetics/Dances/" + EID + "." + EID);
fortnite.party.me.setBattlePass(true, 420000, 420000, 420000);
fortnite.party.me.setBanner(420000, "otherbanner28", "default");
if(config.UseDiscord == true)
{
client.user.setActivity(`Serving ${fortnite.party.members.length} Players!`);
}
});
fortnite.communicator.on('party:member:left', async (member) => {
console.log(`Member#${member.id} left!`);
console.log(`Members count: ${fortnite.party.members.length}`);
if(config.UseDiscord == true)
{
client.user.setActivity(`Serving ${fortnite.party.members.length} Players!`);
}
});
fortnite.communicator.on('party:invitation', async (invitation) => {
current_party = invitation.party;
await invitation.accept()
});
fortnite.communicator.on('friend:request', async (friendops) => {
eg.communicator.sendMessage(friendops.friend.id, "Thanks for friending me! I'm a lobby bot, to use me invite or join my party then send me the CID or EID in private messages!");
sleep(200);
eg.acceptFriendRequest(friendops.friend.id)
});
eg.communicator.on('friend:message', async (data) => {
if (data.message == 'help') {
eg.communicator.sendMessage(data.friend.id, 'Commands: CID_ , EID_ , BID_ , !banner, !stop, !bp, !status, !ready, !unready, !input, !platform');
}
var args = data.message.split(" ");
if (args[0].toLowerCase().startsWith("cid_")) {
CID = args[0];
try {
fortnite.party.me.setOutfit("/Game/Athena/Items/Cosmetics/Characters/" + args[0] + "." + args[0]);
eg.communicator.sendMessage(data.friend.id, "Skin set to " + args[0]);
} catch {
eg.communicator.sendMessage(data.friend.id, "Please use CID");
}
}
if (args[0].toLowerCase().startsWith("eid_")) {
EID = args[0];
try {
fortnite.party.me.setEmote("/Game/Athena/Items/Cosmetics/Dances/" + args[0] + "." + args[0]);
eg.communicator.sendMessage(data.friend.id, "Emote set to " + args[0]);
} catch {
eg.communicator.sendMessage(data.friend.id, "Please use EID");
}
}
if (args[0].toLowerCase().startsWith("pickaxeid_")) {
PICKAXE_ID = args[0];
try {
fortnite.party.me.setPickaxe("/Game/Athena/Items/Cosmetics/Pickaxes/" + args[0] + "." + args[0]);
eg.communicator.sendMessage(data.friend.id, "Pickaxe set to " + args[0]);
} catch {
eg.communicator.sendMessage(data.friend.id, "Please use Pickaxe_ID");
}
}
if (args[0].toLowerCase().startsWith("bid_")) {
BID = args[0];
try {
fortnite.party.me.setBackpack("/Game/Athena/Items/Cosmetics/Backpacks/" + args[0] + "." + args[0]);
eg.communicator.sendMessage(data.friend.id, "Backbling set to " + args[0]);
} catch {
eg.communicator.sendMessage(data.friend.id, "Please use BID");
}
}
if (args[0].toLowerCase() == "!status") {
var mess = data.message.replace("!status", "");
fortnite.communicator.updateStatus(mess);
eg.communicator.sendMessage(data.friend.id, 'Status set to ' + mess + "!");
}
if (args[0].toLowerCase() == "!banner") {
try {
fortnite.party.me.setBanner(100, args[1], args[2]);
eg.communicator.sendMessage(data.friend.id, "Banner set to " + args[1] + " " + args[2]);
} catch {
eg.communicator.sendMessage(data.friend.id, "Please use !banner BANNER COLOR");
}
}
if (args[0].toLowerCase() == "!ready") {
try {
fortnite.party.me.setReady(true);
eg.communicator.sendMessage(data.friend.id, "Ready!");
} catch {
eg.communicator.sendMessage(data.friend.id, "Please use !ready");
}
}
if (args[0].toLowerCase() == "!unready") {
try {
fortnite.party.me.setReady(false);
eg.communicator.sendMessage(data.friend.id, "Unready!");
} catch {
eg.communicator.sendMessage(data.friend.id, "Please use !unready");
}
}
if (args[0].toLowerCase() == "!bp") {
try {
fortnite.party.me.setBattlePass(true, args[1], args[2], args[3]);
eg.communicator.sendMessage(data.friend.id, "BP set to " + args[1] + " " + args[2] + " " + args[3] + "!");
} catch {
eg.communicator.sendMessage(data.friend.id, "Please use !bp LEVEL SELFXP FRIENDXP");
}
}
if (args[0].toLowerCase() == "!stop") {
try {
fortnite.party.me.clearEmote();
eg.communicator.sendMessage(data.friend.id, "Emote cleared!");
} catch {
eg.communicator.sendMessage(data.friend.id, "Please use !stop");
}
}
if (args[0].toLowerCase() == "!platform") {
try {
fortnite.party.me.setPlatform(args[1]);
eg.communicator.sendMessage(data.friend.id, "Set Platform to " + args[1] + " !");
} catch {
eg.communicator.sendMessage(data.friend.id, "Please use !platform PLATFORM");
}
}
if (args[0].toLowerCase() == "!input") {
try {
fortnite.party.me.setInputType(args[1]);
eg.communicator.sendMessage(data.friend.id, "Set Input to " + args[1] + " !");
} catch {
eg.communicator.sendMessage(data.friend.id, "Please use !input INPUTTYPE");
}
}
});
// This changes the default status, i would prefer you keep it the same but you change it if you feel!
fortnite.communicator.updateStatus("FN Lobby Bot, Tutorial on 'youtube.com/aquaplaysyt'");
});
};