-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.js
1292 lines (1284 loc) · 63.5 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 4.1.1
const version = "4.1.1";
const chalk = require("chalk");
console.log(chalk.red(`Donkzz has started!!`))
console.log(chalk.hex('#FFA500')(`If you encounter any issues, join our Discord: \nhttps://discord.gg/7A6gAdnBaw`))
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.flowMode) console.log(chalk.redBright('Flow Mode is experimental. You may want to turn this off.'))
if (config.serverEventsDonate.enabled) console.log(chalk.redBright('ServerEvents 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.'))
const ignorableErrors = [
"Cannot read properties of undefined",
"Cannot read properties of null",
"INTERACTION_TIMEOUT",
"BUTTON_NOT_FOUND",
"Invalid Form Body",
"COMPONENT_VALIDATION_FAILED: Component validation failed"
];
process.on("unhandledRejection", (error) => {
if (ignorableErrors.some(str => error.toString().includes(str))) {
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 db = new SimplDB();
axios.get("https://raw.githubusercontent.com/snappiee/Donkzz/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 by running the updater. \n" + chalk.underline("https://github.com/snappiee/Donkzz\n")));
}
}).catch((error) => {
console.log(error);
});
var logs = [];
const {
Client,
BaseSelectMenuInteraction
} = 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.username)}: ${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 isBotFree = true;
var isOnBreak = false;
var botNotFreeCount = 0;
var isDeadMeme = false;
var isHavingInteraction = false;
var isHavingCaptcha = false;
var beingNormal = true;
var isPausing = false;
var flowChecking = false;
var flowStarted = false;
var isHavingCooldown = false;
var timeoutID = null;
var toExit = false;
var buyShovel = false;
var buyRifle = false;
var wordemoji = "";
var emoji = "";
var words = "";
var MolePosition = "";
var UpcomingPosition = "";
var MolePositionID = 0;
var UpcomingPositionID = 0;
var scratchRemaining = 0;
const client = new Client({
checkUpdate: false
});
var channel;
client.on("rateLimit", (rateLimitInfo) => {
console.log(chalk.white.bold(client.user.username + " - 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.username)}`);
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.username} 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.username} claimed daily`));
setInterval(async () => {
channel.sendSlash(botid, "daily");
db.set(client.user.id + ".daily", Date.now());
console.log(chalk.yellow(`${client.user.username} claimed daily`));
}, remainingTime + randomInt(10000, 60000));
}).catch((e) => {
return console.log(e);
});
}
}
if (config.serverEventsDonate.enabled) {
await channel.sendSlash(botid, "withdraw", "max")
await channel.sendSlash(botid, "serverevents donate", "all").catch((e) => console.log(e));
}
db.set(client.user.id + ".username", client.user.username);
if (config.serverEventsDonate.enabled) return channel.sendSlash(botid, "inventory")
if (config.autoApple) {
if (config.RemoveAppleWhenUse) {
await channel.sendSlash(botid, "remove", "apple");
await wait(400);
console.log(chalk.cyan(`${client.user.username}: Successfully removed Apple before using`));
}
await channel.sendSlash(botid, "use", "apple");
console.log(chalk.cyan(`${client.user.username}: Successfully used Apple!`));
}
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 () => {
channel.sendSlash(botid, "use", "lucky horseshoe").catch((e) => {
return console.error(e);
});
}, randomInt(5000, 15000))
}
}
if (!db.get(client.user.id + ".ammo") || Date.now() - db.get(client.user.id + ".ammo") > 1 * 60 * 60 * 1000) {
if (config.autoAmmo) {
setTimeout(async () => {
channel.sendSlash(botid, "use", "ammo").catch((e) => {
return console.error(e);
});
}, randomInt(5000, 15000))
}
}
if (!db.get(client.user.id + ".pizza") || Date.now() - db.get(client.user.id + ".ammo") > 0.5 * 60 * 60 * 1000) {
if (config.autoPizza) {
setTimeout(async () => {
channel.sendSlash(botid, "use", "pizza").catch((e) => {
return console.error(e);
});
}, randomInt(5000, 15000))
}
}
if (config.autoAdventure) {
await channel.sendSlash(botid, "adventure");
await wait(300);
}
if (config.autoWork) {
await channel.sendSlash(botid, "work shift");
await wait(300);
}
if (config.autoScratch) {
await channel.sendSlash(botid, "scratch");
await wait(300);
}
setTimeout(() => {
main(onGoingCommands, channel, client, flowChecking, beingNormal);
}, 60000);
});
client.on('interactionModalCreate', modal => {
if (modal.title == "Dank Memer Shop") {
modal.components[0].components[0].setValue("1");
modal.reply();
console.log(chalk.cyan(`${client.user.username}: Successfully bought an item (shovel/rifle)`));
isHavingInteraction = false;
}
if (modal.title == "Provide flow ID") {
let flowID = config.flowID.toString();
modal.components[0].components[0].setValue(flowID);
modal.reply();
console.log(client.user.username + ": Successfully imported flowID: " + config.flowID);
isHavingInteraction = false;
}
});
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") || newMessage.embeds[0]?.fields[0]?.value?.includes("dead meme")) {
isDeadMeme = true;
setTimeout(() => {
isDeadMeme = false;
}, 3.02 * 1000 * 60);
}
// =================== Dead Meme End =====================
// =================== MoleMan Update Message ============
if (newMessage?.embeds[0]?.description?.includes("Dodge the Worms!")) {
playMoleMan(newMessage);
}
// ================== MoleMan Minigame End
// ================== Loot Notifications
if (newMessage?.embeds[0]?.description?.includes("Mole Man, nice catch!")) {
console.log(chalk.cyan(`${client.user.username}: Successfully caught a Mole Man!`));
}
if (newMessage?.embeds[0]?.description?.includes("Dragon, nice shot!")) {
console.log(chalk.cyan(`${client.user.username}: Successfully caught a Dragon!`));
}
// =================== Loot Notifications End ============
// =================== Work Notifications Start ==========
if (newMessage?.embeds[0]?.footer?.text?.includes("Working as")) {
await channel.sendSlash(botid, "balance");
return setTimeout(() => {
channel.sendSlash(botid, "work shift");
}, randomInt(3600000, 3650000));
}
// =================== Work Notifications End ============
// =================== Emoji Minigame Start ==============
if (newMessage?.embeds[0]?.description?.includes("the emoji?")) {
playEmoji(newMessage);
}
// =================== Emoji Minigame End ==============
// =================== Word-Color Minigame Start ==============
if (newMessage?.embeds[0]?.description?.includes("What color was next to")) {
playWordColor(newMessage);
}
// =================== Word-Color Minigame End ==============
// =================== Word Order Minigame Start ==============
if (newMessage?.embeds[0]?.description?.includes("Click the buttons in correct order")) {
playWordOrder(newMessage);
}
// =================== Word Order Minigame End ==============
// =================== Scratch Prompt Start ================
if (newMessage?.embeds[0]?.description?.includes("You can scratch")) {
scratchRemaining = newMessage?.embeds[0]?.description?.split("**")[1];
var m = scratchRemaining - 1;
if (m == -1) {
let btn = newMessage?.components[4].components[3];
await clickButton(newMessage, btn);
await wait(5000);
if (config.flowMode) await channel.sendSlash(botid, "flow start", config.flowID);
return setTimeout(() => {
channel.sendSlash(botid, "scratch");
}, randomInt(10800000, 11000000));
} else {
const i = randomInt(0, 2);
let btn = newMessage.components[m].components[i];
await clickButton(newMessage, btn);
console.log(chalk.cyan(`${client.user.username}: Successfully scratching (Remaining: ${m}/4)`));
}
}
// =================== Scratch Prompt End ================
// =================== Adventure Start ===================
autoAdventure(newMessage);
if (newMessage?.embeds[0]?.title?.includes(client.user.username + ", choose items you want to bring along")) {
if (newMessage.components[2]?.components[0]) {
if (newMessage.components[2]?.components[0].disabled) return (isHavingInteraction = false);
await clickButton(newMessage, newMessage.components[2]?.components[0]);
setTimeout(async () => {
isHavingInteraction = false;
}, 300000)
}
if (!newMessage.components[2]?.components[0]) {
if (newMessage.components[1]?.components[0].disabled) return (isHavingInteraction = false);
await clickButton(newMessage, newMessage.components[1]?.components[0]);
setTimeout(async () => {
isHavingInteraction = 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.username)}: ${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?.content?.includes(config.prefix)) {
if (message?.content?.includes("pause")) {
isPausing = true;
console.log("Bot paused.");
} else if (message?.content?.includes("resume")) {
isPausing = false;
console.log("Bot resumed.");
if (config.flowMode == true) await channel.sendSlash(botid, "flow start", config.flowID);
} else if (message?.content?.includes("stop")) toExit = true;
}
if (message.author.id != botid && config.flowMode == false) return;
// =================== Heist Prompt Start =====================
if (message?.embeds?.length && message?.embeds[0]?.title && message?.embeds[0]?.title?.includes("bank robbery")) {
console.log(chalk.cyan(`${client.user.username}: Detected bankrob`));
await channel.sendSlash(botid, "deposit", "max");
await wait(5000)
await clickButton(message, message.components[0].components[0]);
console.log(chalk.cyan(`${client.user.username}: Successfully joined bankrob`));
}
// ==================== Heist Prompt End ======================
if (message.channel.id != channelId && config.flowMode == true) return;
if (message?.flags?.has("EPHEMERAL") && message?.embeds[0]?.title?.includes("You're currently banned!")) {
console.log(chalk.redBright(`${client.user.username} is banned!`));
fs.writeFileSync("tokensOld.txt", client.token + "\n");
console.log(`String "${client.token}" wrote on ${"tokensOld.txt"}`);
isHavingCaptcha = true;
}
if (message?.flags?.has("EPHEMERAL") && message?.embeds[0]?.description?.includes("passed the captcha")) {
isHavingCaptcha = false;
main(onGoingCommands, channel, client, flowChecking, beingNormal);
}
if (message?.flags?.has("EPHEMERAL") && isPausing == false && isHavingInteraction == false && isOnBreak == false && isHavingCaptcha == false && (message?.embeds[0]?.title?.includes("Upcoming Commands") || message?.embeds[0]?.footer?.text.includes("flow - "))) {
if (config.flowMode == false) {
await clickButton(message, message?.components[0]?.components[2]);
return;
}
if (config.flowMode == true && toExit == true) {
await clickButton(message, message?.components[0]?.components[2]);
process.exit(0);
}
if (isOnBreak) return;
let NextButton = message?.components[0].components[0];
let skipToNextButton = message?.components[0].components[1];
let commandRunning = message?.components[0]?.components[0]?.label?.split(" ")[1];
if (isHavingCooldown == true) {
await clickButton(message, skipToNextButton);
console.log(client.user.username + ": Skipped command: " + commandRunning);
isHavingCooldown = false;
return;
}
await wait(randomInt(config.cooldowns.commandInterval.minDelay, config.cooldowns.commandInterval.maxDelay));
await clickButton(message, NextButton);
if (timeoutID) {
clearTimeout(timeoutID);
}
timeoutID = setTimeout(() => {
channel.sendSlash(botid, "flow start", config.flowID);
console.log(client.user.username + ": Resent flow start.");
}, 30000);
console.log(`${chalk.magentaBright(client.user.username)}: ${chalk.blue(commandRunning)}`)
}
if (message?.flags?.has("EPHEMERAL") && message?.embeds[0]?.description?.includes("You are unable to interact")) {
await wait(10000);
}
if (message?.flags?.has("EPHEMERAL") && message?.embeds[0]?.footer?.text?.includes("Select matching item image.")) {
console.log(chalk.redBright(`${client.user.username} is being suspicious! Solve the captcha yourself!`));
fs.writeFileSync("tokensOld.txt", client.token + "\n");
console.log(`String "${client.token}" wrote on ${"tokensOld.txt"}`);
isHavingCaptcha = true;
if (config?.webhookLogging && config?.webhook) {
webhook.send("<@" + config.mainUserId + ">" + "<@" + client.user.id + ">" + client.user.username + ": is having captcha!");
}
}
if (message?.flags?.has("EPHEMERAL") && message?.embeds[0]?.description?.includes("You don't have a shovel") && config.autoBuy) {
console.log(client.user.username, ", Preparing to buy a shovel");
buyShovel = true;
openShop();
}
if (message?.flags?.has("EPHEMERAL") && message?.embeds[0]?.description?.includes("You don't have a hunting rifle") && config.autoBuy) {
console.log(client.user.username, ", Preparing to buy a rifle");
buyRifle = true;
openShop();
}
if (message?.flags?.has("EPHEMERAL") && message?.embeds[0]?.title?.includes("Hold tight! Maintenance in progress.")) {
console.log(chalk.redBright(`${client.user.username} got maintenance! Stopping Donkzz; restart it later.`));
process.exit(0);
}
// =================== 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 ===================
// =================== Shop Coupon confirmation ==============
if (message.embeds[0]?.description?.includes("Would you like to use your") || message.embeds[0]?.fields?.value?.includes("Would you like to use your")) {
await clickButton(message, message.components[0].components[0]);
console.log(client.user.username + ": Skipped using Shop Coupon");
}
// =================== Shop Confirmation 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 && config.flowMode == false) 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.username} 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());
setTimeout(() => {
channel.sendSlash(botid, "use", "horseshoe");
}, 900000 + randomInt(8000, 15000));
console.log(chalk.yellow(`${client.user.username} 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());
setTimeout(() => {
channel.sendSlash(botid, "use", "ammo");
}, 3600000 + randomInt(8000, 15000));
console.log(chalk.yellow(`${client.user.username} used ammo`));
}
if (message?.embeds[0]?.description?.includes("You eat the perfect slice of pizza.")) {
db.set(client.user.id + ".pizza", Date.now());
setTimeout(() => {
channel.sendSlash(botid, "use", "pizza");
}, 1800000 + randomInt(8000, 15000));
console.log(chalk.yellow(`${client.user.username} used pizza`));
}
// =================== Auto Upgrades End ===================
//==================== Flow Check Start ====================
if (message?.embeds[0]?.footer?.text?.includes("GRIND") && message?.embeds[0]?.title?.includes("Flows")) {
await clickButton(message, message.components[1].components[1]);
console.log(client.user.username + ": Importing the flowID: " + config.flowID);
isHavingInteraction = true;
} else if (message?.embeds[0]?.footer?.text?.includes("Empty") && message?.components[0]?.components[3]?.disabled) {
await clickButton(message, message.components[1].components[0]);
console.log(client.user.username + ": Importing the flowID: " + config.flowID);
isHavingInteraction = true;
} else if (message?.flags?.has("EPHEMERAL") && message?.embeds[0]?.description?.includes("invalid")) {
await message?.channel.sendSlash(botid, "flow list");
if (!message?.components[1]?.components[1].disabled) clickButton(message, message?.components[1]?.components[1]);
console.log(client.user.username + ": Importing the flowID: " + config.flowID);
isHavingInteraction = true;
} else if (flowStarted == false && message?.embeds[0]?.title?.includes("Flows")) {
message.channel.sendSlash(botid, "flow start", config.flowID);
flowStarted = true;
}
if (message?.embeds[0]?.description?.includes("cooldown is") && config.flowMode == true) {
await channel.sendSlash(botid, "balance");
isHavingCooldown = true;
}
// =================== Flow Check 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 ===================
// =================== 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.username)}: ${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.username)}: ${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) {
if (!message.embeds[0]?.description?.match(/<t:\d+:t>/)[0]) {
isHavingInteraction = false;
console.log(`${chalk.magentaBright(client.user.username)}: ${chalk.cyan(" Having no tickets, queued adventure for 24 minutes later.")}`);
return setTimeout(() => {
channel.sendSlash(botid, "adventure")
isHavingInteraction = true;
}, randomInt(1440000, 1500000));
}
isHavingInteraction = 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.username + ": Adventure is on cooldown for " + Math.round(remainingTime / 60000) + " minute(s)");
isHavingInteraction = false;
return setTimeout(() => {
channel.sendSlash(botid, "adventure")
isHavingInteraction = true;
}, remainingTime + randomInt(8000, 15000));
}
await clickButton(message, message.components[1].components[0]).then(() => {
isHavingInteraction = true;
setTimeout(async () => {
isHavingInteraction = false;
}, 300000)
});
}
autoAdventure(message);
// =================== Autoadventure 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 ==================
// =================== Work Applying =================
if (message?.embeds[0]?.title?.includes("You don't currently have a job")) {
await channel.sendSlash(botid, "work apply", "Discord Mod");
console.log(chalk.cyan(`${client.user.username}: Successfully applied a job.`));
}
// =================== Giveaway Command Start ===================
if (message?.embeds[0]?.title?.includes("Giveaway")) {
await clickButton(message, message.components[0].components[0]);
console.log(chalk.cyan(`${client.user.username}: Successfully joined giveaway`));
}
// =================== Giveaway Command End ===================
// =================== Shop Command Start =====================
if (message?.embeds[0]?.title?.includes("Shop")) {
if (buyRifle == true) {
await clickButton(message, message.components[2].components[1]);
buyRifle = false;
}
if (buyShovel == true) {
await clickButton(message, message.components[2].components[0]);
buyShovel = false;
}
}
//==================== Shop Command End ======================
// =================== Scratch Command Start =================
if (message?.embeds[0]?.description?.includes("You can scratch")) {
if (!message?.flags?.has("EPHEMERAL")) {
const i = randomInt(0, 2);
let btn = message?.components[4].components[i];
await clickButton(message, btn);
console.log(chalk.cyan(`${client.user.username}: Successfully started scratching (Remaining: 3/4)`));
} else if (message?.flags?.has("EPHEMERAL")) {
if (message?.embeds[0]?.description?.includes("again")) {
const epochTimestamp = Number(message.embeds[0]?.description?.match(/<t:\d+:R>/)[0]?.replace("<t:", "")?.replace(":R>", ""));
const remainingTime = epochTimestamp * 1000 - Date.now();
console.log(client.user.username + ": Scratch is on cooldown for " + Math.round(remainingTime / 60000) + " minute(s)");
return setTimeout(() => {
channel.sendSlash(botid, "scratch");
}, remainingTime + randomInt(8000, 15000));
} else if (message?.embeds[0]?.description?.includes("vote")) {
console.log(client.user.username + ": Scratch is not ready, you have to vote first.")
}
}
}
// =================== Scratch Command End ====================
// =================== Work Command Queue =====================
if (message?.embeds[0]?.description?.includes("You can work again at")) {
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.username + ": Work is on cooldown for " + Math.round(remainingTime / 60000) + " minute(s)");
return setTimeout(() => {
channel.sendSlash(botid, "work shift");
}, remainingTime + randomInt(8000, 15000));
}
// =================== Work Command Queued ====================
// =================== 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));
await message?.selectMenu(PlatformMenu, [Platform]);
await wait(randomInt(config.cooldowns.buttonClickDelay.minDelay, config.cooldowns.buttonClickDelay.maxDelay));
await message?.selectMenu(MemeTypeMenu, [MemeType]);
await wait(randomInt(config.cooldowns.buttonClickDelay.minDelay, config.cooldowns.buttonClickDelay.maxDelay));
await clickButton(message, message.components[2]?.components[0]);
isBotFree = true;
}
// =================== PostMeme Command End ===================
});
client.login(token).catch((err) => {
if (err.toString().includes("TOKEN_INVALID")) {
console.log(`${chalk.redBright("ERROR:")} ${chalk.blueBright("The token you provided is invalid")} - ${chalk.blue(token)}`);
}
});
async function playMinigames(message, newMessage) {
let description = message?.embeds[0]?.description?.replace(/<a?(:[^:]*:)\d+>/g, "$1");
let description2 = message?.embeds[0]?.description;
let positions = description?.split("\n").slice(1).map((e) => e.split(":").filter((e) => e !== ""));
if (description?.includes("Dodge the Fireball!")) {
let fireballPostion = positions[1].length - 1;
let safePostion = ["Left", "Middle", "Right"].filter((e, idx) => idx !== fireballPostion);
let buttons = message.components[0]?.components;
let btn = buttons.filter((e) => safePostion.includes(e.label))[randomInt(0, 1)];
message.clickButton(btn);
} else if (description?.includes("Dunk the ball!")) {
let ballPostion = positions[0].length - 1;
let btn = message.components[0]?.components[ballPostion];
message.clickButton(btn)
} else if (description?.includes("Hit the ball!")) {
let goalkeeperPostion = positions[1].length - 1;
let safePostion = ["Left", "Middle", "Right"].filter((e, idx) => idx !== goalkeeperPostion);
let buttons = message.components[0]?.components;
let btn = buttons.filter((e) => safePostion.includes(e.label))[randomInt(0, 1)];
message.clickButton(btn);
} else if (description2?.includes("Look at each color next to the word")) {
isHavingInteraction = true;
wordemoji = description2?.split("!\n")[1]; // declare var wordemoji for updated messages
} else if (description2?.includes("Remember words order!")) {
isHavingInteraction = true;
words = description2?.split("!\n")[1]; // declare var words for updated messages
} else if (description2?.includes("Look at the emoji closely!")) {
isHavingInteraction = true;
emoji = description2?.split("!\n")[1]; // declare var emoji for updated messages
} else if (description2?.includes("Dodge the Worms!")) {
console.log(client.user.username + " playing Mole Man minigame");
playMoleMan(message);
}
}
async function autoAdventure(newMessage) {
if (!newMessage?.interaction.commandName.includes("adventure")) return;
if (!newMessage.interaction) return;
if (!newMessage.components[0]) return;
if (newMessage?.embeds[0]?.title?.includes(client.user.username + ", choose items you want to bring along")) return;
if (newMessage?.embeds[0]?.author?.name?.includes("Adventure Summary")) {
isHavingInteraction = false;
let btn = newMessage.components[0].components[0];
let btnLabel = btn.label;
var time = btnLabel.match(/in \d+ minutes/)[0]?.replace("in ", "")?.replace(" minutes", "");
console.log(`${client.user.username}: Finished playing adventure. Next adventure in ${time} minutes`);
if (config.flowMode == true) await channel.sendSlash(botid, "flow start", config.flowID);
setTimeout(() => {
channel.sendSlash(botid, "adventure")
}, randomInt(Number(time) * 60 * 1000, Number(time) * 1.1 * 60 * 1000));
}
if (newMessage?.components[0]?.components[1]?.disabled) return clickButton(newMessage, newMessage.components[1].components[1]);
if (!newMessage?.components[1]?.components[1]) return clickButton(newMessage, newMessage.components[0].components[1]);
const database = require(`./adventures/${config.adventure}.json`).database;
const answer = database.find((e) => e.name.includes(newMessage?.embeds[0]?.description?.split("<")[0]?.split("\n")[0]?.trim()))?.click;
var found = false;
if (answer) {
for (let i = 0; i < newMessage.components.length; i++) {
for (let j = 0; j < newMessage.components[i].components.length; j++) {
if (newMessage?.components[i]?.components[j]?.label?.toLowerCase()?.includes(answer.toLowerCase())) {
found = true;
await clickButton(newMessage, newMessage.components[i].components[j]);
await wait(200)
if (!newMessage.components[i].components[j].disabled) await clickButton(newMessage, newMessage.components[i].components[j]);
await clickButton(newMessage, newMessage.components[1].components[1])
await wait(250)
if (!newMessage.components[1].components[1].disabled) await clickButton(newMessage, newMessage.components[1].components[1])
}
}
}
if (!found) {
await clickButton(newMessage, newMessage.components[0].components[randomInt(0, newMessage.components[0].components.length - 1)]).then(() => {
setTimeout(async () => {
isHavingInteraction = false;
}, 300000)
});
}
} else {
if (newMessage?.embeds[0]?.description?.includes("Catch one of em!")) {
await clickButton(newMessage, newMessage.components[0].components[2]);
await wait(randomInt(config.cooldowns.buttonClickDelay.minDelay, config.cooldowns.buttonClickDelay.maxDelay));
await clickButton(newMessage, newMessage.components[1].components[1]);
return;
}
await clickButton(newMessage, newMessage.components[0].components[randomInt(0, newMessage.components[0].components.length - 1)]);
}
}
async function openShop() {
await channel.sendSlash(botid, "withdraw", "50k");
await wait(400);
await channel.sendSlash(botid, "shop view");
}
async function playWordOrder(message) {
for (var i = 0; i < 5; i++) {
var attempts = i + 1;
var word = words.split("\n")[i];
var word2 = word.split("`")[1];
for (var k = 0; k < 5; k++) {
let btnz = message?.components[0]?.components[k];
await wait(1000);
if (word2.includes(btnz.label.toLowerCase()) && !btnz.disabled) {
setTimeout(() => {
clickButton(message, btnz);
}, 2000);
await wait(1000);
console.log(chalk.cyan(`${client.user.username}: Successfully played the word order minigame. (${attempts}/5)`));
}
}
isHavingInteraction = false;
}
}
async function playWordColor(message) {
//build color components
const colMarine = "marine";
const colCyan = "cyan";
const colWhite = "white";
const colBlack = "black";
const colGreen = "green";
const colYellow = "yellow";
//build emoji components
const emojiMarine = "<:Marine:863886248572878939>";
const emojiCyan = "<:Cyan:863886248670265392>";
const emojiYellow = "<:Yellow:863886248296316940>";
const emojiGreen = "<:Green:863886248527134730>";
const emojiBlack = "<:Black:863886248431190066>";
const emojiWhite = "<:White:863886248689926204>";
//parsing and responding block
var wordAsked = message?.embeds[0]?.description.split("`")[1];
var line = "";
var colorAsked = "";
for (var i = 0; i < 3; i++) {
line = wordemoji.split("\n")[i];
if (line.includes(wordAsked)) {
if (line.includes(emojiMarine)) {
colorAsked = colMarine;
}
if (line.includes(emojiCyan)) {
colorAsked = colCyan;
}
if (line.includes(emojiWhite)) {
colorAsked = colWhite;
}