class FortniteData(): def __init__(self, name, api_key, player, platform, mode): self.name = name self.api_key = api_key self.player = player self.platform= Platform[platform] self.mode = Mode[mode] self.stats = None self.attr = {} try: # create the fortinite object self.game = Fortnite(self.api_key) self.fplayer = self.game.player(self.player, self.platform) self.update_stats() except: pass def update_stats(self): self.stats = self.fplayer.get_stats(self.mode) # transform stats into a dict self.attr['top1'] = self.stats.top1 self.attr['top3'] = self.stats.top3 self.attr['top10'] = self.stats.top10 self.attr['kills'] = self.stats.kills def print_stats(self): print(self.stats)
async def run(discord, client, message, args): if len(args) == 1: await message.channel.send( "`Használat`: !fn <pc/xbox/ps/touch/kbm> <név> <solo/duo/sqad>") await message.add_reaction("❌") return else: try: if args[1] == "kbm": platform = Platform.KBM if args[1] == "xbox": platform = Platform.XBOX if args[1] == "touch": platform = Platform.TOUCH if args[1] == "ps": platform = Platform.PSN if args[3] == "solo": mode = Mode.SOLO title = "Solo" if args[3] == "duo": mode = Mode.DUO title = "Duo" if args[3] == "squad": mode = Mode.SQUAD title = "Squad" fortnite = Fortnite("1c308369-6126-4545-a83d-95e4970b944f") player = fortnite.player(args[2], platform) stats = player.get_stats(mode) await message.channel.send(f""" **Fortnite Statisztika** `{args[2]} | {args[1]} | {args[3]}` **Nyertes Meccsek** : {stats.top1} **Top 5** : {stats.top5} **Top 10** : {stats.top10} **Ölések** : {stats.kills} """) await message.add_reaction("✅") except: await message.add_reaction("❌")
class FortniteData: def __init__(self, name, api_key, player, platform, mode): self.name = name self.api_key = api_key self.player = player self.platform = Platform[platform] self.mode = Mode[mode] self.stats = None self.attr = {} try: # create the fortnite object self.game = Fortnite(self.api_key) self.fplayer = self.game.player(self.player, self.platform) self.update_stats() except: pass def update_stats(self): self.stats = self.fplayer.get_stats(self.mode) # transform stats into a dict self.attr["top1"] = self.stats.top1 self.attr["top3"] = self.stats.top3 self.attr["top5"] = self.stats.top5 self.attr["top6"] = self.stats.top6 self.attr["top10"] = self.stats.top10 self.attr["top12"] = self.stats.top12 self.attr["top25"] = self.stats.top25 self.attr["kills"] = self.stats.kills self.attr["kd"] = self.stats.kd self.attr["kpg"] = self.stats.kpg self.attr["matches"] = self.stats.matches self.attr["score"] = self.stats.score self.attr["score_per_match"] = self.stats.score_per_match # self.attr["to_snake"] = self.stats.to_snake ### doesn't work! self.attr["id"] = self.stats.id self.attr["win_ratio"] = self.stats.win_ratio # self.attr["trn_rating"] = self.stats.trn_rating # self.attr["from_json"] = self.stats.from_json # self.attr["winratio"] = self.stats.winratio def print_stats(self): print(self.stats)
from fortnite_python.domain import Mode from fortnite_python.domain import Platform to = '9255239257' fortnite = Fortnite('2097c63b-b464-4712-9fe8-8e1bfeb73281') t = input("What is your fortnite username: "******"What is your platform: ") carrier = input( "What carrier domain: sprint, verizon, atnt, tmobile, xfinity: ") carrier_domain = '' if i == 'pc': player = fortnite.player(t) elif i == 'xbox': player = fortnite.player(t, Platform.XBOX) else: player = fortnite.player(t, Platform.PSN) sprint = '@messaging.sprintpcs.com' verizon = '@vtext.com' atnt = '@txt.att.net' tmobile = '@tmomail.net' xfinity = '@vtext.com' #Carrier selctors if carrier == 'sprint': carrier_domain = sprint
from fortnite_python import Fortnite fortnite = Fortnite('d8411c39-894a-43a8-ac54-f871950fe28b') player = fortnite.player('zombiegaming21')
@dataclass class Player: kills: int = 0 wins: int = 0 magnus = Player() noah = Player() adam = Player() # api key 302de567-30de-4c7f-9051-ecf44d843c08 from https://fortnitetracker.com/site-api fortnite = Fortnite('302de567-30de-4c7f-9051-ecf44d843c08') player = fortnite.player('weyhe', Platform.PSN) solo = player.getStats(Mode.SOLO) duo = player.getStats(Mode.DUO) squad = player.getStats(Mode.SQUAD) magnus.wins = int(solo.wins) + int(duo.wins) + int(squad.wins) magnus.kills = int(solo.kills) + int(duo.kills) + int(squad.kills) player = fortnite.player('noahcb2007', Platform.PSN) solo = player.getStats(Mode.SOLO) duo = player.getStats(Mode.DUO) squad = player.getStats(Mode.SQUAD) noah.kills = int(solo.kills) + int(duo.kills) + int(squad.kills)