示例#1
0
 async def stats(self, ctx, platform, name):
     client = pynite.Client('6a336fec-4732-475e-909c-f1b697f01129',
                            timeout=5)
     player = await client.get_player(platform, name)
     solos = await player.get_solos()
     duos = await player.get_duos()
     squads = await player.get_squads()
     lifetime = await player.get_lifetime_stats()
     embed = discord.Embed(
         title='{}\'s Fortnite Stats'.format(name.capitalize()),
         description='Score: {}\nGames Played: {}\nTotal Wins: {} (≈{})'.
         format(lifetime[6].value, lifetime[7].value, lifetime[8].value,
                lifetime[9].value),
         color=random.choice(colors))
     embed.add_field(name='__Solos:__',
                     value='Wins- {}\nKills- {}\nK/D- {}'.format(
                         solos.top1.value, solos.kills.value,
                         solos.kd.value))
     embed.add_field(name='__Duos:__',
                     value='Wins- {}\nKills- {}\nK/D- {}'.format(
                         duos.top1.value, duos.kills.value, duos.kd.value))
     embed.add_field(name='__Squads:__',
                     value='Wins- {}\nKills- {}\nK/D- {}'.format(
                         squads.top1.value, squads.kills.value,
                         squads.kd.value))
     embed.set_thumbnail(
         url=
         'https://www.bing.com/images/search?view=detailV2&ccid=uaqvn%2bAP&id=CA6749E42352A2120D057035C610068161170402&thid=OIP.uaqvn-APfF_wdZ87rAWmYwHaEe&mediaurl=http%3a%2f%2fimages.mein-mmo.de%2fmagazin%2fmedien%2f2017%2f11%2ffortnite-battle-royale-logo.jpg&exph=959&expw=1587&q=fortnite+battle+royale&simid=608031551715017384&selectedIndex=16&adlt=strict'
     )
     embed.set_footer(text='Requested By {}'.format(ctx.message.author))
     await self.client.say(embed=embed)
示例#2
0
async def main():

    client = pynite.Client(token, timeout=5)

    platform = 'pc'  # Platform can be pc, psn, or xbl
    name = 'muselk'  # epic games username

    player = await client.get_player(platform, name)
    solos = await player.get_solos()
    duos = await player.get_duos()
    squads = await player.get_squads()
    lifetime = await player.get_lifetime_stats()

    print(player.account_id)  # prints account id
    print(solos.kills.value)  # prints the number of kills you have in solos
    print(duos.avg_time_played.display_value)
    print(squads.top3.value)
    print(lifetime[10].key + ': ' + lifetime[10].value)
示例#3
0
 def __init__(self, bot):
     self.bot = bot
     self.client = pynite.Client('token', timeout=5)
示例#4
0
 def __init__(self, bot):
     self.bot = bot
     self.client = pynite.Client(API_KEY_STATS, timeout=5)
示例#5
0
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'''

import discord
import os
from discord.ext import commands
import pynite
import aiohttp

bot = commands.Bot(command_prefix='-',
                   description="A fortnite server bot made by Aarrow7")
bot.remove_command("help")
forttoken = os.environ.get("frtoken")
client = pynite.Client(forttoken, timeout=5)


@bot.event
async def on_ready():
    print("I'm ready to play Fortnite")
    await bot.change_presence(game=discord.Game(name='Fortnite: Battle Royale')
                              )


@bot.command()
async def serverinfo(ctx):
    await ctx.send(
        "**Fortnite Battle Arena** is a server for discussing stuff about **Fortnite: Battle Royale**, a game created by Epic Games. We here, will give you the information regarding the game, updates and much more! You can even view your fortnite stats using this bot! Great to have you here, enjoy!"
    )
示例#6
0
 def __init__(self, bot):
     self.bot = bot
     self.client = pynite.Client(os.environ.get('TRN-Api-Key'), timeout=3)
示例#7
0
    async def fnprofile(self, ctx, name=None, *, plat=None):
        '''Get stats for your fortnite account !'''
        pages = []
        client = pynite.Client('5a20baea-b8a7-4e42-9de3-741534219452')
        player = await client.get_player(plat, name)
        lifetime = await player.get_lifetime_stats()
        solo = await player.get_solos()
        duos = await player.get_duos()
        squads = await player.get_squads()
        
        if plat is None:
            plat = 'pc'
            
        if name is None:
            return await ctx.send("Please specify a username as well as the platform (defaults to pc if not specified).")

        if plat not in ['psn', 'xbl', 'pc']:
            return await ctx.send("Invalid platform, platforms are {psn, xbl, pc}.")
        
        embed = discord.Embed(color=discord.Color.blue())
        embed.title = 'Name: ' + player.epic_user_handle + ' - LifeTime stats'
        embed.description = 'Platform: ' + player.platform_name_long
        embed.add_field(name=lifetime[9].key, value=lifetime[9].value)
        embed.add_field(name=lifetime[1].key, value=lifetime[1].value)
        embed.add_field(name=lifetime[4].key, value=lifetime[4].value)
        embed.add_field(name=lifetime[6].key, value=lifetime[6].value)
        embed.add_field(name=lifetime[7].key, value=lifetime[7].value)
        embed.add_field(name=lifetime[13].key, value=lifetime[13].value)
        embed.add_field(name=lifetime[10].key, value=lifetime[10].value)
        embed.add_field(name=lifetime[11].key, value=lifetime[11].value)
        embed.add_field(name=lifetime[12].key, value=lifetime[12].value)
        
        pages.append(embed)
        
        embed = discord.Embed(color=discord.Color.blue())
        embed.title = 'Name: ' + player.epic_user_handle + ' - Solo Stats'
        embed.description = 'Platform: ' + player.platform_name_long
        embed.add_field(name='Victory Royales', value=solo.top1.value)
        embed.add_field(name='Top 10', value=solo.top10.value)
        embed.add_field(name='Score', value=solo.score.value)
        embed.add_field(name='K/D', value=solo.kd.value)
        embed.add_field(name='Kills', value=solo.kills.value)
        embed.add_field(name='Average kills per match', value=solo.kpg.value)
        embed.add_field(name='Matches Played', value=solo.matches.value)
        
        pages.append(embed)
        
        embed = discord.Embed(color=discord.Color.blue())
        embed.title = 'Name: ' + player.epic_user_handle + ' - Duo Stats'
        embed.description = 'Platform: ' + player.platform_name_long
        embed.add_field(name='Victory Royales', value=solo.top1.value)
        embed.add_field(name='Top 10', value=duos.top10.value)
        embed.add_field(name='Score', value=duos.score.value)
        embed.add_field(name='K/D', value=duos.kd.value)
        embed.add_field(name='Kills', value=duos.kills.value)
        embed.add_field(name='Average kills per match', value=duos.kpg.value)
        embed.add_field(name='Matches Played', value=duos.matches.value)
        
        pages.append(embed)
        
        embed = discord.Embed(color=discord.Color.blue())
        embed.title = 'Name: ' + player.epic_user_handle + ' - Squad Stats'
        embed.description = 'Platform: ' + player.platform_name_long
        embed.add_field(name='Victory Royales', value=solo.top1.value)
        embed.add_field(name='Top 10', value=squads.top10.value)
        embed.add_field(name='Score', value=squads.score.value)
        embed.add_field(name='K/D', value=squads.kd.value)
        embed.add_field(name='Kills', value=squads.kills.value)
        embed.add_field(name='Average kills per match', value=squads.kpg.value)
        embed.add_field(name='Matches Played', value=squads.matches.value)
        
        pages.append(embed)
        p_session = PaginatorSession(ctx, footer=f'Bot made by Nyan Pikachu#4148 | Powered by fortnitetracker.com', pages=pages)
        await p_session.run()
示例#8
0
 def __init__(self, bot):
     self.bot = bot
     self.client = pynite.Client(os.getenv('FNTOKEN'), timeout=5)
示例#9
0
 def __init__(self, bot):
     self.bot = bot
     self.token = bot.auth.get('TRN-Api-Key')
     self.client = pynite.Client(self.token, timeout=5)