-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbot.py
2992 lines (2630 loc) · 121 KB
/
bot.py
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
# If you have any issues with the softwere, please join our discord server at https://dsc.gg/AutoLeak #
import requests
import tweepy
import time
import urllib.request
import PIL
import math
from PIL import Image, ImageFont, ImageDraw, ImageChops
import os
import json
import glob
import shutil
import math
import datetime
import webbrowser
from datetime import date
from datetime import datetime
import random
now = datetime.now()
current_time = now.strftime("%H:%M")
from os import listdir
from colorama import *
init()
loop = True
count = 1
fontSize = 40
initialCheckDelay = 2
currentVersion = '1.3.8'
os.system("cls")
os.system(
"TITLE AutoLeak / Created by Fevers.")
try:
# Removes the placeholder
os.remove('icons/placeholder.txt')
except:
pass
# Starting Popup
import ctypes
rannumber = random.randint(1, 2)
if rannumber == 1:
def Mbox(title, text, style):
return ctypes.windll.user32.MessageBoxW(0, text, title, style)
Mbox('AutoLeak - Created by Fevers.', f'Hey There! Welcome to AutoLeak, the easiest way to Auto-Leak Fortnite. \nMake sure to join our discord by clicking the OK button!\n\n\nYou are on AutoLeak version v{currentVersion}!', 0)
webbrowser.open_new('https://discord.gg/UZgHArwp4f')
else:
pass
# Used to communicate with updates
response = requests.get('https://pastebin.com/raw/zku0yz9q')
ln1 = response.json()["1"]
ln2 = response.json()["2"]
ln3 = response.json()["3"]
ln4 = response.json()["4"]
ln5 = response.json()["5"]
ln6 = response.json()["6"]
ln7 = response.json()["7"]
latestVersion = response.json()["latestVersion"]
print("")
print("------------------------------------------------------------------------------------------------")
print("")
print(ln1) #############################################################################
print(ln2) # DO NOT REMOVE THESE LINES OF CODE! #
print(ln3) # IT IS UESD TO COMMUNICATE UPDATES WITH YOU WHEN YOU LAUNCH THE PROGRAM! #
print(ln4) # IF YOU REMOVE IT YOU WILL NOT BE ALERTED WITH NEWS AND NEW UPDATES! #
print(ln5) #############################################################################
print(ln6)
print(ln7)
print("")
print("------------------------------------------------------------------------------------------------")
print("")
print("Version info:")
print("")
if latestVersion == currentVersion:
print(Fore.GREEN + '--> This version of AUTOLEAK is up to date!')
else:
print(Fore.RED + '--> You are currently running v'+currentVersion+' of AutoLeak, v'+latestVersion+' is now avaliable - Please check #updates in the AutoLeak discord server for the update!')
print("")
print(Style.RESET_ALL + "------------------------------------------------------------------------------------------------")
print("")
# Used to communicate with settings.json, grab all user inputs from it.
with open("settings.json") as settings:
data = json.load(settings)
try:
name = data["name"]
namelol = data["name"]
print(Fore.GREEN + 'Loaded "name" as "'+name+'"')
except:
name = 'AutoLeak'
print(Fore.RED + 'Failed to load "name", defaulted to "AutoLeak"')
try:
footer = data["footer"]
print(Fore.GREEN + 'Loaded "footer" as "'+footer+'"')
except:
footer = '#Fortnite'
print(Fore.RED + 'Failed to load "footer", defaulted to "#Fortnite"')
try:
language = data["language"]
if language == 'ar' or language == 'de' or language == 'en' or language == 'es' or language == 'es-419' or language == 'fr' or language == 'it' or language == 'ja' or language == 'ko' or language == 'pl' or language == 'pt-BR' or language == 'de' or language == 'ru' or language == 'tr' or language == 'zh-CN' or language == 'zh-Hant':
print(Fore.GREEN + 'Loaded "language" as "'+language+'"')
else:
language = 'en'
print(Fore.YELLOW + 'Incorrect value for language was given so I have loaded "language" as "en"')
except:
language = 'False'
print(Fore.RED + 'Failed to load "language", defaulted to "en"')
try:
imageFont = data["imageFont"]
print(Fore.GREEN + 'Loaded "imageFont" as "'+imageFont+'"')
except:
imageFont = 'BurbankBigCondensed-Black.otf'
print(Fore.RED + 'Failed to load "imageFont", defaulted to "BurbankBigCondensed-Black.otf"')
try:
placeholderUrl = data["placeholderUrl"]
print(Fore.GREEN + 'Loaded "placeholderUrl" as "'+placeholderUrl+'"')
except:
placeholderUrl = 'https://i.imgur.com/W22Foja.png'
print(Fore.RED + 'Failed to load "placeholderUrl", set to default placeholder url.')
try:
watermark = data["watermark"]
print(Fore.GREEN + 'Loaded "watermark" as "'+watermark+'"')
except:
watermark = ''
print(Fore.RED + 'Failed to load "watermark", ignored, program will be ran without a watermark.')
try:
useFeaturedIfAvaliable = data["useFeaturedIfAvaliable"]
if useFeaturedIfAvaliable == 'True' or useFeaturedIfAvaliable == 'False':
print(Fore.GREEN + 'Loaded "useFeaturedIfAvaliable" as "'+useFeaturedIfAvaliable+'"')
else:
useFeaturedIfAvaliable = 'False'
print(Fore.YELLOW + 'Incorrect value for useFeaturedIfAvaliable was given so I have loaded "useFeaturedIfAvaliable" as "False"')
except:
useFeaturedIfAvaliable = 'False'
print(Fore.RED + 'Failed to load "useFeaturedIfAvaliable", defaulted to "False"')
try:
iconType = data["iconType"]
if iconType == 'standard' or iconType == 'clean' or iconType == 'new':
print(Fore.GREEN + 'Loaded "iconType" as "'+iconType+'"')
else:
iconType = 'standard'
print(Fore.YELLOW + 'Incorrect value for iconType was given so I have loaded "iconType" as "standard"')
except:
iconType = 'standard'
print(Fore.RED + 'Failed to load "iconType", defaulted to "standard"')
try:
benbot = data['BenBot']
if benbot == 'True':
print(Fore.GREEN + f'Loaded BenBot API.')
if benbot == 'False':
print(Fore.GREEN + 'Loaded Fortnite-API.')
except:
benbot = 'False'
print(Fore.RED + 'Failed to load "ApiType", defaulting to "Fortnite-API"...')
try:
twitAPIKey = data["twitAPIKey"]
if twitAPIKey == '':
twitAPIKey = 'XXX'
print(Fore.GREEN + 'Loaded "twitAPIKey" as "'+twitAPIKey+'"')
except:
twitAPIKey = 'XXX'
print(Fore.RED + 'Failed to load "twitAPIKey", defaulted to "XXX"')
try:
twitAPISecretKey = data["twitAPISecretKey"]
print(Fore.GREEN + 'Loaded "twitAPISecretKey" as "'+twitAPISecretKey+'"')
except:
twitAPISecretKey = 'XXX'
print(Fore.RED + 'Failed to load "twitAPISecretKey", defaulted to "XXX"')
try:
twitAccessToken = data["twitAccessToken"]
print(Fore.GREEN + 'Loaded "twitAccessToken" as "'+twitAccessToken+'"')
except:
twitAccessToken = 'XXX'
print(Fore.RED + 'Failed to load "twitAccessToken", defaulted to "XXX"')
try:
twitAccessTokenSecret = data["twitAccessTokenSecret"]
print(Fore.GREEN + 'Loaded "twitAccessTokenSecret" as "'+twitAccessTokenSecret+'"')
except:
twitAccessTokenSecret = 'XXX'
print(Fore.RED + 'Failed to load "twitAccessTokenSecret", defaulted to "XXX"')
try:
tweetUpdate = data["tweetUpdate"]
if tweetUpdate == 'True' or tweetUpdate == 'False':
print(Fore.GREEN + 'Loaded "tweetUpdate" as "'+tweetUpdate+'"')
else:
tweetUpdate = 'False'
print(Fore.YELLOW + 'Incorrect value for tweetUpdate was given so I have loaded "tweetUpdate" as "False"')
except:
tweetUpdate = 'False'
print(Fore.RED + 'Failed to load "tweetUpdate", defaulted to "False"')
try:
tweetAes = data["tweetAes"]
if tweetAes == 'True' or tweetAes == 'False':
print(Fore.GREEN + 'Loaded "tweetAes" as "'+tweetAes+'"')
else:
tweetAes = 'False'
print(Fore.YELLOW + 'Incorrect value for tweetAes was given so I have loaded "tweetAes" as "False"')
except:
tweetAes = 'False'
print(Fore.RED + 'Failed to load "tweetAes", defaulted to "False"')
try:
BotDelay = data['BotDelay']
print(Fore.GREEN + f'Loaded "BotDelay" as {BotDelay} seconds.')
except:
BotDelay = 30
print(Fore.RED + 'Failed to load "BotDelay", defaulted to 30 seconds.')
try:
twitsearch = data['TweetSearch']
if twitsearch == 'True' or twitsearch == 'False':
print(Fore.GREEN + f'Loaded "Tweet Search" as {twitsearch}.')
else:
twitsearch = 'True'
print(Fore.YELLOW + 'Incorrect value for "Twitter Search", defaulting to "True"...')
except:
twitsearch = 'False'
print(Fore.RED + 'Failed to load "Tweet Search", defaulting to "False"...')
try:
MergeImagesAuto = data['MergeImages']
if MergeImagesAuto == 'True' or MergeImagesAuto == 'False':
print(Fore.GREEN + f'Loaded "MergeImages" as "{MergeImagesAuto}"')
else:
MergeImagesAuto = 'True'
print(Fore.YELLOW + f'Incorrect value for MergeImages was given so I have loaded "MergeImages" as "True"')
except:
print(Fore.YELLOW + 'Incorrect value for "MergeImages", defaulting to "True"...')
MergeImagesAuto = 'True'
try:
CreatorCode = data['CreatorCode']
if CreatorCode != '':
print(Fore.GREEN + f'Loaded "CreatorCode" as "{CreatorCode}')
else:
print(Fore.GREEN + 'Loaded Creator Code as none.')
CreatorCode = ''
except:
CreatorCode = ''
print(Fore.YELLOW + 'Incorrect value for "CreatorCode", defaulting to none.')
try:
apikey = data['apikey']
if apikey != "":
print(Fore.GREEN + f'Loaded "API Key" as "{apikey}"')
else:
print(Fore.GREEN + 'Loaded API Key as none.')
CreatorCode = ''
except:
apikey = ''
print(Fore.YELLOW + 'Incorrect value for "apikey", defaulting to none.')
try:
showitemsource = data['showitemsource']
showitemsource = showitemsource.title()
if showitemsource != "":
print(Fore.GREEN+f'Loaded "showitemsource" as "{showitemsource}"')
else:
print(Fore.GREEN+f'Loaded showitemsource as False.')
except:
print(Fore.YELLOW+'Incorrect value for "ShowItemSource", defaulting to True.')
showitemsource = 'True'
try:
mergewatermark = data['MergeWatermarkUrl']
if mergewatermark != "":
print(Fore.GREEN+f'Loaded "MergeWatermark" as "{mergewatermark}')
else:
print(Fore.GREEN+f'Loaded "MergeWatermark" as None.')
mergewatermark = ""
except:
print(Fore.YELLOW+'Incorrect value for "mergewatermark", defaulting to None.')
mergewatermark = ""
# Sets up Twitter API keys
auth = tweepy.OAuthHandler(twitAPIKey, twitAPISecretKey)
auth.set_access_token(twitAccessToken, twitAccessTokenSecret)
api = tweepy.API(auth)
# Sets up fortniteapi.io API key
headers = {'Authorization': apikey}
#-------------------#-------------------#
# Defines update mode
def update_mode():
#Grabs Build
response = requests.get('https://fortnite-api.com/v2/aes')
updateCompare = response.json()['data']['build']
# Grabes AES
aesCompare = response.json()['data']['mainKey']
count = 1
initialCheckDelay = 2
while 1: # While 1 checks for a Fortnite Update
response = requests.get('https://fortnite-api.com/v2/aes')
if response:
print(Fore.YELLOW+ f'Waiting for Fortnite update -> [Count: {count}] BenBot = {benbot}')
status = response.json()["status"]
if status != 200:
if status == 503:
error = response.json()["error"]
print(Fore.RED + f"ERROR: {error} please wait...")
else:
print(Fore.RED + "Error in AES Endpoint (Status is not 200 or 503) - Retrying... (This is an error with fortnite-api.com)")
time.sleep(initialCheckDelay)
else:
versionLoop = response.json()["data"]["build"]
count = count + 1
if updateCompare != versionLoop:
while 2: # If it detects an update, THEN post build and map.
print("")
print(Fore.GREEN+"Detected windows update! Starting "+name+"...")
if tweetUpdate == 'True':
api.update_status('['+name+'] New Update Detected!\n\n'+str(versionLoop)+'\n\n'+footer)
print(Fore.GREEN+"Tweeted 'Status 1' (Includes: Update notification)")
#==========#
if tweetUpdate == 'True':
#=== MAP ===#
print('\nTweeting map...')
response = requests.get('https://fortnite-api.com/v1/map')
map = response.json()['data']['images']['blank']
r = requests.get(map, allow_redirects=True)
open('map.png', 'wb').write(r.content)
print("Opened map.png")
img=Image.open('map.png')
img=img.resize((1200,1200),PIL.Image.ANTIALIAS)
img.save('map.png')
response = requests.get('https://benbot.app/api/v1/status')
version = response.json()['currentFortniteVersionNumber']
api.update_with_media('smallmap.png', f'#Fortnite Map Update:\n\nBattle Royale map for v{version}0.')
#=== MAP ===#
#=== VERSIONBOT ===#
response = requests.get('https://benbot.app/api/v1/aes')
aes = response.json()['mainKey']
response = requests.get('https://benbot.app/api/v1/status')
version = response.json()['currentFortniteVersionNumber']
build = response.json()['currentFortniteVersion']
paks = response.json()['totalPakCount']
dynamicpaks = response.json()['dynamicPakCount']
print(f'\nThe current version v'+str(version)+'0'+' has been succesfully retrived!')
print('The AES key, Paks, and Build have now been retreived also.')
time.sleep(1)
api.update_status('A #Fortnite update has been detected... \n\nVersion Number: v'+str(version)+'0'+'\n\nBuild: '+str(build)+':\n\n'+str(paks)+' - Pak Files\n\n'+str(dynamicpaks)+' - Dynamic Pak Files'+'\n\n'+str(aes)+' - AES key')
#=== VERSIONBOT ===#
count = 1
while 3: # While 3 posts the AES key.
response = requests.get('https://fortnite-api.com/v2/aes')
if response:
status = response.json()["status"]
if status != 200:
if status == 503:
error = response.json()["error"]
print(Fore.RED + f"ERROR: {error} please wait...")
else:
print(Fore.RED + "Error in AES Endpoint (Status is not 200 or 503) - Retrying... (This is an error with fortnite-api.com)")
time.sleep(initialCheckDelay)
else:
print(Fore.YELLOW+ f"Waiting for AES update -> [Count: "+str(count)+"]")
mainKey = response.json()["data"]["mainKey"]
mainKeyVersion1 = response.json()["data"]["build"].replace('++Fortnite+Release-', '')
mainKeyVersion = mainKeyVersion1.replace('-Windows', '')
count = count + 1
if aesCompare != mainKey:
print(Fore.GREEN+"Detected aes update!")
if tweetAes == 'True':
api.update_status('['+name+'] AES Key for v'+str(mainKeyVersion)+':\n\n0x'+str(mainKey)+'\n\n'+footer)
print(Fore.GREEN + "Tweeted 'Status 2' (Includes: AES Key)")
count = 1
while 4: # While 4 checks if BenBot and/or Fortnite-API has updated with the new cosmetics.
if benbot == 'False' or 'false':
print('Loaded Fortnite-API.')
response = requests.get('https://fortnite-api.com/v2/cosmetics/br/new?language='+language)
if response:
status = response.json()["status"]
if status != 200:
if status == 503:
error = response.json()["error"]
print(Fore.RED + f"ERROR: {error} please wait...")
else:
print(Fore.RED + "Error in Cosmetics Endpoint (Status is not 200 or 503) - Retrying... (This is an error with fortnite-api.com)")
time.sleep(initialCheckDelay)
else:
print(Fore.YELLOW+ "Waiting for endpoint update -> [Count: "+str(count)+"]")
response = requests.get('https://fortnite-api.com/v2/cosmetics/br/new?language='+language)
newBuild = response.json()["data"]["build"]
count = count + 1
if versionLoop == newBuild:
generate_cosmetics()
return
else:
time.sleep(initialCheckDelay)
else:
print(Fore.RED + "Error in COSMETICS Endpoint (Page Down) - Retrying... (This is an error with fortnite-api.com)")
time.sleep(initialCheckDelay)
else: # Then loads BenBot to generate the new cosmetics.
print('Loaded BenBot.')
response = requests.get('https://benbot.app/api/v1/newCosmetics')
if response:
currentVersion = response.json()["currentVersion"]
oldVersion = response.json()['previousVersion']
# If the old version does NOT equal the current version, then an error has occured as the API should of updated already.
if oldVersion != currentVersion:
if currentVersion == oldVersion:
error = response.json()["error"]
print(Fore.RED + f"ERROR: {error} please wait...")
else:
print(Fore.RED + "Error in Cosmetics Endpoint (Status is not 200 or 503) - Retrying... (This is an error with BenBot...)")
time.sleep(initialCheckDelay)
# Everything went to plan, so do this now.
else:
print(Fore.YELLOW+ "Waiting for endpoint update -> [Count: "+str(count)+"]")
response = requests.get('https://benbot.app/api/v1/newCosmetics')
newBuild = response.json()["currentVersion"]
count = count + 1
if versionLoop == newBuild:
generate_cosmetics()
return
else:
time.sleep(initialCheckDelay)
else:
print(Fore.RED + "Error in COSMETICS Endpoint (Page Down) - Retrying... (This is an error with fortnite-api.com)")
time.sleep(initialCheckDelay)
time.sleep(initialCheckDelay)
else:
print(Fore.RED + "Error in AES Endpoint 2 (Page Down) - Retrying... (This is an error with fortnite-api.com)")
time.sleep(initialCheckDelay)
time.sleep(initialCheckDelay)
else:
print(Fore.RED + "Error in AES Endpoint 1 (Page Down) - Retrying... (This is an error with fortnite-api.com)")
time.sleep(initialCheckDelay)
def generate_cosmetics():
if iconType == 'new':
newcnew()
return
else:
pass
if benbot == 'False':
print('Loading Fortnite-API...\n')
fontSize = 40
response = requests.get('https://fortnite-api.com/v2/cosmetics/br/new?language='+language)
new = response.json()
print(f"Generating {len(new['data']['items'])} new cosmetics from Fortnite-API...")
print('')
loop = False
counter = 1
start = time.time()
for i in new["data"]["items"]:
try:
print(Fore.BLUE + "Loading image for "+i["id"])
if useFeaturedIfAvaliable == 'True':
if i["images"]["featured"] != None:
url = i["images"]["featured"]
else:
url = i["images"]["icon"]
elif useFeaturedIfAvaliable == 'False':
url = i["images"]["icon"]
placeholderImg = Image.open('assets/doNotDelete.png')
r = requests.get(url, allow_redirects=True)
open(f'cache/{i["id"]}.png', 'wb').write(r.content)
iconImg = Image.open(f'cache/{i["id"]}.png')
diff = ImageChops.difference(placeholderImg, iconImg)
if diff.getbbox():
r = requests.get(url, allow_redirects=True)
open(f'cache/{i["id"]}.png', 'wb').write(r.content)
img=Image.open(f'cache/{i["id"]}.png')
img=img.resize((512,512),PIL.Image.ANTIALIAS)
img.save(f'cache/{i["id"]}.png')
else:
try:
r = requests.get(placeholderUrl, allow_redirects=True)
open(f'cache/{i["id"]}.png', 'wb').write(r.content)
img=Image.open(f'cache/{i["id"]}.png')
img=img.resize((512,512),PIL.Image.ANTIALIAS)
img.save(f'cache/{i["id"]}.png')
except:
continue
rarity = i["rarity"]["value"]
foreground = Image.open('cache/'+i["id"]+'.png')
try:
background = Image.open(f'rarities/{iconType}/{rarity}.png')
border = Image.open(f'rarities/{iconType}/border{rarity}.png')
except:
background = Image.open(f'rarities/{iconType}/common.png')
border = Image.open(f'rarities/{iconType}/bordercommon.png')
Image.alpha_composite(background, foreground).save('cache/F'+i["id"]+'.png')
os.remove('cache/'+i["id"]+'.png')
background = Image.open('cache/F'+i["id"]+'.png')
Image.alpha_composite(background, border).save('cache/BLANK'+i["id"]+'.png')
costype = i["type"]["displayValue"]
img=Image.open('cache/BLANK'+i["id"]+'.png')
name1= i["name"]
loadFont = 'fonts/'+imageFont
if len(name1) > 20:
fontSize = 30
if len(name1) > 30:
fontSize = 20
if iconType == 'clean':
font=ImageFont.truetype(loadFont,fontSize)
w,h=font.getsize(name1)
draw=ImageDraw.Draw(img)
draw.text((25,440),name1,font=font,fill='white')
fontSize = 40
id = i["id"]
font=ImageFont.truetype(loadFont,30)
w,h=font.getsize(costype)
draw=ImageDraw.Draw(img)
draw.text((25,402),costype,font=font,fill='white')
if watermark != '':
font=ImageFont.truetype(loadFont,25)
w,h=font.getsize(watermark)
draw=ImageDraw.Draw(img)
draw.text((30,30),watermark,font=font,fill='white')
elif iconType == 'standard':
font=ImageFont.truetype(loadFont,fontSize)
w,h=font.getsize(name1)
draw=ImageDraw.Draw(img)
w1, h1 = draw.textsize(name1, font=font)
draw.text(((512-w1)/2,390),name1,font=font,fill='white')
fontSize = 40
desc = i["description"]
font=ImageFont.truetype(loadFont,15)
w,h=font.getsize(desc)
draw=ImageDraw.Draw(img)
w1, h1 = draw.textsize(desc, font=font)
draw.text(((512-w1)/2,455),desc,font=font,fill='white')
id = i["id"]
font=ImageFont.truetype(loadFont,15)
w,h=font.getsize(id)
draw=ImageDraw.Draw(img)
w1, h1 = draw.textsize(id, font=font)
draw.text(((512-w1)/2,475),id,font=font,fill='white')
font=ImageFont.truetype(loadFont,20)
w,h=font.getsize(costype)
draw=ImageDraw.Draw(img)
w1, h1 = draw.textsize(costype, font=font)
draw.text(((512-w1)/2,430),costype,font=font,fill='white')
if watermark != '':
font=ImageFont.truetype(loadFont,25)
w,h=font.getsize(watermark)
draw=ImageDraw.Draw(img)
draw.text((10,9),watermark,font=font,fill='white')
os.remove('cache/BLANK'+i["id"]+'.png')
img.save('icons/'+i["id"]+'.png')
os.remove('cache/F'+i["id"]+'.png')
percentage = counter/len(new['data']['items'])
realpercentage = percentage * 100
print(Fore.CYAN + f"Generated image for {id}")
print(Fore.CYAN + f"{counter}/{len(new['data']['items'])} - {round(realpercentage)}%")
print("")
counter = counter + 1
except:
print(Fore.YELLOW + f"Ignored due to error: "+i["id"]+"\n")
end = time.time()
print("")
print(Fore.GREEN+"")
print("! ! ! ! ! ! !")
print(f"IMAGE GENERATING COMPLETE - Generated images in {round(end - start, 2)} seconds")
print("! ! ! ! ! ! !")
if benbot == 'True':
print('Loading BenBot...\n')
fontSize = 40
response = requests.get('https://benbot.app/api/v1/newCosmetics')
new = response.json()
print(f"Generating {len(new['items'])} new cosmetics from BenBot...")
print('')
loop = False
counter = 1
start = time.time()
for i in new["items"]:
try:
print(Fore.BLUE + "Loading image for "+i["id"])
if useFeaturedIfAvaliable == 'True':
if i["icons"]["featured"] != None:
url = i["icons"]["featured"]
else:
url = i["icons"]["icon"]
elif useFeaturedIfAvaliable == 'False':
url = i["icons"]["icon"]
placeholderImg = Image.open('assets/doNotDelete.png')
r = requests.get(url, allow_redirects=True)
open(f'cache/{i["id"]}.png', 'wb').write(r.content)
iconImg = Image.open(f'cache/{i["id"]}.png')
diff = ImageChops.difference(placeholderImg, iconImg)
if diff.getbbox():
r = requests.get(url, allow_redirects=True)
open(f'cache/{i["id"]}.png', 'wb').write(r.content)
img=Image.open(f'cache/{i["id"]}.png')
img=img.resize((512,512),PIL.Image.ANTIALIAS)
img.save(f'cache/{i["id"]}.png')
else:
try:
r = requests.get(placeholderUrl, allow_redirects=True)
open(f'cache/{i["id"]}.png', 'wb').write(r.content)
img=Image.open(f'cache/{i["id"]}.png')
img=img.resize((512,512),PIL.Image.ANTIALIAS)
img.save(f'cache/{i["id"]}.png')
except:
continue
rarity = i["rarity"]
rarity = rarity.lower()
foreground = Image.open('cache/'+i["id"]+'.png')
try:
background = Image.open(f'rarities/{iconType}/{rarity}.png')
border = Image.open(f'rarities/{iconType}/border{rarity}.png')
except:
background = Image.open(f'rarities/{iconType}/common.png')
border = Image.open(f'rarities/{iconType}/bordercommon.png')
Image.alpha_composite(background, foreground).save('cache/F'+i["id"]+'.png')
os.remove('cache/'+i["id"]+'.png')
background = Image.open('cache/F'+i["id"]+'.png')
Image.alpha_composite(background, border).save('cache/BLANK'+i["id"]+'.png')
costype = i['rarity']
img=Image.open('cache/BLANK'+i["id"]+'.png')
name1= i["name"]
loadFont = 'fonts/'+imageFont
if len(name1) > 20:
fontSize = 30
if len(name1) > 30:
fontSize = 20
if iconType == 'clean':
font=ImageFont.truetype(loadFont,fontSize)
w,h=font.getsize(name1)
draw=ImageDraw.Draw(img)
draw.text((25,440),name1,font=font,fill='white')
fontSize = 40
id = i["id"]
font=ImageFont.truetype(loadFont,30)
w,h=font.getsize(costype)
draw=ImageDraw.Draw(img)
draw.text((25,402),costype,font=font,fill='white')
if watermark != '':
font=ImageFont.truetype(loadFont,25)
w,h=font.getsize(watermark)
draw=ImageDraw.Draw(img)
draw.text((30,30),watermark,font=font,fill='white')
elif iconType == 'standard':
font=ImageFont.truetype(loadFont,fontSize)
w,h=font.getsize(name1)
draw=ImageDraw.Draw(img)
w1, h1 = draw.textsize(name1, font=font)
draw.text(((512-w1)/2,390),name1,font=font,fill='white')
fontSize = 40
desc = i["description"]
font=ImageFont.truetype(loadFont,15)
w,h=font.getsize(desc)
draw=ImageDraw.Draw(img)
w1, h1 = draw.textsize(desc, font=font)
draw.text(((512-w1)/2,455),desc,font=font,fill='white')
id = i["id"]
font=ImageFont.truetype(loadFont,15)
w,h=font.getsize(id)
draw=ImageDraw.Draw(img)
w1, h1 = draw.textsize(id, font=font)
draw.text(((512-w1)/2,475),id,font=font,fill='white')
font=ImageFont.truetype(loadFont,20)
w,h=font.getsize(costype)
draw=ImageDraw.Draw(img)
w1, h1 = draw.textsize(costype, font=font)
draw.text(((512-w1)/2,430),costype,font=font,fill='white')
if watermark != '':
font=ImageFont.truetype(loadFont,25)
w,h=font.getsize(watermark)
draw=ImageDraw.Draw(img)
draw.text((10,9),watermark,font=font,fill='white')
os.remove('cache/BLANK'+i["id"]+'.png')
img.save('icons/'+i["id"]+'.png')
os.remove('cache/F'+i["id"]+'.png')
percentage = counter/len(new['items'])
realpercentage = percentage * 100
print(Fore.CYAN + f"Generated image for {id}")
print(Fore.CYAN + f"{counter}/{len(new['items'])} - {round(realpercentage)}%")
print("")
counter = counter + 1
except:
print(Fore.YELLOW + "Ignored due to error: "+i["id"])
end = time.time()
print("")
print(Fore.GREEN+"")
print("! ! ! ! ! ! !")
print(f"IMAGE GENERATING COMPLETE - Generated images in {round(end - start, 2)} seconds")
print("! ! ! ! ! ! !")
if MergeImagesAuto != 'False':
print('\nMerging images...')
if mergewatermark != '':
r = requests.get(mergewatermark, allow_redirects=True)
open('icons/zzzwatermark.png', 'wb').write(r.content)
else:
pass
images = [file for file in listdir('icons')]
count = int(round(math.sqrt(len(images)+0.5), 0))
#print(len(images), count)
xlol = len(images)
print(f'\nFound {xlol} images in "Icons" folder.')
finalImg = Image.new("RGBA", (512*count, 512*count))
#draw = ImageDraw.Draw(finalImg)
x = 0
y = 0
counter = 0
for img in images:
tImg = Image.open(f"icons/{img}")
if counter >= count:
y += 512
x = 0
counter = 0
finalImg.paste(tImg, (x, y), tImg)
x += 512
counter += 1
finalImg.show()
finalImg.save(f'merged/MERGED {xlol}.png')
print('\nSaved image!')
if twitAPIKey != 'XXX':
print('\nTweeting out image....')
print('What text do you want the Tweet to say?')
text = input()
try:
api.update_with_media(f'merged/MERGED {xlol}.png', f'[{namelol}] {text}')
except:
print(Fore.RED + 'File size is too big.')
time.sleep(5)
print('\nTweeted image successfully!')
time.sleep(5)
else:
print('Not Tweeting.')
else:
print(Fore.RED + '\nNot merging images.')
time.sleep(5)
def check_version():
response = requests.get('https://pastebin.com/raw/zku0yz9q')
latestVersion = response.json()["latestVersion"]
if currentVersion == latestVersion:
app.info("AutoLeak v"+currentVersion, "You already have the latest version")
else:
app.info("AutoLeak v"+currentVersion, f"Alert! You are using v{currentVersion} but version v{latestVersion} is avaliable!\nHead to the discord server to download the update!")
def edit_function():
os.startfile('settings.json')
def tweet_aes():
try:
response = requests.get('https://fortnite-api.com/v2/aes')
twitaes = response.json()["data"]["mainKey"]
api.update_status(f'[{namelol}] Current Fortnite AES Key:\n\n0x{str(twitaes)}\n\n{footer}')
print(Fore.GREEN+"Tweeted current aes key!")
time.sleep(5)
except:
print(Fore.RED+"Failed to tweet current aes key!")
def tweet_build():
try:
response = requests.get('https://fortnite-api.com/v2/aes')
twitbuild = response.json()["data"]["build"]
api.update_status(f'[{namelol}] Current Fortnite build:\n\n{str(twitbuild)}\n\n{footer}')
print(Fore.GREEN+"Tweeted current build!")
time.sleep(5)
except:
print(Fore.RED+"Failed to tweet current build!")
def search_cosmetic():
if iconType == 'new':
newcbeta()
else:
pass
fontSize = 40
print(Fore.GREEN +'\nWhat cosmetic do you want to grab?')
ask = input()
if benbot == 'False':
response = requests.get(f'https://fortnite-api.com/v2/cosmetics/br/search?name={ask}')
print(f'\nGenerating {ask}...')
print('')
start = time.time()
try:
i = response.json()['data']
# Item Successfully grabbed
except:
print(Fore.RED + f'Unable to retreive {ask}.')
time.sleep(5)
exit()
print(Fore.BLUE + "Loading image for "+i["id"])
if useFeaturedIfAvaliable == 'True':
if i["images"]["featured"] != None:
url = i["images"]["featured"]
else:
url = i["images"]["icon"]
elif useFeaturedIfAvaliable == 'False':
url = i["images"]["icon"]
placeholderImg = Image.open('assets/doNotDelete.png')
r = requests.get(url, allow_redirects=True)
open(f'cache/{i["id"]}.png', 'wb').write(r.content)
iconImg = Image.open(f'cache/{i["id"]}.png')
try:
diff = ImageChops.difference(placeholderImg, iconImg)
except:
print(Fore.RED + 'Could not grab icon as there is an error with the image. (Hint: Try using BenBot instead!)')
time.sleep(5)
exit()
if diff.getbbox():
r = requests.get(url, allow_redirects=True)
open(f'cache/{i["id"]}.png', 'wb').write(r.content)
img=Image.open(f'cache/{i["id"]}.png')
img=img.resize((512,512),PIL.Image.ANTIALIAS)
img.save(f'cache/{i["id"]}.png')
else:
try:
r = requests.get(placeholderUrl, allow_redirects=True)
open(f'cache/{i["id"]}.png', 'wb').write(r.content)
img=Image.open(f'cache/{i["id"]}.png')
img=img.resize((512,512),PIL.Image.ANTIALIAS)
img.save(f'cache/{i["id"]}.png')
except:
print('')
rarity = i["rarity"]["value"]
foreground = Image.open('cache/'+i["id"]+'.png')
try:
background = Image.open(f'rarities/{iconType}/{rarity}.png')
border = Image.open(f'rarities/{iconType}/border{rarity}.png')
except:
background = Image.open(f'rarities/{iconType}/common.png')
border = Image.open(f'rarities/{iconType}/bordercommon.png')
Image.alpha_composite(background, foreground).save('cache/F'+i["id"]+'.png')
os.remove('cache/'+i["id"]+'.png')
background = Image.open('cache/F'+i["id"]+'.png')
Image.alpha_composite(background, border).save('cache/BLANK'+i["id"]+'.png')
costype = i["type"]["displayValue"]
img=Image.open('cache/BLANK'+i["id"]+'.png')
name1= i["name"]
loadFont = 'fonts/'+imageFont
if len(name1) > 20:
fontSize = 30
if len(name1) > 30:
fontSize = 20
if iconType == 'clean':
font=ImageFont.truetype(loadFont,fontSize)
w,h=font.getsize(name1)
draw=ImageDraw.Draw(img)
draw.text((25,440),name1,font=font,fill='white')
fontSize = 40
id = i["id"]
font=ImageFont.truetype(loadFont,30)
w,h=font.getsize(costype)
draw=ImageDraw.Draw(img)
draw.text((25,402),costype,font=font,fill='white')
if watermark != '':