forked from FortniteFevers/FishBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
1615 lines (1345 loc) · 58.5 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
import json
from logging import exception
import aiofiles
import discord
from colorama import *
from discord import guild
import requests
from discord.ext import commands
from discord.ext.commands import bot
import aiohttp
import PIL
import asyncio
from os import listdir
import time
import PIL
import math
from PIL import Image, ImageFont, ImageDraw, ImageChops
import os
import json
import shutil
import math
import os
import time
import random
intents = discord.Intents.default()
from discord_slash import SlashCommand, SlashContext
from discord_slash.utils.manage_commands import create_choice, create_option
mylist = ["FishBotV2 | Support us with code 'Fevers'!", "FishBotV2 | Use /vote to vote for us", "FishBotV2 | Invite us to your server with /invite", "FishBotV2 | Make sure to support us my telling your friends about our bot!"]
choice = f'{random.choice(mylist)}'
client = commands.Bot(command_prefix='f.', intents=intents)
client.remove_command('help')
slash = SlashCommand(client, sync_commands = True)
fontSize = 40
currentSeasonNum = 19
t = time.localtime()
current_time = time.strftime("%I:%M %p")
# Fortniteapi.io api key
apikey = 'ENTER API KEY'
apiurl = 'https://fortniteapi.io/v1/loot/fish?lang=en'
headers = {'Authorization': apikey}
# Opens settings.json for Icon Generation settings
with open("settings.json") as settings:
data = json.load(settings)
imageFont = 'BurbankBigCondensed-Black.otf'
watermark = "Generated by FishBotV2"
useFeaturedIfAvaliable = 'True'
iconType = 'standard'
placeholderUrl = 'https://i.ibb.co/svXhCgN/ph.png'
@client.event
async def on_ready():
print("\nServers: " + str(len(client.guilds)))
print("Bot is ready")
print(f"Current time: {current_time}")
client.loop.create_task(looping_status())
async def looping_status():
while True:
await client.change_presence(activity=discord.Game(name=f'on {len(client.guilds)} servers!'))
await asyncio.sleep(15)
await client.change_presence(activity=discord.Game(name=f'Invite this bot by using /invite'))
await asyncio.sleep(20)
await client.change_presence(activity=discord.Game(name=f'Vote for this bot using /vote'))
await asyncio.sleep(10)
@slash.slash(name='fishexport', description='Exports all fish names and stats')
async def fishexport(ctx:SlashContext):
async with aiohttp.ClientSession() as ses:
print('\nSomeone did the export command lol\n')
req = await ses.get('https://fortniteapi.io/v1/loot/fish?lang=en', headers=headers)
fish = (await req.json())["fish"]
textfile = ""
for item in fish:
name = item["name"]
desc = item['description']
rarity = item['rarity']
textfile += f'{name} - {rarity}\n{desc}\n\n'
textfile += f'Extracted with Fevers Fish Bot'
await (await aiofiles.open(f'allfish.txt', mode='w+', encoding='utf8')).write(textfile)
file = discord.File("allfish.txt", filename="allfish.txt")
await ctx.send('Here is your fish', file=file)
@slash.slash(name='fishstats', description='Grabs fish stats of a user for the current season',
options=[
create_option(
name='username',
description='Enter username here',
option_type=3,
required=True
)
]
)
async def fishstats(ctx, *, username:str):
currentSeason = 19
print('\nSomeone did the stats command lol\n')
if username is None:
return await ctx.send("Please add a Username.")
headerslmao = {'Authorization': 'ENTER API KEY'}
response = requests.get(f'https://fortnite-api.com/v1/stats/br/v2?name={username}', headers=headerslmao)
if response.json()['status'] != 200:
return await ctx.send('Could not find account!')
accountid = response.json()['data']['account']['id']
fishapi = requests.get(f'https://fortniteapi.io/v1/stats/fish?accountId={accountid}', headers = headers)
if str(fishapi.json()['stats']) == '[]':
return ctx.send(f"**{username}** hasn't caught any fisheys this Season. 🎣")
allfishes = requests.get('https://fortniteapi.io/v1/loot/fish?lang=en', headers=headers)
for i in fishapi.json()['stats']:
if i['season'] == currentSeason:
fishstats = i['fish']
try:
await ctx.send(f'**{username}** has caught **{len(fishstats)}/{len(allfishes.json()["fish"])}** fisheys in Chapter 3, Season 1! 🎣')
except:
await ctx.send(f"**{username}** hasn't caught any fisheys this Season. 🎣")
@slash.slash(name='fishsearch', description='Can search for a fish of your choice and grab stats for it',
options=[
create_option(
name='fish',
description='Enter fish here',
option_type=3,
required=True
)
]
)
async def fishsearch(ctx, *, fish:str):
print('\nSomeone did the search command lol\n')
async with aiohttp.ClientSession() as ses:
req = await ses.get('https://fortniteapi.io/v1/loot/fish?lang=en', headers=headers)
data = (await req.json())
for i in data['fish']:
if i['name'].lower() == fish.lower():
embed = discord.Embed(color=discord.Colour.blue(), title=i['name'], description=f"```txt\nDescription: {i['description']}\nFishingspot: {i['details']}\nRarity: {i['rarity']}\nStacksize: {i['maxStackSize']}``` ")
embed.set_thumbnail(url=i['image'])
embed.set_footer(text=f'{random.choice(mylist)}')
return await ctx.send(embed=embed)
await ctx.send("Fish not found")
@slash.slash(name='sections', description='Get current/upcoming shop sections')
async def sections(ctx):
print('Someone did the shop sections command lol')
response = requests.get('https://fn-api.com/api/shop/sections')
ss = response.json()['data']['sections']
sections = ""
quantity = ""
for i in ss:
#print(f'{i["sectionName"]} - (x{i["quantity"]})\n')
quantity += f'{i["quantity"]}'
quantity2 = i["quantity"]
if quantity2>1:
sections += f'- {i["name"]} ({i["quantity"]}x)\n'
else:
sections += f'- {i["name"]}\n'
embed = discord.Embed(color=discord.Colour.blue(), title='Tonights upcoming Shop Sections:', description=f'{sections}')
embed.set_footer(text=f'{random.choice(mylist)}')
return await ctx.send(embed=embed)
@slash.slash(name='news', description='Can grab the current BR News.')
async def news(ctx):
print('Someone did the news command lol')
response = requests.get('https://fortnite-api.com/v2/news/br')
bruh = response.json()['data']['motds']
feed = ""
for feedtext in bruh:
feed2 = feedtext['title']
feed += f"• {feed2}\n"
image = response.json()['data']['image']
embed = discord.Embed(color=discord.Colour.blue(), title='CURRENT BR NEWS', description=f"```txt\n{feed}```")
embed.set_image(url=image)
embed.set_footer(text=f'{random.choice(mylist)}')
return await ctx.send(embed=embed)
@slash.slash(name='search', description='Can let you search for any item',options=[
create_option(
name='cosmetic',
description='Enter cosmetic name here',
option_type=3,
required=True
),
create_option(
name='image',
description='Would you like to generate an image for the item?',
option_type=3,
required=False,
choices=[
create_choice(
name='yes',
value='yes'
)
]
),
create_option(
name='data',
description='Would you like to show extended data for this item?',
option_type=3,
required=False,
choices=[
create_choice(
name='yes',
value='yes'
)
]
)
]
)
async def search(ctx, *, cosmetic:str, image:str=None, data:str=None):
iconType = 'new'
watermark = 'Generated by FishBot'
imageFont = 'BurbankBigCondensed-Black.otf'
placeholderUrl = 'https://i.ibb.co/svXhCgN/ph.png'
response = requests.get(f'https://fortnite-api.com/v2/cosmetics/br/search?name={cosmetic}')
if response.json()['status'] == 404:
embed = discord.Embed(
color = discord.Colour.red(),
title='Error',
description="Cosmetic not found. Make sure you're typing the name correctly!"
)
return await ctx.send(embed=embed)
i = response.json()['data']
start = time.time()
name = i['name']
id = i['id']
description = i['description']
backendtype = i['type']['value']
backendtype = backendtype.upper()
#IMAGE SAVING#
if image != None:
if useFeaturedIfAvaliable == 'True':
if i["images"]["featured"] != None:
url = i["images"]["featured"]
else:
if i['images']['icon'] != None:
url = i['images']['icon']
else:
url = 'https://i.ibb.co/KyvMydQ/do-Not-Delete.png'
else:
if i['images']['icon'] != None:
url = i['images']['icon']
else:
url = 'https://i.ibb.co/KyvMydQ/do-Not-Delete.png'
try:
r = requests.get(url)
except:
print('a')
open(f'cache/{id}temp.png', 'wb').write(r.content)
iconImg = Image.open(f'cache/{id}temp.png')
iconImg.resize((512,512),PIL.Image.ANTIALIAS)
rarity = i["rarity"]['value']
rarity = rarity.lower()
try:
raritybackground = Image.open(f'rarities/cataba/{rarity}.png').resize((512, 512), Image.ANTIALIAS).convert("RGBA")
except:
raritybackground = Image.open(f'rarities/cataba/common.png').resize((512, 512), Image.ANTIALIAS).convert("RGBA")
try:
background = Image.open(f'rarities/cataba/{rarity}_background.png').resize((512, 512), Image.ANTIALIAS).convert("RGBA")
except:
background = Image.open(f'rarities/cataba/common_background.png').resize((512, 512), Image.ANTIALIAS).convert("RGBA")
img=Image.new("RGB",(512,512))
img.paste(raritybackground)
try:
overlay = Image.open(f'rarities/cataba/{rarity}_overlay.png').resize((512, 512), Image.ANTIALIAS).convert("RGBA")
except:
overlay = Image.open(f'rarities/cataba/common_overlay.png').resize((512, 512), Image.ANTIALIAS).convert("RGBA")
img.paste(overlay, (0,0), overlay)
iconImg= Image.open(f'cache/{id}temp.png').resize((512, 512), Image.ANTIALIAS).convert('RGBA')
img.paste(iconImg, (0,0), iconImg)
img.paste(background, (0,0), background)
try:
rarityoverlay = Image.open(f'rarities/cataba/{rarity}_rarity.png').resize((512, 512), Image.ANTIALIAS).convert("RGBA")
except:
rarityoverlay = Image.open(f'rarities/cataba/placeholder_rarity.png').resize((512, 512), Image.ANTIALIAS).convert("RGBA")
img.paste(rarityoverlay, (0,0), rarityoverlay)
img.save(f'cache/{id}.png')
loadFont = 'fonts/BurbankBigRegular-BlackItalic.otf'
font=ImageFont.truetype(loadFont,31)
background = Image.open(f'cache/{id}.png')
name=name.upper()
draw=ImageDraw.Draw(background)
draw.text((256,472),name,font=font,fill='white', anchor='ms') # Writes name
description=description.upper()
font=ImageFont.truetype(loadFont,10)
draw=ImageDraw.Draw(background)
draw.text((256,501),description,font=font,fill='white', anchor='ms') # Writes description
font=ImageFont.truetype(loadFont,14)
draw=ImageDraw.Draw(background)
draw.text((6,495),backendtype,font=font,fill='white') # Writes backend type
background.save(f'icons/{id}.png')
os.remove(f'cache/{id}temp.png')
os.remove(f'cache/{id}.png')
#IMAGE SAVING#
name1 = i['name']
itemid = i['id']
itemname = i['name']
itemdesc = i['description']
itemrarity = i['rarity']['displayValue']
type = i['type']['displayValue']
tags = ''
for x in i['gameplayTags']:
tags += f"{x}\n"
if data != None:
embed = discord.Embed(color=discord.Colour.blue(), title=f'{name1}:', description=f'{itemname} {type}:\n\nID: **{itemid}**\n\nDescription of **{itemname}**: \n**{itemdesc}**')
else:
embed = discord.Embed(color=discord.Colour.blue(), title=f'{name1}:', description=f'{itemname} {type}:\n\nID: **{itemid}**\n\nDescription of **{itemname}**: \n**{itemdesc}**\n\nItem Rarity: **{itemrarity}**\n\nItem Shop Tags:\n```{tags}```')
if image != None:
file = discord.File(f"icons/{itemid}.png", filename="image.png")
embed.set_image(url="attachment://image.png")
embed.set_thumbnail(url=f'https://fortnite-api.com/images/cosmetics/br/{itemid}/icon.png')
embed.set_footer(text=f'{random.choice(mylist)}')
await ctx.send(embed=embed, file=file)
@slash.slash(name='newcosmetics', description='Grabs the newest leaked cosmetics!')
async def newcosmetics(ctx):
print('\nSomeone did the new cosmetics command')
response = requests.get('https://fortnite-api.com/v2/aes')
version = response.json()['data']['build']
version = version[19:24]
embed = discord.Embed(color=discord.Colour.blue(), title=f'New Cosmetics for Version {version}')
with open('localdata.json') as readingoldfile:
res = json.load(readingoldfile)['latestleaks']
embed.set_image(url=f'{res}')
embed.set_footer(text=f'{random.choice(mylist)}')
return await ctx.send(embed=embed)
@client.command()
async def fevers(ctx):
await ctx.send('Fevers is cool')
@slash.slash(name='aes', description='Grabs the current main AES Key', options=[
create_option(
name='option',
description='Please choose between the two options.',
option_type=3,
required=True,
choices=[
create_choice(
name='All',
value='All'
),
create_choice(
name='Main',
value='Main'
)
]
)
])
async def aes(ctx, option:str):
print('\nSomeone did the aes command lol')
if 'Main' in option:
response = requests.get('https://fortnite-api.com/v2/aes')
version = response.json()['data']['build']
version = version[19:24]
response = requests.get('https://fortnite-api.com/v2/aes')
json = response.json()['data']
main = json['mainKey']
embed = discord.Embed(color=discord.Colour.blue(), title=f'Current main AES Key for **v{version}0:**', description=f"```txt\n0x{main}```")
embed.set_footer(text=f'{random.choice(mylist)}')
return await ctx.send(embed=embed)
if 'All' in option:
response = requests.get('https://fortnite-api.com/v2/aes')
version = response.json()['data']['build']
version = version[19:24]
response = requests.get('https://fortnite-api.com/v2/aes')
json = response.json()['data']
main = json['mainKey']
dynamic = response.json()['data']['dynamicKeys']
dynkey = ''
for dynamickeys in dynamic:
key = dynamickeys['key']
pak = dynamickeys['pakFilename']
if 'optional-WindowsClient' not in pak and '.ucas' not in pak:
dynkey += (f'{pak}: \n*0x{key}*\n\n')
embed = discord.Embed(color=discord.Colour.blue(), title=f'Current **Main** AES Key for v{version}0:', description=f'\n0x{main}\n\n**Dynamic Keys**:\n\n{dynkey}')
embed.set_footer(text=f'{random.choice(mylist)}')
try:
return await ctx.send(embed=embed)
except:
return await ctx.send('Could not post AES keys due to the text being too big.\n\nTry again soon, or use the **f.aes** command to get the main aes.')
@slash.slash(name='invite', description='Sends an invite link for FishBotV2 to add to your server.')
async def invite(ctx):
embed = discord.Embed(title='Invite me to your Server here!\n\nhttps://discord.com/api/oauth2/authorize?client_id=892855105261563945&permissions=8&scope=bot%20applications.commands')
await ctx.send(embed=embed)
@slash.slash(name='newids', description='Grabs the new or leaked ids from the current Fortnite version')
async def newids(ctx):
print('\nSomeone did the ids command lol')
response = requests.get('https://fortnite-api.com/v2/aes')
version = response.json()['data']['build']
version = version[19:24]
response = requests.get('https://fortnite-api.com/v2/cosmetics/br/new')
data = response.json()['data']['items']
ids = ''
for itemids in data:
single = itemids['id']
ids += "• " + single + '\n'
#print(ids)
try:
embed = discord.Embed(color=discord.Colour.blue(), title=f'Current new IDs for version **v{version}0.**', description=f"```{ids}```")
return await ctx.send(embed=embed)
except:
return await ctx.send("Could not grab IDs due to string being too big. Please go to this link for the IDs:\n\nhttps://pastebin.com/raw/iyqwjBXB")
@slash.slash(name='ping', description='pong!')
async def ping(ctx):
await ctx.send(f'My ping is {round(client.latency * 1000)}ms!')
@slash.slash(name='stats', description='Can grab the normal BR stats of a user.',
options=[
create_option(
name='username',
description='Enter username here',
option_type=3,
required=True
)
]
)
async def stats(ctx, *, username:str=None):
await ctx.defer()
from tabs.overall import overall
from tabs.solos import solos
from tabs.duos import duos
from tabs.squads import squads
from tabs.other import other
with open('localdata.json') as readingoldfile:
res = json.load(readingoldfile)['statsbg']
r = requests.get(res)
open(f'DO NOT DELETE/background.png', 'wb').write(r.content)
foreground= Image.open('DO NOT DELETE/background.png').resize((1920, 1080), Image.ANTIALIAS)
img=Image.open(f'DO NOT DELETE/overlay.png')
foreground.paste(img, (0, 0), img)
foreground.save('DO NOT DELETE/bgfinal.png')
if username is None:
embed = discord.Embed(
color = discord.Colour.red(),
title='Error',
description="Username not found. Make sure you're typing the account name correctly!"
)
return await ctx.send(embed=embed)
headerslmao = {'Authorization': '60bcad5e-fe7c-4734-92a9-986b81f99444'}
response = requests.get(f'https://fortnite-api.com/v2/stats/br/v2?name={username}', headers=headerslmao)
data = response.json()
if data['status'] != 200:
embed = discord.Embed(
color = discord.Colour.red(),
title='Error',
description="Username not found. Make sure you're typing the account name correctly!"
)
return await ctx.send(embed=embed)
start = time.time()
background = Image.open(f'DO NOT DELETE/bgfinal.png')
loadFont = 'DO NOT DELETE/BurbankBigCondensed-Black.otf'
x = data['data']
# Overall Code
overall(data, loadFont, background, x)
# Solos Code
solos(data, loadFont, background, x)
# Duos Code
try:
duos(data, loadFont, background, x)
except:
pass
# Squads Code
try:
squads(data, loadFont, background, x)
except:
pass
other(data, loadFont, background, x)
end = time.time()
background.save(f'Stats.png')
embed = discord.Embed(
title = f'{username} Stats'
)
file = discord.File(f"Stats.png", filename="image.png")
embed.set_image(url="attachment://image.png")
embed.set_footer(text=f'generated image in {round(end - start, 4)} seconds')
await ctx.send(embed=embed, file=file)
@slash.slash(name='pak', description='Grab cosmetics from ANY pak of your choice!',
options=[
create_option(
name='pak',
description='Enter pak number here',
option_type=3,
required=True
)
]
)
async def pak(ctx, *, pak:str=None):
await ctx.defer()
print(f'\nSomeone grabbed pak {pak}!')
response = requests.get(f'https://fortnite-api.com/v2/cosmetics/br/search/all?dynamicPakId={pak}')
if response.json()['status'] != 200:
embed=discord.Embed(title="ERROR", description="An error had occured; pak not found or API error.", color=0xff0000)
return await ctx.send(embed=embed)
#time.sleep(2)
#exit()
names = ''
for i in response.json()['data']:
name = i['name']
id = i['id']
type = i['type']['displayValue']
imageurl = i['images']['icon']
names += f'- **[{name}]({imageurl})** ({type})\n*{id}*\n\n'
embed = discord.Embed(
title=f'Cosmetics in Pak {pak}',
description = names
)
num = len(response.json()['data'])
embed.set_footer(text=f'Found {num} items in pak {pak}.')
await ctx.send(embed=embed)
@slash.slash(name='weaponid', description='Add a weapon ID and grab the stats of that weapon!',
options=[
create_option(
name='weapon',
description='Enter weapon name here',
option_type=3,
required=True
)
]
)
async def weaponid(ctx, *, weapon:str=None):
print('\nSomeone did the weapons command lol')
msg = await ctx.send('Please wait...')
response = requests.get('https://fortniteapi.io/v1/loot/list?lang=en', headers=headers)
weapons = response.json()["weapons"]
if weapon is None:
return await ctx.send("Please add a Weapon ID.")
for i in weapons:
if i['id'].lower() == weapon.lower():
name = i['name']
id = i['id']
desc = i['description']
rarity = i['rarity']
url = i["images"]["background"]
embed = discord.Embed(color=discord.Colour.blue(), title=f'{name} Weapon:', description=f'ID: **{id}**\n\nDescription: **{desc}**\n\nRarity: **{rarity}**')
embed.set_image(url=f'{url}')
embed.set_footer(text=f'{random.choice(mylist)}')
await msg.delete()
return await ctx.send(embed=embed)
@slash.slash(name='wids', description='Can find wids of any weapon to then use with the weaponid command!', options=[
create_option(
name='weapon',
description='Enter weapon id here',
option_type=3,
required=True
)
])
async def wids(ctx, *, weapon:str=None):
print('\nSomeone did the wids command')
if weapon is None:
return await ctx.send('Please enter a weapon name.')
response = requests.get('https://fortniteapi.io/v1/loot/list?lang=en', headers=headers)
weapons = response.json()["weapons"]
widlol = ''
SendWIDS = 'False'
for i in weapons:
name = i['name']
if weapon.lower() in name.lower():
name = i['name']
rarity1 = i['rarity']
rarity = rarity1.title()
id = i['id']
widlol += f'• {id} - **{name}** (*{rarity}*)\n'
SendWIDS += 'lmfaolmfao'
if SendWIDS == 'False':
embed=discord.Embed(title="ERROR", description="Could not find a valid WID or AGID for this item.", color=0xff0000)
return await ctx.send(embed=embed)
try:
embed = discord.Embed(color=discord.Colour.blue(), title=f'All WIDs for "{weapon.title()}":', description=f'{widlol}')
except:
embed=discord.Embed(title="ERROR", description="WID list is too big. Sending list anyway.", color=0xff0000)
await ctx.send(embed=embed)
await (await aiofiles.open(f'wids.txt', mode='w+', encoding='utf8')).write(widlol)
file = discord.File("wids.txt", filename="wids.txt")
await ctx.send(f'Heres the list of WIDs for {weapon.title()}', file=file)
embed.set_footer(text=f'{random.choice(mylist)}')
return await ctx.send(embed=embed)
@slash.slash(name='map', description='View the current (or past) Fortnite map', options=[
create_option(
name='version',
description='custom map version (put as ? for a list)',
option_type=3,
required=False
)
])
async def map(ctx, *, version:str=None):
print('\nSomeone did the map command lol')
if version == None:
response = requests.get('https://fortnite-api.com/v1/map')
map = response.json()['data']['images']['blank']
response = requests.get('https://fortnite-api.com/v2/aes')
version = response.json()['data']['build']
version = version[19:24]
embed = discord.Embed(color=discord.Colour.blue(), title=f'Battle Royale Map for verison {version}', description=f'')
embed.set_image(url=f'https://media.fortniteapi.io/images/map.png')
embed.set_footer(text=f'{random.choice(mylist)}')
return await ctx.send(embed=embed)
if version != None:
response = requests.get('https://fortniteapi.io/v1/maps/list', headers=headers)
if version == '?':
textfile = ''
for i in response.json()['maps']:
version = i['patchVersion']
textfile += f'{version}\n'
await (await aiofiles.open(f'mapversions.txt', mode='w+', encoding='utf8')).write(textfile)
file = discord.File("mapversions.txt", filename="mapversions.txt")
return await ctx.send('Here are all of the versions to use with the Map Command.', file=file)
x = response.json()['maps']
for i in x:
patchVersion = i['patchVersion']
if version == patchVersion:
image = i['url']
try:
image = i['urlPOI']
if image != None:
pass
else:
image = i['url']
except:
pass
embed = discord.Embed(color=discord.Colour.blue(), title=f'Fortnite Map | Version = v{patchVersion}', description=f'')
embed.set_image(url=f'{image}')
embed.set_footer(text=f'{random.choice(mylist)}')
return await ctx.send(embed=embed)
else:
i = 1
if i == 1:
msg = await ctx.send('Invalid verison, try again.')
else:
pass
@slash.slash(name='progressbar', description='sends an image of of the current Fortnite Season progress')
async def progressbar(ctx):
print('\nSomeone did the progress bar command lol')
response = requests.get(f'https://pastebin.com/raw/E9bbbS5R')
start_day = response.json()["start_day"]
start_month = response.json()["start_month"]
start_year = response.json()["start_year"]
end_day = response.json()["end_day"]
end_month = response.json()["end_month"]
end_year = response.json()["end_year"]
season_number = response.json()["season_number"]
import datetime
time_start = datetime.datetime(start_year, start_month, start_day)
time_now = datetime.datetime.now()
time_end = datetime.datetime(end_year, end_month, end_day)
days_left = time_end - time_now
days_left = days_left.days
days_left = days_left + 1
days_full = time_end - time_start
days_full = days_full.days
days_in = time_now - time_start
days_in = days_in.days
percent1 = (days_in / days_full)*100
percent = round(percent1)
percentage = str(percent)
percentage = percentage+'%'
with Image.open(f'pbg.png') as img:
progress_bar_amount = 43 + (percent*11.11)
img1 = ImageDraw.Draw(img)
middlepercentage = 'True'
bar_color = '#8a00a6'
img1.rectangle([(progress_bar_amount, 255), (42, 109)], fill = bar_color)
if middlepercentage == 'True':
#print('Generating middle percentage...')
imageFont = 'BurbankBigCondensed-Black.otf'
loadFont = 'fonts/'+imageFont
stroke_color = (0, 0, 0)
font=ImageFont.truetype(loadFont,100)
w,h=font.getsize(percentage)
draw=ImageDraw.Draw(img)
w1, h1 = draw.textsize(percentage, font=font)
draw.text(((670-w1)/1,140),percentage,font=font,fill='white',stroke_width=4, stroke_fill=stroke_color)
else:
pass
#print('Added bar and created image')
img.save(f'progressbar.png')
embed = discord.Embed(title=f'{season_number} Progress',
description=f'- {percent}% Completed\n- {days_left} Days left')
file = discord.File("progressbar.png", filename="image.png")
embed.set_image(url="attachment://image.png")
embed.set_footer(text=f'{random.choice(mylist)}')
await ctx.send(embed=embed, file=file)
@slash.slash(name='featuredislands', description='view all creative featured islands')
async def featuredislands(ctx):
await ctx.defer()
print('\nSomeone did the featured islands command')
response = requests.get('https://fortniteapi.io/v1/creative/featured', headers=headers)
x = response.json()['featured']
merged = ''
try:
shutil.rmtree('cnews')
os.makedirs('cnews')
except:
os.makedirs('cnews')
embed = discord.Embed(
color=discord.Colour.blue(),
title=f'Current Creative Featured Islands:',
description=f'{merged}'
)
for i in x:
name = i['title']
code = i['code']
imageurl = i['image']
r = requests.get(imageurl, allow_redirects=True)
#print('Saved image')
embed.add_field(
name=f'{code}',
value=f'[{name}]({imageurl})'
)
embed.set_footer(text=f'{random.choice(mylist)}')
return await ctx.send(embed=embed)
#async def sac(ctx):
# await ctx.send('Support our bot by using code **CEPTNITE10** in the Fortnite Item Shop!\n\nAll purchaces from our code will go straight to helping us make FishBot the *BEST* Fortnite Discord Bot!')
# return await ctx.send(file=discord.File('sac.gif'))
@client.command()
async def dababy(ctx):
await ctx.send('YEAH YEAH ❗ ❗ ❗ ❗ ❗')
return await ctx.send(file=discord.File('cover4.jpg'))
@slash.slash(name='vote' ,description='vote for me pls')
async def vote(ctx):
return await ctx.send('Vote for me on top.gg!\n\nhttps://top.gg/bot/892855105261563945')
@slash.slash(name='blogposts', description='Grabs the most recent Fortnite blog post')
async def blogposts(ctx):
print('\nsomeone did da blogposts command')
response = requests.get('https://fn-api.com/api/blogposts')
data = response.json()['data']['fortnite']['posts'][0]
embed = discord.Embed(color=discord.Colour.blue(), title=f"**{data['title']}**", description=f"{data['url']}")
embed.set_image(url=f"{data['images']['image']}")
embed.set_footer(text=f'{random.choice(mylist)}')
embed.set_author(name=f"{data['author']}", icon_url='https://pbs.twimg.com/profile_images/1371468883136286727/5TuH8hHa_400x400.jpg')
return await ctx.send(embed=embed)
@slash.slash(name='notices', description='Grabs the current Fortnite notices')
async def notices(ctx):
print('\nSomeone did the notices command lol')
response = requests.get('https://fortnitecontent-website-prod07.ol.epicgames.com/content/api/pages/fortnite-game')
notices = response.json()['emergencynoticev2']['emergencynotices']['emergencynotices']
if str(notices) == '[]':
embed=discord.Embed(title="ERROR", description="There are currently no Fortnite notices.", color=0xff0000)
return await ctx.send(embed=embed)
noticesall = ''
for i in notices:
title = i['title']
body = i['body']
noticesall += f'**{title}**\n- {body}\n\n'
embed = discord.Embed(color=discord.Color.red(), title=f'Current Fortnite Notices:', description=f'{noticesall}')
embed.set_image(url='https://pbs.twimg.com/media/EySkkucWEAUh__w?format=jpg&name=small')
embed.set_footer(text=f'{random.choice(mylist)}')
embed.set_author(name='Fortnite Notices', icon_url='https://cdn.discordapp.com/attachments/826548349662134282/831256813697630289/alert_2.png')
return await ctx.send(embed=embed)
@slash.slash(name='cid', description='Grabs character parts of any skin', options=[
create_option(
name='character',
description='Enter skin name here',
option_type=3,
required=True
)
]
)
async def cid(ctx, *, character: str=None):
print('\nSomeone did the cp command')
response = requests.get(f'https://fortnite-api.com/v2/cosmetics/br/search?name={character}&backendType=AthenaCharacter')
if response:
if response.json()['status'] != 200:
return await ctx.send(response.json()['error'])
name = response.json()['data']['name']
url = response.json()['data']['images']['icon']
id = response.json()['data']['id']
tags = response.json()['data']['gameplayTags']
allvariants = ''
if response.json()['data']['variants'] != None:
for i in response.json()['data']['variants'][0]['options']:
allvariants += f'- {name}\n\n'
#tag = i['tag']
#name = i['name']
response = requests.get(f'https://fortnitecentral.gmatrixgames.ga/api/v1/export?path={path}')
try:
cps = response.json()['jsonOutput'][0]['Properties']['BaseCharacterParts']
except:
return await ctx.send('There are no character parts availible for this item.')
allpaths = ''
for i in cps:
path = i['AssetPathName']
allpaths += f'{path}\n\n'
if allvariants == '':
embed = discord.Embed(color=discord.Colour.blue(), title=f'Character Parts for {name}', description=f'**CID:**\n{id}\n\n**Character Parts:**\n```{allpaths}```')
else:
embed = discord.Embed(color=discord.Colour.blue(), title=f'Character Parts for {name}', description=f'**CID:**\n{id}\n\n**Character Parts:**\n```{allpaths}```\n\n**Item Variants:**\n{allvariants}')
embed.set_thumbnail(url=f'{url}')
embed.set_footer(text=f'{random.choice(mylist)}')
return await ctx.send(embed=embed)
@slash.slash(name='sac', description='Search for any working support-a-creator code', options=[
create_option(
name='sac',
description='Enter code here',
option_type=3,
required=True
)
]
)
async def sac(ctx, *, sac: str=None):
if sac == None:
return await ctx.send('Make sure to enter in a Support-A-Creator Code!')
print('\nSomeone did the sac command lol')
response = requests.get(f'https://fortnite-api.com/v2/creatorcode/search?name={sac}')
if response.json()['status'] != 200:
return await ctx.send('The requested code is either invalid or was not found!')
data = response.json()['data']
code = data['code']
id = data['account']['id']
name = data['account']['name']
status = data['status']
verify = data['verified']
if verify is False:
verify = 'False'
else:
verify = 'True'
embed = discord.Embed(color=discord.Colour.blue(), title=f'Code {code} information:', description=f'**Owner Name:**\n{name}\n\n**Owner ID:**\n{id}\n\n**Code Status:**\n{status}\n\n**Verified?**\n{verify}')
embed.set_footer(text=f'{random.choice(mylist)}')
if 'intheshade' in sac:
await ctx.send('good choice, code **intheshade** is a great code.')
return await ctx.send(embed=embed)
@client.command()
async def dm(ctx, *, message):
return await ctx.author.send(f'{message}')
@slash.slash(name='say', description='the bot will repeat what you say', options=[
create_option(
name='message',
description='Enter text here',
option_type=3,
required=True
)
]
)
async def say(ctx, *, message):
print(f'\nUser echoed {message}')
if '@everyone' in message:
return await ctx.send('sike u thought lmao')
elif '@here' in message:
return await ctx.send('sike u thought lmao')
elif '@' in message:
return await ctx.send('You can not @ people in messages... sorry :/')
else:
return await ctx.send(message)
@slash.slash(name='animals', description='generate current Fortnite animals')
async def animals(ctx):