-
Notifications
You must be signed in to change notification settings - Fork 29
/
index.js
1301 lines (1060 loc) · 53.9 KB
/
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
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Version 2.1.2
const version = "2.1.2";
const chalk = require("chalk");
console.log(chalk.red(`Slashy has started!!`))
console.log(chalk.hex('#FFA500')(`If you encounter any issues, join our Discord: \nhttps://discord.gg/HGfFFUQ7F7`))
console.log(chalk.yellowBright(`Your version is: ${version}`))
if (!process.version.startsWith('v20')) console.log(chalk.redBright('You are running a NodeJS version under v20. If you don\'t upgrade, you may get large lag spikes or ram overloads.'))
const {
Webhook,
MessageBuilder
} = require("discord-webhook-node");
var webhook;
var isOneAccPayingOut = false;
var itemsToPayout = [];
const config = process.env.config ? JSON.parse(process.env.config) : require("./config.json");
if (config.webhookLogging && config.webhook) webhook = new Webhook(config.webhook);
if (config.serverEventsDonate.enabled) console.log(chalk.redBright('SeverEvents Donate is VERY risky at the moment. Bot admins are monitoring server pools usage. You may want to turn this off.'))
if (config.commands.filter(a => a.command === 'trivia').length > 0) console.log(chalk.redBright('Trivia is VERY risky at the moment. Bot admins are monitoring trivia bots. You may want to turn this off.'))
process.on("unhandledRejection", (error) => {
if (error.toString().includes("Cannot read properties of undefined (reading 'type')")) return;
if (error.toString().includes("INTERACTION_TIMEOUT")) return;
if (error.toString().includes("BUTTON_NOT_FOUND")) return;
if (error.toString().includes("Invalid Form Body")) return;
if (error.toString().includes("COMPONENT_VALIDATION_FAILED: Component validation failed")) return;
if (error.toString().includes("Cannot send messages to this user")) return console.error(chalk.red("Make sure all of the users are in a server where Dank Memer is in"));
console.log(chalk.gray("—————————————————————————————————"));
console.log(chalk.white("["), chalk.red.bold("Anti-Crash"), chalk.white("]"), chalk.gray(" : "), chalk.white.bold("Unhandled Rejection/Catch"));
console.log(chalk.gray("—————————————————————————————————"));
console.error("unhandledRejection", error);
});
process.on("uncaughtException", (error) => {
console.log(chalk.gray("—————————————————————————————————"));
console.log(chalk.white("["), chalk.red.bold("Anti-Crash"), chalk.white("]"), chalk.gray(" : "), chalk.white.bold("Uncaught Exception/Catch"));
console.log(chalk.gray("—————————————————————————————————"));
console.error("uncaughtException", error);
});
process.on("multipleResolves", (type, promise, reason) => {
console.log(chalk.gray("—————————————————————————————————"));
console.log(chalk.white("["), chalk.red.bold("Anti-Crash"), chalk.white("]"), chalk.gray(" : "), chalk.white.bold("Multiple Resolves"));
console.log(chalk.gray("—————————————————————————————————"));
console.log(type, promise, reason);
});
const fs = require("fs-extra");
const axios = require("axios");
const SimplDB = require("simpl.db");
const stripAnsi = require("strip-ansi");
const express = require("express");
const db = new SimplDB();
axios.get("https://raw.githubusercontent.com/TahaGorme/slashy/main/index.js").then((res) => {
let v = res.data.match(/Version ([0-9]*\.?)+/)[0]?.replace("Version ", "");
if (v && v !== version) console.log(chalk.bold.bgRed("There is a new version available: " + v + "\t\nPlease update. " + chalk.underline("https://github.com/TahaGorme/slashy")));
}).catch((error) => {
console.log(error);
});
var logs = [];
const app = express();
app.use(express.json());
let websitePass = process.env.password || config.password;
app.get("/", (req, res) => res.sendFile(__dirname + "/website/index.html"));
app.get("/balance", (req, res) => res.sendFile(__dirname + "/website/bal.html"));
app.get("/api/console", (req, res) => {
const password = req.headers.password;
if (!password) return;
if (password !== websitePass) return res.send("Invalid Password");
const html = logs.map(msg => {
return msg;
}).join('\n');
res.send(html);
});
app.post("/api/saveThings", (req, res) => {
const password = req.headers.password;
if (!password) return;
if (password !== websitePass) return res.send("Invalid Password");
var b = req.body;
config.playInDms = b.playInDms;
config.autoAdventure = b.autoAdventure;
config.autoApple = b.autoApple;
config.autoHorseshoe = b.autoHorseShoe;
config.devMode = b.devMode;
config.autoDeposit = b.autoDeposit;
config.autoBuy = b.autoBuy;
config.commands = b.commands;
config.cooldowns = b.cooldowns;
fs.writeFileSync('config.json', JSON.stringify(config, null, "\t"), 'utf8', (err) => {
if (err) throw err;
console.log('The config.json file has been updated!');
});
res.send("Config Updated")
});
app.get("/api/database", (req, res) => {
const password = req.headers.password;
if (!password) return;
if (password !== websitePass) return res.send("Invalid Password");
const data = db.toJSON();
res.json(data);
});
app.get("/api/config", (req, res) => {
const password = req.headers.password;
if (!password) return;
if (password !== websitePass) return res.send("Invalid Password");
res.send(config);
});
app.listen(7600, () => console.log(`App listening on port 7600!`));
const {
Client
} = require("discord.js-selfbot-v13");
const tokens = process.env.tokens ? process.env.tokens.split("\n") : fs.readFileSync("tokens.txt", "utf-8").split("\n");
const botid = "270904126974590976";
var i = 0;
if (config.serverEventsDonate.payoutOnlyMode && config.serverEventsDonate.tokenWhichWillPayout && config.serverEventsDonate.enabled) {
const client1 = new Client({
checkUpdate: false
});
client1.on('ready', async () => {
console.log(`${client1.user.username} is ready!`);
const channel = await client1.channels.fetch(config.serverEventsDonate.payoutChannelID);
if (!channel) return console.log("Invalid Channel ID for Serverevents donate - Please check config.json");
channel.sendSlash(botid, "serverevents pool")
})
client1.on("messageCreate", async (message) => {
if (message?.interaction?.commandName?.includes("serverevents payout") && message?.embeds[0]?.title?.includes("Pending Confirmation")) {
if (!message.components[0].components[1]) return;
await clickButton(message, message.components[0].components[1]);
itemsToPayout.shift();
await wait(randomInt(1500, 2000))
if (itemsToPayout.length <= 0) return message.channel.sendSlash(botid, "serverevents pool")
await message.channel.sendSlash(botid, "serverevents payout", config.serverEventsDonate.mainUserId, itemsToPayout[0].quantity, itemsToPayout[0].item)
}
if (message?.embeds[0]?.title?.includes("Server Pool")) {
if (!config.serverEventsDonate.payout) return;
let coins = message.embeds[0].description
.split("\n")[4]
.split("⏣ ")[1]
.replaceAll(',', '');
if (coins > 0 && config.serverEventsDonate.payout) await message.channel.sendSlash(botid, "serverevents payout", config.serverEventsDonate.mainUserId, coins);
message.embeds[0].description.split("\n").forEach((line) => {
if (/` +([0-9,]+)/gm.test(line)) {
var quantity = line.match(/` +([0-9,]+)/gm)[0]?.replace("`")?.trim()?.replaceAll(',', '')?.match(/\d+/)[0];
var item = line.match(/> .*/gm)[0]?.replace("> ", "")?.trim();
if (!quantity || !item) return;
console.log(`${item}: ${quantity}`)
itemsToPayout.push({
item: item,
quantity: quantity
});
}
});
if (itemsToPayout.length <= 0) return console.log(`${chalk.magentaBright(client1.user.tag)}: ${chalk.cyan(`Server Pool Empty`)} `)
await message.channel.sendSlash(botid, "serverevents payout", config.serverEventsDonate.mainUserId, itemsToPayout[0].quantity, itemsToPayout[0].item)
}
})
client1.login(config.serverEventsDonate.tokenWhichWillPayout);
} else {
tokens.forEach((token) => {
i++;
setTimeout(() => {
if (!token.trim().split(" ")[1]) start(token.trim().split(" ")[0]);
else start(token.trim().split(" ")[1], token.trim().split(" ")[0]);
}, i * config.loginDelay);
});
};
async function start(token, channelId) {
var onGoingCommands = [];
var allItemsInInventory = [];
var queueCommands = [];
var isBotFree = true;
var isOnBreak = false;
var botNotFreeCount = 0;
var isDeadMeme = false;
var isPlayingAdventure = false;
var wallet = 0;
var bank = 0;
var totalNet = 0;
var market = 0;
var invNet = 0;
const client = new Client({
checkUpdate: false
});
var channel;
client.on("rateLimit", (rateLimitInfo) => {
console.log(chalk.white.bold(client.user.tag + " - Rate Limited"));
console.log(chalk.gray(rateLimitInfo));
});
client.on("ready", async () => {
client.user.setStatus(config.discordStatus);
console.log(`${chalk.green("Logged in as")} ${chalk.blue(client.user.tag)}`);
const user = await client.users.fetch(botid);
const createdDm = await user.createDM();
if (config.playInDms) channelId = createdDm.id;
channel = await client.channels.fetch(channelId);
if (config.autoDaily) {
const now = Date.now();
const gmt0 = new Date(now).setUTCHours(0, 0, 0, 0);
var remainingTime;
if (now > gmt0) {
const nextGmt0 = new Date(gmt0).setUTCDate(new Date(gmt0).getUTCDate() + 1);
remainingTime = nextGmt0 - now;
} else remainingTime = gmt0 - now;
if (!db.has(client.user.id + ".daily")) {
await channel.sendSlash(botid, "daily")
console.log(chalk.yellow(`${client.user.tag} claimed daily`));
db.set(client.user.id + ".daily", Date.now());
}
if (db.get(client.user.id + ".daily") && Date.now() - db.get(client.user.id + ".daily") > remainingTime) {
await channel.sendSlash(botid, "daily").then(() => {
db.set(client.user.id + ".daily", Date.now());
console.log(chalk.yellow(`${client.user.tag} claimed daily`));
setInterval(async () => {
queueCommands.push({
command: "daily"
});
db.set(client.user.id + ".daily", Date.now());
console.log(chalk.yellow(`${client.user.tag} claimed daily`));
}, remainingTime + randomInt(10000, 60000));
})
.catch((e) => {
return console.log(e);
});
}
}
if (config.autoVote) {
const vote = () => {
axios.post("https://discord.com/api/v10/oauth2/authorize?client_id=477949690848083968&response_type=code&scope=identify", {
authorize: true,
permissions: 0
}, {
headers: {
authorization: token
}
}).then((res) => {
if (!res.data || !res.data.location) return;
axios.get(`https://discordbotlist.com/api/v1/oauth?code=${res.data.location.split('code=')[1]}`).then((res) => {
axios.post(`https://discordbotlist.com/api/v1/bots/270904126974590976/upvote`, {}, {
headers: {
authorization: res.data.token
}
}).then((res) => {
if (res.data.success) console.log(chalk.yellow(`${client.user.tag} voted`));
}).catch(err => {
if (err.response) console.log(chalk.red(`${client.user.tag} Vote Error: (${err.response.status}) ${error.response.data}`))
else console.log(chalk.red(`${client.user.tag} Vote Error: unknown`))
});
})
});
};
setInterval(() => vote(), 4.32e+7, true);
};
if (config.serverEventsDonate.enabled && config.playInDms) return console.log(chalk.redBright("Server Events Donate is not supported in DMs. Please disable playInDms in config.json and add channel ids before the tokens in tokens.txt in the format <channelid> <token>"))
if (config.serverEventsDonate.enabled) await channel.sendSlash(botid, "withdraw", "max")
await channel.sendSlash(botid, "balance").catch((e) => console.log(e));
db.set(client.user.id + ".username", client.user.tag);
if (config.serverEventsDonate.enabled) return channel.sendSlash(botid, "inventory")
if (!db.get(client.user.id + ".apple") || Date.now() - db.get(client.user.id + ".apple") > 24 * 60 * 60 * 1000) {
if (config.autoApple) {
setTimeout(async () => {
await channel.sendSlash(botid, "use", "apple")
.catch((e) => {
return console.error(e);
});
}, randomInt(5000, 150000))
}
}
if (!db.get(client.user.id + ".horseshoe") || Date.now() - db.get(client.user.id + ".horseshoe") > 0.25 * 60 * 60 * 1000) {
if (config.autoHorseshoe) {
setTimeout(async () => {
await channel.sendSlash(botid, "use", "lucky horseshoe")
.catch((e) => {
return console.error(e);
});
}, randomInt(5000, 150000))
}
}
if (!db.get(client.user.id + ".ammo") || Date.now() - db.get(client.user.id + ".ammo") > 1 * 60 * 60 * 1000) {
if (config.autoAmmo) {
setTimeout(async () => {
await channel.sendSlash(botid, "use", "ammo")
.catch((e) => {
return console.error(e);
});
}, randomInt(5000, 150000))
}
}
if (!db.get(client.user.id + ".bait") || Date.now() - db.get(client.user.id + ".bait") > 1 * 60 * 60 * 1000) {
if (config.autoFishingBait) {
setTimeout(async () => {
await channel.sendSlash(botid, "use", "fishing bait")
.catch((e) => {
return console.error(e);
});
}, randomInt(5000, 150000))
}
}
if (config.autoAdventure) await channel.sendSlash(botid, "adventure").then(() => isPlayingAdventure = true);
main(onGoingCommands, channel, client, queueCommands, isOnBreak);
});
client.on("messageUpdate", async (oldMessage, newMessage) => {
if (newMessage?.interaction?.user !== client.user) return;
if (newMessage?.author?.id !== botid) return;
// =================== Dead Meme Start ===================
if (newMessage?.embeds[0]?.description?.includes("dead meme")) {
isDeadMeme = true;
setTimeout(() => {
isDeadMeme = false;
}, 3.02 * 1000 * 60);
}
// =================== Dead Meme End ===================
// =================== Adventure Start ===================
autoAdventure(newMessage);
let isCaught = newMessage.embeds[0]?.description?.match(/(Dragon|Kraken|Legendary Fish), nice (shot|catch)!/);
if (isCaught) {
let [_, item, action] = isCaught;
console.log(chalk.magentaBright(`${client.user.tag} caught ${item}`));
}
if (newMessage?.embeds[0]?.title?.includes(client.user.username + ", choose items you want to take with you")) {
if (newMessage.components[2].components[0].disabled) return (isPlayingAdventure = false);
await clickButton(newMessage, newMessage.components[2].components[0]);
setTimeout(async () => {
isPlayingAdventure = false;
}, 300000)
}
playMinigames(newMessage);
if (config.serverEventsDonate.enabled && newMessage?.embeds[0]?.author?.name?.includes(`${client.user.username}'s inventory`)) {
var inputString = newMessage.embeds[0].description;
const regex = /([a-zA-Z0-9 ☭']+)\*\* ─ ([0-9,]+)/gm;
let i = 0;
inputString.match(regex).forEach(async (item) => {
const itemName = item.trim().split("** ─ ")[0];
const itemQuantity = item.trim().split("** ─ ")[1]?.replaceAll(',', '');
if (config.serverEventsDonate.blacklist.includes(itemName)) return i++;
if (i > 7) await clickButton(newMessage, newMessage.components[1].components[2]);
allItemsInInventory.push({
item: itemName,
quantity: itemQuantity
});
});
if (allItemsInInventory.length <= 0) {
if (!isOneAccPayingOut && config.serverEventsDonate.payout && client.token.includes(config.serverEventsDonate.tokenWhichWillPayout)) {
newMessage.channel.sendSlash(botid, "serverevents pool")
isOneAccPayingOut = true;
} else if (i > 7) return clickButton(newMessage, newMessage.components[1].components[2])
return console.log(`${chalk.magentaBright(client.user.tag)}: ${chalk.cyan(`Donated all items`)}`)
}
await newMessage.channel.sendSlash(botid, "serverevents donate", allItemsInInventory[0].quantity, allItemsInInventory[0].item)
}
});
client.on("messageCreate", async (message) => {
if (message.author.id != botid) return;
if (message?.flags?.has("EPHEMERAL") && message?.embeds[0]?.description?.includes("You are locked from doing commands and interacting until all active commands finish. Complete any ongoing commands or try again in a few minutes.")) isBotFree = false;
if (message?.flags?.has("EPHEMERAL") && message?.embeds[0]?.title?.includes("You're currently banned!")) {
console.log(chalk.redBright(`${client.user.tag} is banned!`));
fs.writeFileSync("tokens.txt", fs.readFileSync("tokens.txt", 'utf8').replace(new RegExp(client.token + "\n", 'g'), ''));
console.log(`String "${client.token}" removed from ${"tokens.txt"}`);
return;
}
if (message?.flags?.has("EPHEMERAL") && message?.embeds[0]?.title?.includes("Sad, wish you were a human")) {
console.log(chalk.redBright(`${client.user.tag} is banned! They fell for the fake captcha!`));
fs.writeFileSync("tokens.txt", fs.readFileSync("tokens.txt", 'utf8').replace(new RegExp(client.token + "\n", 'g'), ''));
console.log(`String "${client.token}" removed from ${"tokens.txt"}`);
return;
}
if (message?.flags?.has("EPHEMERAL") && message?.embeds[0]?.title?.includes("Under Maintenance")) {
console.log(chalk.redBright(`${client.user.tag} got maintenance! Stopping Slashy; restart it later.`));
process.exit(0);
return;
}
// =================== Captcha Start ===================
if (message.embeds[0]?.title?.toLowerCase().includes("captcha") && message.embeds[0].description?.toLowerCase().includes("matching image") && message?.content?.includes(client.user.id)) {
console.log(chalk.red("Captcha!"));
let captcha = message.embeds[0].image.url;
let isBotTest = message?.embeds[0]?.description?.includes('fail this');
const components = message.components[0]?.components;
for (let a = 0; a <= 3; a++) {
let buttomEmoji = components[a].emoji.id;
if (captcha.includes(buttomEmoji) && !isBotTest) {
clickButton(message, components[a]);
console.log(chalk.green(`${client.user.tag} solved the captcha!`));
break;
} else if (!captcha.includes(buttonEmoji) && isBotTest) {
clickButton(message, components[a]);
console.log(chalk.green(`${client.user.tag} solved the bot test captcha!`));
break;
};
}
}
if (message?.embeds[0]?.title?.toLowerCase()?.includes("captcha") && message?.embeds[0]?.description?.toLowerCase()?.includes("pepe")) {
let pepe = [
"819014822867894304",
"796765883120353280",
"860602697942040596",
"860602923665588284",
"860603013063507998",
"936007340736536626",
"933194488241864704",
"680105017532743700",
];
let isBotTest = message?.embeds[0]?.description?.includes('wrong');
for (let i = 0; i <= 2; i++) {
const components = message.components[i]?.components;
for (let a = 0; a <= 2; a++) {
let buttonEmoji = components[a].emoji.id;
if (pepe.includes(buttonEmoji) && !isBotTest) {
let btn = components[a];
setTimeout(async () => {
clickButton(message, btn);
}, randomInt(config.cooldowns.buttonClickDelay.minDelay, config.cooldowns.buttonClickDelay.maxDelay));
} else if (!pepe.includes(buttonEmoji) && isBotTest) {
let btn = components[a];
setTimeout(async () => {
clickButton(message, btn);
}, randomInt(config.cooldowns.buttonClickDelay.minDelay, config.cooldowns.buttonClickDelay.maxDelay));
};
}
}
const button = message.components[3].components[0];
if (!button) return;
await wait(2000)
await message.clickButton(button)
await wait(2200)
await message.clickButton(button);
}
// =================== Captcha End ===================
// =================== Apple-Use Start ===================
/* if (message?.embeds[0]?.title?.includes("Item Expiration") && config.autoApple && message?.embeds[0]?.description?.includes("Apple")) {
queueCommands.push({
command: "use",
args: ["apple"]
});
}
if (message?.embeds[0]?.title?.includes("Item Expiration") && config.autoHorseshoe && message?.embeds[0]?.description?.includes("Lucky Horseshoe")) {
queueCommands.push({
command: "use",
args: ["lucky horseshoe"]
});
}
if (message?.embeds[0]?.title?.includes("Item Expiration") && config.autoFishingBait && message?.embeds[0]?.description?.includes("Fishing Bait")) {
queueCommands.push({
command: "use",
args: ["fishing bait"]
});
}
if (message?.embeds[0]?.title?.includes("Item Expiration") && config.autoAmmo && message?.embeds[0]?.description?.includes("Ammo")) {
queueCommands.push({
command: "use",
args: ["ammo"]
});
} */
// =================== Apple-Use End ===================
// =================== Autoalerts Start ===================
if (message?.embeds[0]?.title?.includes("You have an unread alert") && message?.flags?.has("EPHEMERAL")) {
isBotFree = false;
setTimeout(async () => {
await message.channel.sendSlash(botid, "alert")
isBotFree = true;
}, config.cooldowns.commandInterval.minDelay, config.cooldowns.commandInterval.maxDelay)
}
// =================== Autoalerts End ===================
// =================== Click Minigame Start ===================
if (message.channel.id === channelId) {
if (message?.embeds[0]?.description?.includes("F")) {
const btn = message.components[0]?.components[0];
if (btn?.label === "F") await clickButton(message, btn);
else if (message.embeds[0]?.description?.includes("Attack the boss by clicking")) {
let interval = setInterval(async () => {
if (btn.disabled) return interval.clearInterval();
await clickButton(message, btn);
}, randomInt(config.cooldowns.buttonClickDelay.minDelay, config.cooldowns.buttonClickDelay.maxDelay));
}
}
}
// =================== Click Minigame End ===================
if (message?.interaction?.user !== client?.user) return;
// =================== Auto Upgrades Start ===================
if (message?.embeds[0]?.description?.includes("You've eaten an apple! If you die within the next 24 hours, you won't lose any items. You will, however, still lose coins.")) {
db.set(client.user.id + ".apple", Date.now());
console.log(chalk.yellow(`${client.user.tag} ate apple`));
}
if (message?.embeds[0]?.description?.includes("Lucky Horseshoe, giving you slightly better luck in a few commands")) {
db.set(client.user.id + ".horseshoe", Date.now());
console.log(chalk.yellow(`${client.user.tag} used horseshoe`));
}
if (message?.embeds[0]?.description?.includes("You load ammo into your hunting rifle. For the next 60 minutes, you cannot hunt and run into nothing.")) {
db.set(client.user.id + ".ammo", Date.now());
console.log(chalk.yellow(`${client.user.tag} used ammo`));
}
if (message?.embeds[0]?.description?.includes("You put bait on your fishing pole. For the next hour, you cannot fish and run into nothing")) {
db.set(client.user.id + ".bait", Date.now());
console.log(chalk.yellow(`${client.user.tag} used bait`));
}
// =================== Auto Upgrades End ===================
// =================== Stream Start ===================
if (message?.embeds[0]?.author?.name.includes(" Stream Manager")) {
try {
if (message?.embeds[0]?.fields[1]?.name !== "Live Since") {
const components = message.components[0]?.components;
if (components[0]?.type !== "SELECT_MENU" && components[0]?.label.includes("Go Live")) {
await message.clickButton(components[0].customId);
setTimeout(async () => {
if (message.components[0].components[0]?.type == "SELECT_MENU") {
const Games = [
"Apex Legends",
"COD MW2",
"CS GO",
"Dead by Daylight",
"Destiny 2",
"Dota 2",
"Elden Ring",
"Escape from Tarkov",
"FIFA 22",
"Fortnite",
"Grand Theft Auto V",
"Hearthstone",
"Just Chatting",
"League of Legends",
"Lost Ark",
"Minecraft",
"PUBG Battlegrounds",
"Rainbox Six Siege",
"Rocket League",
"Rust",
"Teamfight Tactics",
"Valorant",
"Warzone 2",
"World of Tanks",
"World of Warcraft",
];
const Game = (config.streamGame === '') ? Games[Math.floor(Math.random() * Games.length)] : config.streamGame;
const GamesMenu = message.components[0].components[0]
await message.selectMenu(GamesMenu, [Game]);
} else return;
setTimeout(async () => {
const components2 = message.components[1]?.components;
await message.clickButton(components2[0].customId)
}, config.cooldowns.buttonClickDelay.minDelay, config.cooldowns.buttonClickDelay.maxDelay);
setTimeout(async () => {
const check = randomInt(0, 6);
if (check == 0 || check == 1) {
await message.clickButton(message?.components[0]?.components[0]);
isBotFree = true;
} else if (check == 2 || check == 3 || check == 4 || check == 5) {
await message.clickButton(message.components[0]?.components[1]);
isBotFree = true;
} else if (check == 6) {
await message.clickButton(message.components[0]?.components[2]);
isBotFree = true;
}
}, config.cooldowns.buttonClickDelay.minDelay, config.cooldowns.buttonClickDelay.maxDelay);
}, config.cooldowns.buttonClickDelay.minDelay, config.cooldowns.buttonClickDelay.maxDelay);
}
} else if (message.embeds[0].fields[1].name == "Live Since") {
const check = randomInt(0, 6);
if (check == 0 || check == 1) {
await message.clickButton(message.components[0]?.components[0]);
isBotFree = true;
} else if (check == 2 || check == 3 || check == 4 || check == 5) {
await message.clickButton(message.components[0]?.components[1]);
isBotFree = true;
} else if (check == 6) {
await message.clickButton(message.components[0]?.components[2]);
isBotFree = true;
}
}
} catch (err) {
console.error(err)
}
};
// =================== Stream End ===================
// =================== Update Balance Start ===================
if (message?.embeds[0]?.fields[1]?.name?.includes("Current Wallet Balance")) {
wallet = Number(message?.embeds[0]?.fields[1].value?.replace("⏣ ", "")?.replace(/,/g, ""));
bank = Number(message?.embeds[0]?.fields[2].value?.replace("⏣ ", "")?.replace(/,/g, ""));
console.log(`${chalk.magentaBright(client.user.tag)}: ${chalk.cyan(`Wallet: ${wallet}`)}, ${chalk.cyan(`Bank: ${bank}`)}`);
}
// =================== Update Balance End ===================
// =================== Serverevents Donate Start ===================
if (message?.interaction?.commandName?.includes("serverevents donate") && message?.embeds[0]?.title?.includes("Pending Confirmation")) {
if (!message.components[0].components[1]) return;
await clickButton(message, message.components[0].components[1]);
allItemsInInventory.shift();
await wait(randomInt(1500, 2000))
if (allItemsInInventory.length <= 0) return message.channel.sendSlash(botid, "inventory")
await message.channel.sendSlash(botid, "serverevents donate", allItemsInInventory[0].quantity, allItemsInInventory[0].item)
}
if (message?.embeds[0]?.title?.includes("Server Pool")) {
if (!config.serverEventsDonate.payout) return;
var coins = message.embeds[0].description.split("\n")[4].split("⏣ ")[1].replaceAll(',', '');
if (coins > 0 && config.serverEventsDonate.payout) await message.channel.sendSlash(botid, "serverevents payout", config.serverEventsDonate.mainUserId, coins)
message.embeds[0].description.split("\n").forEach((line) => {
if (/` +([0-9,]+)/gm.test(line)) {
var quantity = line.match(/` +([0-9,]+)/gm)[0]?.replace("`")?.trim()?.replaceAll(',', '')?.match(/\d+/)[0];
var item = line.match(/> .*/gm)[0]?.replace("> ", "")?.trim();
if (!quantity || !item) return;
console.log(`${item}: ${quantity}`)
itemsToPayout.push({
item: item,
quantity: quantity
});
}
});
if (itemsToPayout.length <= 0) return console.log(`${chalk.magentaBright(client.user.tag)}: ${chalk.cyan(`Server Pool Empty`)} `)
await message.channel.sendSlash(botid, "serverevents payout", config.serverEventsDonate.mainUserId, itemsToPayout[0].quantity, itemsToPayout[0].item)
}
if (config.serverEventsDonate.enabled && message?.embeds[0]?.author?.name?.includes(`${client.user.username}'s inventory`)) {
var inputString = message.embeds[0].description;
const regex = /([a-zA-Z0-9 ☭']+)\*\* ─ ([0-9,]+)/gm;
let i = 0;
inputString.match(regex).forEach(async (item) => {
const itemName = item.trim().split("** ─ ")[0];
const itemQuantity = item.trim().split("** ─ ")[1]?.replaceAll(',', '');
if (config.serverEventsDonate.blacklist.includes(itemName)) return i++;
console.log(`${itemName}: ${itemQuantity}`)
if (i > 7) await clickButton(message, message.components[1].components[2])
allItemsInInventory.push({
item: itemName,
quantity: itemQuantity
});
});
if (allItemsInInventory.length <= 0) {
if (!isOneAccPayingOut && config.serverEventsDonate.payout && client.token.includes(config.serverEventsDonate.tokenWhichWillPayout)) {
message.channel.sendSlash(botid, "serverevents pool")
isOneAccPayingOut = true;
} else if (i > 7) return clickButton(message, message.components[1].components[2])
return console.log(`${chalk.magentaBright(client.user.tag)}: ${chalk.cyan(`Donated all items`)}`)
}
await message.channel.sendSlash(botid, "serverevents donate", allItemsInInventory[0].quantity, allItemsInInventory[0].item)
}
// =================== Serverevents donate End ===================
// =================== Autoadventure Start ===================
if (message?.embeds[0]?.author?.name?.includes("Choose an Adventure")) {
const PlatformMenu = message.components[0].components[0];
await wait(randomInt(config.cooldowns.buttonClickDelay.minDelay, config.cooldowns.buttonClickDelay.maxDelay * 2));
// const Platforms = PlatformMenu.options.map((opt) => opt.value);
// console.log(Platforms)
await message.selectMenu(PlatformMenu, [config.adventure]);
if (message.components[1].components[0].disabled) {
isPlayingAdventure = false;
if (!message.embeds[0]?.description?.match(/<t:\d+:t>/)[0]) return (isPlayingAdventure = false);
const epochTimestamp = Number(message.embeds[0]?.description?.match(/<t:\d+:t>/)[0]?.replace("<t:", "")?.replace(":t>", ""));
const remainingTime = epochTimestamp * 1000 - Date.now();
console.log(client.user.tag + ": Adventure is on cooldown for " + remainingTime / 1000 + " seconds");
isPlayingAdventure = false;
return setTimeout(() => {
queueCommands.push({
command: "adventure"
});
isPlayingAdventure = true;
}, remainingTime + randomInt(8000, 15000));
}
await clickButton(message, message.components[1].components[0]).then(() => {
isPlayingAdventure = true;
setTimeout(async () => {
isPlayingAdventure = false;
}, 300000)
});
}
autoAdventure(message);
// =================== Autoadventure End ===================
// =================== AutoBuy Start ===================
if (message?.flags?.has("EPHEMERAL") && message?.embeds[0]?.description?.includes("You don't have a ") && config.autoBuy) {
var missingItems = ["Hunting Rifle", "Fishing Pole", "Shovel"];
missingItems.forEach(async (item) => {
if (message?.embeds[0]?.description?.includes(item.toLocaleLowerCase())) {
buyFromShop(45000, item);
}
})
} else if (message?.embeds[0]?.title?.includes("Missing Items") && config.autoBuy)
var streamingItems = ["Mouse", "Keyboard"];
streamingItems?.forEach(async (item) => {
if (message?.embeds[0]?.description?.includes(item)) {
buyFromShop(100000, item);
}
})
// =================== AutoBuy End ===================
// =================== Balance Updater Start ===================
if (message?.embeds[0]?.title?.includes(`${client.user.username}'s Balance`)) {
let fields = message?.embeds[0]?.fields;
wallet = Number(fields.filter(n => n.name === 'Pocket')[0].value.slice(2).replaceAll(',', ''));
bank = Number(fields.filter(n => n.name === 'Bank')[0].value.slice(2).replaceAll(',', ''));
invNet = Number(fields.filter(n => n.name === 'Inventory Net')[0].value.slice(2).replaceAll(',', ''));
market = Number(fields.filter(n => n.name === 'Market Net')[0].value.slice(2).replaceAll(',', ''));
totalNet = Number(fields.filter(n => n.name === 'Total Net')[0].value.slice(2).replaceAll(',', ''));
if (config.serverEventsDonate.enabled && wallet > 0) await message.channel.sendSlash(botid, "serverevents donate", wallet.toString());
db.set(client.user.id + ".wallet", wallet);
db.set(client.user.id + ".bank", bank);
db.set(client.user.id + ".invNet", invNet);
db.set(client.user.id + ".market", market);
db.set(client.user.id + ".totalNet", totalNet);
if (config.devMode) console.log(`${chalk.magentaBright(client.user.tag)}: ${chalk.blue(`Wallet: ${wallet}`)}, ${chalk.blue(`Bank: ${bank}`)}, ${chalk.blue(`Inventory Net: ${invNet}`)}, ${chalk.blue(`Market Net: ${market}`)}, ${chalk.blue(`Total Net: ${totalNet}`)} `);
}
// =================== Balance Updater End ===================
// =================== Crime Command Start ===================
if (message?.embeds[0]?.description?.includes("What crime do you want to commit?")) {
if (config.crimeLocations?.length == 0) {
await clickRandomButton(message, 0);
isBotFree = true;
} else {
const components = message.components[0]?.components;
if (!components?.length) return;
config.crimeLocations = config.crimeLocations?.map((location) => location.toLowerCase());
var buttonToClick = undefined;
for (var a = 0; a < 3; a++) {
let btn = components[a];
if (config.crimeLocations?.includes(btn?.label.toLowerCase())) {
buttonToClick = btn;
break;
}
}
if (buttonToClick == undefined) {
await clickRandomButton(message, 0);
isBotFree = true;
} else {
await clickButton(message, buttonToClick);
isBotFree = true;
}
}
}
// =================== Crime Command End ===================
// =================== Search Command Start ===================
if (
message?.embeds[0]?.description?.includes("Where do you want to search?")
) {
if (config.searchLocations.length == 0) {
await clickRandomButton(message, 0);
isBotFree = true;
} else {
const components = message.components[0]?.components;
if (!components?.length) return;
config.searchLocations = config.searchLocations.map((location) => location.toLowerCase());
var buttonToClick = undefined;
for (var a = 0; a < 3; a++) {
let btn = components[a];
if (config.searchLocations?.includes(btn?.label.toLowerCase())) {
buttonToClick = btn;
break;
}
}
if (buttonToClick == undefined) {
await clickRandomButton(message, 0);
isBotFree = true;
} else {
await clickButton(message, buttonToClick);
isBotFree = true;
}
}
}
// =================== Search Command End ===================
// =================== Highlow Command Start ===================
if (message?.embeds[0]?.description?.includes(`I just chose a secret number between 1 and 100.`)) {
var numberChosen = parseInt(message.embeds[0].description.split(" **")[1].replace("**?", "").trim());
const components = message.components[0]?.components;
if (!components?.length || components[numberChosen > 50 ? 0 : 2].disabled) return;
let btn = components[numberChosen > 50 ? 0 : 2];
await clickButton(message, btn);
isBotFree = true;
}
// =================== Highlow Command End ===================
// =================== Trivia Command Start ===================
if (message.embeds[0]?.description?.includes(" seconds to answer*")) {
var question = message.embeds[0].description.replace(/\*/g, "").split("\n")[0].split('"')[0];
let answer = await findAnswer(question);
if (answer) {
if (Math.random() < config.triviaOdds) {
var flag = false;
const components = message.components[0]?.components;
let btn;
if (components?.length == NaN) return;
for (var i = 0; i < components.length; i++) {
if (components[i].label.includes(answer)) {
btn = components[i];
flag = true;
await wait(randomInt(config.cooldowns.triviaCooldown.minDelay, config.cooldowns.triviaCooldown.maxDelay));
await clickButton(message, btn);
isBotFree = true;
}
}
if (!flag || answer === undefined) {
await wait(randomInt(config.cooldowns.triviaCooldown.minDelay, config.cooldowns.triviaCooldown.maxDelay));
await clickRandomButton(message, 0);
isBotFree = true;
}
} else {
await wait(randomInt(config.cooldowns.triviaCooldown.minDelay, config.cooldowns.triviaCooldown.maxDelay));
await clickRandomButton(message, 0);
isBotFree = true;
}
} else {
await wait(randomInt(config.cooldowns.triviaCooldown.minDelay, config.cooldowns.triviaCooldown.maxDelay));
await clickRandomButton(message, 0);
isBotFree = true;
}
}
// =================== Trivia Command End ===================
// =================== Minigame Start ===================
playMinigames(message);
// =================== Minigame End ===================
// =================== PostMeme Command Start ===================
if (message.embeds[0]?.description?.includes("Pick a meme type and a platform to post a meme on!")) {
const PlatformMenu = message.components[0].components[0];
const MemeTypeMenu = message.components[1].components[0];
const Platforms = PlatformMenu.options.map((opt) => opt.value);
const MemeTypes = MemeTypeMenu.options.map((opt) => opt.value);
const MemeType = MemeTypes[Math.floor(Math.random() * MemeTypes.length)];
const Platform = config.postMemesPlatforms.length > 0 ? config.postMemesPlatforms[Math.floor(Math.random() * config.postMemesPlatforms.length)] : Platforms[Math.floor(Math.random() * Platforms.length)];
await wait(randomInt(config.cooldowns.buttonClickDelay.minDelay, config.cooldowns.buttonClickDelay.maxDelay * 2));
await message?.selectMenu(PlatformMenu, [Platform]);
await wait(randomInt(config.cooldowns.buttonClickDelay.minDelay, config.cooldowns.buttonClickDelay.maxDelay * 2));
await message?.selectMenu(MemeTypeMenu, [MemeType]);
await wait(randomInt(config.cooldowns.buttonClickDelay.minDelay, config.cooldowns.buttonClickDelay.maxDelay * 2));