Exemple #1
0
 async def skin(self, ctx, username:str=None):
     perms = None
     if ctx.guild is not None:
         me = ctx.guild.get_member(self.bot.user.id)
         perms = ctx.channel.permissions_for(me)
         if perms.send_messages:
             if not perms.embed_links:
                 await ctx.send("Error: Cannot send embeds in this channel. Please contact a server administrator to fix this issue.")
                 return
             if perms.embed_links:
                 pass
         if not perms.send_messages:
             return
     if username==None:
         embed = discord.Embed(title="Error", description="""Please provide a username.""", color=0xff0000)
         await ctx.send(embed=embed)
         return
     uuid = MojangAPI.get_uuid(str(username))
     if uuid == '5d1f7b0fdceb472d9769b4e37f65db9f':
         embed = discord.Embed(title="Error", description="""That user does not exist.""", color=0xff0000)
         await ctx.send(embed=embed)
         return
     elif not uuid:
         embed = discord.Embed(title="Error", description="""That user does not exist.""", color=0xff0000)
         await ctx.send(embed=embed)
         return
     color=random.randint(1, 16777215)
     name = await hypixel.getname(uuid)
     embed = discord.Embed(title=f"{name}'s Skin", description=f"[Download](https://crafatar.com/skins/{uuid})", color=color)
     embed.set_image(url=f"https://crafatar.com/renders/body/{uuid}")
     await ctx.send(embed=embed)
Exemple #2
0
async def skin(ctx, *args):
    try:
        playerName = args[0]
        playerUUID = MojangAPI.get_uuid(playerName)
        nameMC = ("[NameMC Profile](https://namemc.com/profile/"
                  f"{playerUUID})")

        if playerUUID is None:
            raise NameError

        if len(args) > 1:
            skinRender = (f"https://visage.surgeplay.com/{args[1]}/"
                          f"{playerUUID}.png")

        else:
            skinRender = (f"https://visage.surgeplay.com/full/512/{playerUUID}"
                          ".png")

        skinEmbed = discord.Embed(
            title=f"{playerName}'s Skin",
            description=nameMC,
            color=discord.Color.blue(),
        )
        skinEmbed.set_image(url=skinRender)

        await ctx.send(embed=skinEmbed)
    except Exception as e:
        print(e)
        errorEmbed = discord.Embed(title="Error",
                                   description="`⛔ Could not find a player"
                                   f" with the name:{args[0]}`",
                                   color=discord.Color.red())
        await ctx.send(embed=errorEmbed)
Exemple #3
0
async def mclookup(ctx, *, message: str = None):
    uuid = MojangAPI.get_uuid(f"{message}")

    if not uuid:
        embed = discord.Embed(title="This player doesn't exist!",
                              color=discord.Color.red())
        embed.set_author(name=f'Error!', )
        embed.set_footer(
            text=
            f"MC Lookup | Requested by {ctx.author} | BOT By Junai#0001 🔧")
        print(
            f"MC Lookup | Requested by {ctx.author} | BOT By Junai#0001 🔧")
        await ctx.send(embed=embed)
    else:
        profile = MojangAPI.get_profile(uuid)
        embed = discord.Embed(title=f"Profile Details",
                              color=discord.Color.green())
        embed.add_field(name="UUID", value=uuid)
        embed.add_field(name="Skin URL", value=profile.skin_url)
        embed.add_field(name="NameMC Link",
                        value="https://namemc.com/profile/" + uuid)
        embed.set_footer(
            text=
            f"MC Lookup | Requested by {ctx.author} | BOT By Junai#0001 🔧")
        print(
            f"MC Lookup | Requested by {ctx.author} | BOT By Junai#0001 🔧")
        await ctx.send(embed=embed)
Exemple #4
0
async def pull_crafatar(ctx, query, urlbit, title, options):
    uuid = MojangAPI.get_uuid(query)
    if uuid == None:
        embed = discord.Embed(
            title="Error!",
            description="There is no user with this Minecraft username.",
            color=discord.Color.red())
        await ctx.send(embed=embed)
    else:
        title = f'{query}\'s {title}'
        imageurl = f'https://crafatar.com/{urlbit}/{uuid}{options}'
        await image_embed(ctx, title, imageurl)
Exemple #5
0
 def change_minecraft_username(self, minecraft_username):
     minecraft_id = MojangAPI.get_uuid(minecraft_username)
     if minecraft_id:
         if fetch_players_minecraft_id(minecraft_id):
             raise UsernameAlreadyExistsError(
                 f"Username {minecraft_username} already exists in the database"
             )
         update_players_minecraft_id(minecraft_id, minecraft_username,
                                     self.minecraft_id)
         self.minecraft_id = minecraft_id
         self.minecraft_username = minecraft_username
         return True
     else:
         raise UsernameDoesNotExistError(
             f"Username {minecraft_username} is not a valid Minecraft username"
         )
Exemple #6
0
 async def skin(self, ctx, *, user: str):
     uuid = MojangAPI.get_uuid(user)
     if uuid is None:
         embed = discord.Embed(title="Error",
                               description="User does not exist.",
                               color=0xdf4e4e)
         await ctx.send(embed=embed)
     else:
         skin = f"https://crafatar.com/avatars/{uuid}?overlay"
         render = f"https://crafatar.com/renders/body/{uuid}?overlay"
         e = discord.Embed(title=f"{user} (Click Here to get Download)",
                           description=f"UUID: {uuid}",
                           color=0x7ae19e,
                           url=f"https://crafatar.com/skins/{uuid}")
         e.set_thumbnail(url=skin)
         e.set_image(url=render)
         await ctx.send(embed=e)
        def setup():
            if not MojangAPI.get_uuid(mcname.get()):
                tkinter.messagebox.showerror(
                    'Error', 'Please input a correct Minecraft username.')
                return

            if not hurl.get().startswith('https://discord.com/api/webhooks/'):
                if tkinter.messagebox.askyesno(
                        'Warning',
                        'The entered Webhook URL does not seem correct. Try again?'
                ):
                    return

            if not pmode.get() in ['FULL', 'ON', 'OFF']:
                tkinter.messagebox.showerror(
                    'Error', 'Popup Mode can only be FULL or ON or OFF.')
                return

            open('.env', 'w').write(
                f'''AUTHOR={mcname.get()}\nWEBHOOK={hurl.get()}\nPOPUP={pmode.get()}'''
            )
            win.destroy()
Exemple #8
0
 async def auction(self, ctx, username: str=None, profile: str=None, auction_id: str=None):
     if ctx.guild is not None:
         me = ctx.guild.get_member(self.bot.user.id)
         perms = ctx.channel.permissions_for(me)
         if perms.send_messages:
             if not perms.embed_links:
                 await ctx.send("Error: Cannot send embeds in this channel. Please contact a server administrator to fix this issue.")
                 return
             if perms.embed_links:
                 pass
         if not perms.send_messages:
             return
     #verify if player exists
     if username==None:
         embed = discord.Embed(title="Error", description="""Please provide a username.""", color=0xff0000)
         await ctx.send(embed=embed)
         return
     if profile==None:
         embed = discord.Embed(title="Error", description="""Please provide a profile.""", color=0xff0000)
         await ctx.send(embed=embed)
         return
     if auction_id==None:
         embed = discord.Embed(title="Error", description="""Please provide an auction ID.""", color=0xff0000)
         await ctx.send(embed=embed)
         return
     uuid = MojangAPI.get_uuid(str(username))
     if uuid == '5d1f7b0fdceb472d9769b4e37f65db9f':
         embed = discord.Embed(title="Error", description="""That user does not exist.""", color=0xff0000)
         await ctx.send(embed=embed)
         return
     elif not uuid:
         embed = discord.Embed(title="Error", description="""That user does not exist.""", color=0xff0000)
         await ctx.send(embed=embed)
         return
     data = await hypixel.player(uuid)
     #errors
     if data['success'] == False:
         if data['cause'] == 'Malformed UUID':
             embed = discord.Embed(title="Error", description="""Something went wrong.""", color=0xff0000)
             await ctx.send(embed=embed)
             return
         else:
             embed = discord.Embed(title="Error", description="""Something went wrong.""", color=0xff0000)
             await ctx.send(embed=embed)
             return
     #it worked!
     elif data['success'] == True:
         if data['player'] == None:
             embed = discord.Embed(title="Error", description="""That user has never joined the Hypixel Network.""", color=0xff0000)
             await ctx.send(embed=embed)
             return
         data = await hypixel.player(uuid)
         ah = None
         i = None
         pname = 'N/A'
         for profile1 in data['player']['stats']['SkyBlock']['profiles']:
             profile1 = data['player']['stats']['SkyBlock']['profiles'][profile1]
             if profile1['cute_name'].lower() == profile.lower():
                 pname = profile1['cute_name']
                 i = 'Something'
                 ah = await hypixel.skyblock.auctions(profile1['profile_id'])
                 break
         if i is None:
             embed = discord.Embed(title="Error", description="""Invalid Skyblock profile.""", color=0xff0000)
             await ctx.send(embed=embed)
             return
         if data['success'] == False:
             embed = discord.Embed(title="Error", description="""Something went wrong.""", color=0xff0000)
             await ctx.send(embed=embed)
             return
         if ah is None:
             embed = discord.Embed(title="Error", description="""Something went wrong.""", color=0xff0000)
             await ctx.send(embed=embed)
             return
         length = len(ah['auctions'])
         color=random.randint(1, 16777215)
         if length == 0:
             data = await hypixel.getname(uuid)
             if data is None:
                 embed = discord.Embed(title="Error", description="""Something went wrong. Please try again later.""", color=0xff0000)
                 await ctx.send(embed=embed)
                 return
             name = data
             embed = discord.Embed(title = f"{name}'s Skyblock Auction on {pname}", description=f"{name} has no auctions on profile {pname}.", color = color)
             await ctx.send(embed=embed)
             return
         i = await hypixel.getname(uuid)
         if i is None:
             embed = discord.Embed(title="Error", description="""Something went wrong. Please try again later.""", color=0xff0000)
             await ctx.send(embed=embed)
             return
         name = i
         success = False
         for auction in ah['auctions']:
             if auction['_id'] == auction_id:
                 success = True
                 lore1 = auction['item_lore'].split('§', 1)
                 lore = ''
                 for i in lore1:
                     i = str(i)
                     lore = lore+i[1:]
                 time = datetime.fromtimestamp(auction['start']/1000.0)
                 started = time.strftime("%m/%d/%Y at %H:$M EST")
                 time = datetime.fromtimestamp(auction['end']/1000.0)
                 ends = time.strftime("%m/%d/%Y at %H:$M EST")
                 if auction['bin'] == True:
                     type = "BIN"
                 else:
                     type = 'Auction'
                 bids = len(auction['bids'])
                 topbid = auction['highest_bid_amount']
                 startbid = auction['starting_bid']
                 item = auction['item_name']
                 tier = auction['tier'].lower().capitalize()
                 category = auction['category'].capitalize()
                 claimed = str(auction['claimed'])
                 embed = discord.Embed(title=f"{name}'s Skyblock Auction on {pname}", color=color)
                 embed.add_field(name="Item", value=item)
                 embed.add_field(name="Item Lore", value=lore)
                 embed.add_field(name="Category", value=category)
                 embed.add_field(name="Tier", value=tier)
                 embed.add_field(name="Auction Type", value=type)
                 embed.add_field(name="Amount of Bids", value=utils.comma(bids))
                 embed.add_field(name="Starting Bid", value=utils.comma(startbid))
                 embed.add_field(name="Top Bid", value=utils.comma(topbid))
                 embed.add_field(name="Started", value=started)
                 embed.add_field(name="Ends", value=ends)
                 embed.add_field(name="Claimed", value=claimed)
                 embed.set_footer(text='Unofficial Hypixel Discord Bot')
                 await ctx.send(embed=embed)
         if success == False:
             embed = discord.Embed(title = f"Error", description=f"Invalid auction.", color = 0xff0000)
             await ctx.send(embed=embed)
             return 
Exemple #9
0
 async def bedwars(self, ctx, username: str = None):
     perms = None
     if ctx.guild is not None:
         me = ctx.guild.get_member(self.bot.user.id)
         perms = ctx.channel.permissions_for(me)
         if perms.send_messages:
             if not perms.embed_links:
                 await ctx.send(
                     "Error: Cannot send embeds in this channel. Please contact a server administrator to fix this issue."
                 )
                 return
             if perms.embed_links:
                 if not perms.add_reactions:
                     embed = discord.Embed(
                         title="Error",
                         description=
                         "Cannot add reactions in this channel. Please contact a server administrator to fix this issue.",
                         color=0xff0000)
                     await ctx.send(embed=embed)
                     return
                 if perms.add_reactions:
                     pass
         if not perms.send_messages:
             return
     #verify if player exists
     if username == None:
         embed = discord.Embed(title="Error",
                               description="""Please provide a username.""",
                               color=0xff0000)
         await ctx.send(embed=embed)
         return
     try:
         uuid = MojangAPI.get_uuid(str(username))
     except:
         embed = discord.Embed(title="Error",
                               description="""That user does not exist.""",
                               color=0xff0000)
         await ctx.send(embed=embed)
         return
     if uuid == '5d1f7b0fdceb472d9769b4e37f65db9f':
         embed = discord.Embed(title="Error",
                               description="""That user does not exist.""",
                               color=0xff0000)
         await ctx.send(embed=embed)
         return
     elif not uuid:
         embed = discord.Embed(title="Error",
                               description="""That user does not exist.""",
                               color=0xff0000)
         await ctx.send(embed=embed)
         return
     #send request
     data = await hypixel.player(uuid)
     #errors
     if data['success'] == False:
         if data['cause'] == 'Malformed UUID':
             embed = discord.Embed(title="Error",
                                   description="""Something went wrong.""",
                                   color=0xff0000)
             await ctx.send(embed=embed)
             return
         else:
             embed = discord.Embed(title="Error",
                                   description="""Something went wrong.""",
                                   color=0xff0000)
             await ctx.send(embed=embed)
             return
     elif data['success'] == True:
         if data['player'] == None:
             embed = discord.Embed(
                 title="Error",
                 description=
                 """That user has never joined the Hypixel Network.""",
                 color=0xff0000)
             await ctx.send(embed=embed)
             return
     name = await hypixel.getname(uuid)
     embeds, paginator = await Embeds().Bedwars().generate(
         ctx, name, data, perms)
     await paginator.run(embeds)
Exemple #10
0
 async def uhc(self, ctx, username: str = None):
     if ctx.guild is not None:
         me = ctx.guild.get_member(self.bot.user.id)
         perms = ctx.channel.permissions_for(me)
         if perms.send_messages:
             if not perms.embed_links:
                 await ctx.send(
                     "Error: Cannot send embeds in this channel. Please contact a server administrator to fix this issue."
                 )
                 return
             if perms.embed_links:
                 pass
         if not perms.send_messages:
             return
     #verify if player exists
     if username == None:
         embed = discord.Embed(title="Error",
                               description="""Please provide a username.""",
                               color=0xff0000)
         await ctx.send(embed=embed)
         return
     uuid = MojangAPI.get_uuid(str(username))
     if uuid == '5d1f7b0fdceb472d9769b4e37f65db9f':
         embed = discord.Embed(title="Error",
                               description="""That user does not exist.""",
                               color=0xff0000)
         await ctx.send(embed=embed)
         return
     elif not uuid:
         embed = discord.Embed(title="Error",
                               description="""That user does not exist.""",
                               color=0xff0000)
         await ctx.send(embed=embed)
         return
     data = await hypixel.player(uuid)
     #errors
     if data['success'] == False:
         if data['cause'] == 'Malformed UUID':
             embed = discord.Embed(title="Error",
                                   description="""Something went wrong.""",
                                   color=0xff0000)
             await ctx.send(embed=embed)
             return
         else:
             embed = discord.Embed(title="Error",
                                   description="""Something went wrong.""",
                                   color=0xff0000)
             await ctx.send(embed=embed)
             return
     #it worked!
     elif data['success'] == True:
         if data['player'] == None:
             embed = discord.Embed(
                 title="Error",
                 description=
                 """That user has never joined the Hypixel Network.""",
                 color=0xff0000)
             await ctx.send(embed=embed)
             return
     try:
         coins = data['player']['stats']['UHC']['coins']
     except:
         coins = 'N/A'
     try:
         deaths = data['player']['stats']['UHC']['deaths']
     except:
         deaths = 'N/A'
     try:
         score = data['player']['stats']['UHC']['score']
     except:
         score = 'N/A'
     try:
         kills = data['player']['stats']['UHC']['kills']
     except:
         kills = 'N/A'
     try:
         wins = data['player']['stats']['UHC']['wins']
     except:
         wins = 'N/A'
     data = await hypixel.getname(uuid)
     if data is None:
         embed = discord.Embed(
             title="Error",
             description="""Something went wrong. Please try again later.""",
             color=0xff0000)
         await ctx.send(embed=embed)
         return
     color = random.randint(1, 16777215)
     embed = discord.Embed(title=data + "'s UHC Stats", color=color)
     embed.set_thumbnail(url=f"https://crafatar.com/renders/head/{uuid}")
     embed.add_field(name="Coins",
                     value=str(utils.comma(coins)),
                     inline=True)
     embed.add_field(name="Score",
                     value=str(utils.comma(score)),
                     inline=True)
     embed.add_field(name="Wins", value=str(utils.comma(wins)), inline=True)
     embed.add_field(name="Kills",
                     value=str(utils.comma(kills)),
                     inline=True)
     embed.add_field(name="Deaths",
                     value=str(utils.comma(deaths)),
                     inline=True)
     try:
         embed.add_field(name="K/D Ratio",
                         value=str(utils.comma(kills / deaths)),
                         inline=True)
     except:
         embed.add_field(name="K/D Ratio", value=str('N/A'), inline=True)
     embed.set_footer(text='Unofficial Hypixel Discord Bot')
     await ctx.send(embed=embed)
Exemple #11
0
 async def murdermystery(self, ctx, username: str = None):
     if ctx.guild is not None:
         me = ctx.guild.get_member(self.bot.user.id)
         perms = ctx.channel.permissions_for(me)
         if perms.send_messages:
             if not perms.embed_links:
                 await ctx.send(
                     "Error: Cannot send embeds in this channel. Please contact a server administrator to fix this issue."
                 )
                 return
             if perms.embed_links:
                 pass
         if not perms.send_messages:
             return
     #verify if player exists
     if username == None:
         embed = discord.Embed(title="Error",
                               description="""Please provide a username.""",
                               color=0xff0000)
         await ctx.send(embed=embed)
         return
     uuid = MojangAPI.get_uuid(str(username))
     if uuid == '5d1f7b0fdceb472d9769b4e37f65db9f':
         embed = discord.Embed(title="Error",
                               description="""That user does not exist.""",
                               color=0xff0000)
         await ctx.send(embed=embed)
         return
     elif not uuid:
         embed = discord.Embed(title="Error",
                               description="""That user does not exist.""",
                               color=0xff0000)
         await ctx.send(embed=embed)
         return
     #send request
     data = await hypixel.player(uuid)
     #errors
     if data['success'] == False:
         if data['cause'] == 'Malformed UUID':
             embed = discord.Embed(title="Error",
                                   description="""Something went wrong.""",
                                   color=0xff0000)
             await ctx.send(embed=embed)
             return
         else:
             embed = discord.Embed(title="Error",
                                   description="""Something went wrong.""",
                                   color=0xff0000)
             await ctx.send(embed=embed)
             return
     #it worked!
     elif data['success'] == True:
         if data['player'] == None:
             embed = discord.Embed(
                 title="Error",
                 description=
                 """That user has never joined the Hypixel Network.""",
                 color=0xff0000)
             await ctx.send(embed=embed)
             return
     try:
         played = data['player']['stats']['MurderMystery']['games']
     except:
         played = 'N/A'
     try:
         deaths = data['player']['stats']['MurderMystery']['deaths']
     except:
         deaths = 'N/A'
     try:
         kkills = data['player']['stats']['MurderMystery']['knife_kills']
     except:
         kkills = 'N/A'
     try:
         bkills = data['player']['stats']['MurderMystery']['bow_kills']
     except:
         bkills = 'N/A'
     try:
         wins = data['player']['stats']['MurderMystery']['wins']
     except:
         wins = 'N/A'
     data = await hypixel.getname(uuid)
     if data is None:
         embed = discord.Embed(
             title="Error",
             description="""Something went wrong. Please try again later.""",
             color=0xff0000)
         await ctx.send(embed=embed)
         return
     color = random.randint(1, 16777215)
     embed = discord.Embed(title=data + "'s Murder Mystery Stats",
                           color=color)
     embed.set_thumbnail(url='https://crafatar.com/renders/head/' + uuid)
     embed.add_field(name='Games Played', value=str(utils.comma(played)))
     embed.add_field(name='Wins', value=str(utils.comma(wins)))
     embed.add_field(name='Deaths', value=str(utils.comma(deaths)))
     embed.add_field(name='Knife Kills', value=str(utils.comma(kkills)))
     embed.add_field(name='Bow Kills', value=str(utils.comma(bkills)))
     try:
         embed.add_field(name='Total Kills',
                         value=str(utils.comma(int(kkills) + int(bkills))))
     except:
         embed.add_field(name='Total Kills', value='N/A')
     embed.set_footer(text='Unofficial Hypixel Discord Bot')
     await ctx.send(embed=embed)
Exemple #12
0
 async def pit(self, ctx, username: str = None):
     if ctx.guild is not None:
         me = ctx.guild.get_member(self.bot.user.id)
         perms = ctx.channel.permissions_for(me)
         if perms.send_messages:
             if not perms.embed_links:
                 await ctx.send(
                     "Error: Cannot send embeds in this channel. Please contact a server administrator to fix this issue."
                 )
                 return
             if perms.embed_links:
                 pass
         if not perms.send_messages:
             return
     #verify if player exists
     if username == None:
         embed = discord.Embed(title="Error",
                               description="""Please provide a username.""",
                               color=0xff0000)
         await ctx.send(embed=embed)
         return
     uuid = MojangAPI.get_uuid(str(username))
     if uuid == '5d1f7b0fdceb472d9769b4e37f65db9f':
         embed = discord.Embed(title="Error",
                               description="""That user does not exist.""",
                               color=0xff0000)
         await ctx.send(embed=embed)
         return
     elif not uuid:
         embed = discord.Embed(title="Error",
                               description="""That user does not exist.""",
                               color=0xff0000)
         await ctx.send(embed=embed)
         return
     #send request
     data = await hypixel.player(uuid)
     #errors
     if data['success'] == False:
         if data['cause'] == 'Malformed UUID':
             embed = discord.Embed(title="Error",
                                   description="""Something went wrong.""",
                                   color=0xff0000)
             await ctx.send(embed=embed)
             return
         else:
             embed = discord.Embed(title="Error",
                                   description="""Something went wrong.""",
                                   color=0xff0000)
             await ctx.send(embed=embed)
             return
     #it worked!
     elif data['success'] == True:
         if data['player'] == None:
             embed = discord.Embed(
                 title="Error",
                 description=
                 """That user has never joined the Hypixel Network.""",
                 color=0xff0000)
             await ctx.send(embed=embed)
             return
     try:
         deaths = data['player']['stats']['Pit']['pit_stats_ptl']['deaths']
     except:
         deaths = 'N/A'
     try:
         dmgdealt = data['player']['stats']['Pit']['pit_stats_ptl'][
             'damage_dealt']
     except:
         dmgdealt = 'N/A'
     try:
         dmgrecieved = data['player']['stats']['Pit']['pit_stats_ptl'][
             'damage_received']
     except:
         dmgrecieved = 'N/A'
     try:
         joins = data['player']['stats']['Pit']['pit_stats_ptl']['joins']
     except:
         joins = 'N/A'
     try:
         kills = data['player']['stats']['Pit']['pit_stats_ptl']['kills']
     except:
         kills = 'N/A'
     try:
         assists = data['player']['stats']['Pit']['pit_stats_ptl'][
             'assists']
     except:
         assists = 'N/A'
     try:
         bdmgdealt = data['player']['stats']['Pit']['pit_stats_ptl'][
             'bow_damage_dealt']
     except:
         bdmgdealt = 'N/A'
     try:
         bdmgrecieved = data['player']['stats']['Pit']['pit_stats_ptl'][
             'bow_damage_received']
     except:
         bdmgrecieved = 'N/A'
     try:
         jumped = data['player']['stats']['Pit']['pit_stats_ptl'][
             'jumped_into_pit']
     except:
         jumped = 'N/A'
     try:
         hits = data['player']['stats']['Pit']['pit_stats_ptl'][
             'sword_hits']
     except:
         hits = 'N/A'
     try:
         bhits = data['player']['stats']['Pit']['pit_stats_ptl'][
             'arrow_hits']
     except:
         bhits = 'N/A'
     data = await hypixel.getname(uuid)
     if data is None:
         embed = discord.Embed(
             title="Error",
             description="""Something went wrong. Please try again later.""",
             color=0xff0000)
         await ctx.send(embed=embed)
         return
     color = random.randint(1, 16777215)
     embed = discord.Embed(title=data + "'s Pit Stats", color=color)
     embed.set_thumbnail(url='https://crafatar.com/renders/head/' + uuid)
     embed.add_field(name="Times Joined",
                     value=str(utils.comma(joins)),
                     inline=True)
     embed.add_field(name="Times Jumped into Pit",
                     value=str(utils.comma(jumped)),
                     inline=True)
     embed.add_field(name="Assists",
                     value=str(utils.comma(assists)),
                     inline=True)
     embed.add_field(name="Kills",
                     value=str(utils.comma(kills)),
                     inline=True)
     embed.add_field(name="Deaths",
                     value=str(utils.comma(deaths)),
                     inline=True)
     try:
         embed.add_field(name="K/D Ratio",
                         value=str(
                             utils.comma(round(int(kills) / int(deaths),
                                               2))),
                         inline=True)
     except:
         embed.add_field(name="K/D Ratio", value='N/A', inline=True)
     embed.add_field(name="Melee Damage Dealt",
                     value=str(utils.comma(dmgdealt)),
                     inline=True)
     embed.add_field(name="Melee Damage Received",
                     value=str(utils.comma(dmgrecieved)),
                     inline=True)
     embed.add_field(name="Melee Hits", value=str(utils.comma(hits)))
     embed.add_field(name="Bow Damage Dealt",
                     value=str(utils.comma(bdmgdealt)),
                     inline=True)
     embed.add_field(name="Bow Damage Received",
                     value=str(utils.comma(bdmgrecieved)),
                     inline=True)
     embed.add_field(name="Bow Hits", value=str(utils.comma(bhits)))
     embed.set_footer(text="Unofficial Hypixel Discord Bot")
     await ctx.send(embed=embed)
Exemple #13
0
from mojang import MojangAPI
print(
    'ys////////////////////////////////////sy\nyo                                    oy\nyo                                    oy\nyo             oooooooooo             oy\nyo             yyyyyyyyyy             oy\nyo             yyyyyyyyyy             oy\nyo             yyyyyyyyyy             oy\nyo   ``````````yyyyyyyyyy``````````   oy\nyo   ssssssssssyyyyyyyyyyssssssssss   oy\nyo   yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy   oy\nyo   yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy   oy\nyo   yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy   oy\nyo   ``````````yyyyyyyyyy``````````   oy\nyo             yyyyyyyyyy             oy\nyo             yyyyyyyyyy             oy\nyo             yyyyyyyyyy             oy\nyo             oooooooooo             oy\nyo                                    oy\nyo                                    oy\nys////////////////////////////////////sy\n\n\n'
)
print(
    '1) Username to uuid.\n2) Uuid to username.\n3)Username/Uuid to skin url.\n4) Username/uuid to cape.'
)
selection = input()
if selection == '3':
    username_or_uuid = input(
        "Type 'user' to use username to find skin, or type uuid to find skin with your uuid"
    )
    if username_or_uuid == 'user':
        username_or_uuid_username = input("Enter your username")
        uuid_get = MojangAPI.get_uuid(username_or_uuid_username)
        profile_skin = MojangAPI.get_profile(uuid_get)
        print('The skin url is: ', profile_skin.skin_url)
    elif username_or_uuid == 'uuid':
        uuid_input = input('Enter uuid: ')
        profile_skin_uuid = MojangAPI.get_profile(uuid_input)
        print('The skin url is: ', profile_skin_uuid.skin_url)

if selection == '1':
    username_input = input('Enter your current minecraft username: '******'There uuid is: ' + uuid)

if selection == '2':
Exemple #14
0
    def test_get_uuid(self):
        uuid = MojangAPI.get_uuid(self.INVALID_USERNAME)
        self.assertEqual(uuid, None)

        uuid = MojangAPI.get_uuid(self.NOTCH_USERNAME)
        self.assertEqual(uuid, self.NOTCH_UUID)
Exemple #15
0
 async def auctions(self, ctx, username: str=None, profile: str=None):
     if ctx.guild is not None:
         me = ctx.guild.get_member(self.bot.user.id)
         perms = ctx.channel.permissions_for(me)
         if perms.send_messages:
             if not perms.embed_links:
                 await ctx.send("Error: Cannot send embeds in this channel. Please contact a server administrator to fix this issue.")
                 return
             if perms.embed_links:
                 pass
         if not perms.send_messages:
             return
     #verify if player exists
     if username==None:
         embed = discord.Embed(title="Error", description="""Please provide a username.""", color=0xff0000)
         await ctx.send(embed=embed)
         return
     if profile==None:
         embed = discord.Embed(title="Error", description="""Please provide a profile.""", color=0xff0000)
         await ctx.send(embed=embed)
         return
     uuid = MojangAPI.get_uuid(str(username))
     if uuid == '5d1f7b0fdceb472d9769b4e37f65db9f':
         embed = discord.Embed(title="Error", description="""That user does not exist.""", color=0xff0000)
         await ctx.send(embed=embed)
         return
     elif not uuid:
         embed = discord.Embed(title="Error", description="""That user does not exist.""", color=0xff0000)
         await ctx.send(embed=embed)
         return
     data = await hypixel.player(uuid)
     #errors
     if data['success'] == False:
         if data['cause'] == 'Malformed UUID':
             embed = discord.Embed(title="Error", description="""Something went wrong.""", color=0xff0000)
             await ctx.send(embed=embed)
             return
         else:
             embed = discord.Embed(title="Error", description="""Something went wrong.""", color=0xff0000)
             await ctx.send(embed=embed)
             return
     #it worked!
     elif data['success'] == True:
         if data['player'] == None:
             embed = discord.Embed(title="Error", description="""That user has never joined the Hypixel Network.""", color=0xff0000)
             await ctx.send(embed=embed)
             return
         else:
             data = await hypixel.player(uuid)
             ah = None
             i = None
             pname = 'N/A'
             for profile1 in data['player']['stats']['SkyBlock']['profiles']:
                 profile1 = data['player']['stats']['SkyBlock']['profiles'][profile1]
                 if profile1['cute_name'].lower() == profile.lower():
                     pname = profile1['cute_name']
                     i = 'Something'
                     ah = await hypixel.skyblock.auctions(profile1['profile_id'])
                     break
             if i is None:
                 embed = discord.Embed(title="Error", description="""Invalid Skyblock profile.""", color=0xff0000)
                 await ctx.send(embed=embed)
                 return
             if data['success'] == False:
                 embed = discord.Embed(title="Error", description="""Something went wrong.""", color=0xff0000)
                 await ctx.send(embed=embed)
                 return
             if ah is None:
                 embed = discord.Embed(title="Error", description="""Something went wrong.""", color=0xff0000)
                 await ctx.send(embed=embed)
                 return
             length = len(ah['auctions'])
             color=random.randint(1, 16777215)
             if length == 0:
                 data = await hypixel.getname(uuid)
                 if data is None:
                     embed = discord.Embed(title="Error", description="""Something went wrong. Please try again later.""", color=0xff0000)
                     await ctx.send(embed=embed)
                     return
                 name = data
                 embed = discord.Embed(title = f"{name}'s Skyblock Auctions on {pname}", description=f"{name} has no auctions on profile {pname}.", color = color)
                 await ctx.send(embed=embed)
                 return
             name = await hypixel.getname(uuid)
             if name is None:
                 embed = discord.Embed(title="Error", description="""Something went wrong. Please try again later.""", color=0xff0000)
                 await ctx.send(embed=embed)
                 return
             msg1 = ''
             amnt = 0
             embed = discord.Embed(title=f"{name}'s Skyblock Auctions on {pname}", description=f"Collecting data, please wait.\nThis message will be edited once data is ready.", color=color)
             embed.set_footer(text='Unofficial Hypixel Discord Bot')
             message = await ctx.send(embed=embed)
             for auction in ah['auctions']:
                 msg1 += f"{auction['tier'].lower().capitalize()} {auction['item_name']} - ID: {auction['_id']}\n"
                 amnt += 1
             if msg1 == '':
                 msg1 = f"{name} has no auctions on {pname}"
             paste = await mystbin_client.post(msg1.replace('\\', ''), syntax="text")
             url = str(paste)
             embed = discord.Embed(title=f"{name}'s Skyblock Auctions on {pname}", description=f"{name} has {amnt} auctions on profile {pname}\nAuctions have been uploaded to {url}.", color=color)
             embed.set_footer(text='Unofficial Hypixel Discord Bot')
             await message.edit(embed=embed)
             embed = discord.Embed(title=f"Your data is ready!", description=f"I have collected all of {name}'s Skyblock auctions on their {pname} profile.\n[Jump to message]({message.jump_url})", color=color)
             embed.set_footer(text='Unofficial Hypixel Discord Bot')
             await message.channel.send(f"{ctx.author.mention}", embed=embed)
             self.auctions.reset_cooldown(ctx)
Exemple #16
0
import requests
from mojang import MojangAPI

userinput = str(input("Enter your minecraft username >>> "))

uuid = MojangAPI.get_uuid(userinput)
requestlink = str("https://api.hypixel.net/player?key= API KEY &uuid=" + uuid)

hydata = requests.get(requestlink).json()

player = hydata["player"]["displayname"]

karma = hydata["player"]["karma"]
karma = "{:,}".format(karma)

print(f"{player} has {karma} karma")
    async def register(self, ctx, minecraft_username=""):
        """
        Registers Minecraft username to Discord. Required to sign up for PUGs.
        Usage: register <minecraft_username>

        Example:
            register Ninsanity
        """
        if not minecraft_username:
            embed = Embed(title="Error ❌",
                          description="Missing argument <minecraft_username>",
                          color=Colour.dark_red())
            embed.add_field(name="Example", value="-register Ninsanity")
            await ctx.send(embed=embed)
            return

        uuid = MojangAPI.get_uuid(minecraft_username)
        if uuid:
            condition = Player.player_check(uuid, ctx.author.id)
            if not condition:
                if check_user_requests(ctx.author.id):
                    await error_embed(
                        ctx, "You have already submitted a register request")
                else:
                    request_channel = self.bot.get_channel(
                        REGISTER_REQUESTS_CHANNEL)
                    embed = Embed(
                        title=f"Register Request: {minecraft_username}",
                        description=
                        f"React below to verify {ctx.author.mention}",
                        colour=Colour.dark_purple())
                    embed.set_thumbnail(
                        url=f"https://cravatar.eu/helmavatar/{uuid}/128.png")
                    message = await request_channel.send(embed=embed)
                    await message.add_reaction("✅")
                    await message.add_reaction("❌")
                    if add_register_request(uuid, ctx.author.id,
                                            minecraft_username, message.id):
                        await ctx.send(embed=Embed(
                            title="Registration Pending",
                            description=
                            f"Requested to register **{minecraft_username}**"
                            f" to {ctx.author.mention}",
                            color=Colour.dark_purple()))

                    else:
                        await error_embed(
                            ctx,
                            "There was an error storing your register request. Contact a PUG Dev"
                        )
            elif condition == 1:
                await ctx.send(embed=Embed(
                    title="Error ❌",
                    description=
                    f"**{minecraft_username}** is already registered",
                    color=Colour.dark_red()))
            else:
                await ctx.send(embed=Embed(
                    title="Error ❌",
                    description=f"{ctx.author.mention} is already registered",
                    color=Colour.dark_red()))
        else:
            await ctx.send(embed=Embed(
                title="Error ❌",
                description=f"**{minecraft_username}** does not exist",
                color=Colour.dark_red()))
Exemple #18
0
    async def edit(ctx):
        while True:
            await ctx.author.send(embed=editMCPrompt_embed)

            def check(m):
                return m.author == ctx.author and m.channel.type == discord.ChannelType.private

            try:
                mcUser = await bot.wait_for('message',
                                            check=check,
                                            timeout=300)
            except TimeoutError:
                print("User " + str(ctx.author) +
                      "Timed out on edit query, Username remains unchanged")
                await ctx.author.send(embed=timeout_embed)
                return False
            else:
                mcUser = mcUser.content
                uuid = MojangAPI.get_uuid(mcUser)
                if not uuid:
                    await ctx.author.send(embed=UserNotFound_embed)
                    continue
                elif uuidPoll(uuid):
                    if uuidPoll(uuid)[0] == ctx.author.id:
                        await ctx.author.send(embed=linked_embed)
                        return False
                    await ctx.author.send(embed=existsEmbed(mcUser))
                    continue
                else:
                    msgPrompt = await ctx.author.send(
                        embed=usernameConfirmation(mcUser))
                    thumbsup, thumbsdown = '👍', '👎'
                    await msgPrompt.add_reaction(thumbsup)
                    await msgPrompt.add_reaction(thumbsdown)

                    def checkreact(reaction, react):
                        react = str(reaction.emoji)
                        return ((react == '👍' or react == '👎')
                                and (reaction.message.id == msgPrompt.id))

                    await asyncio.sleep(.1)
                    try:
                        confirmation = await bot.wait_for('reaction_add',
                                                          check=checkreact,
                                                          timeout=300)
                    except TimeoutError:
                        print(
                            "User " + str(ctx.author) +
                            "Timed out on edit confirmation, Username remains unchanged"
                        )
                        await ctx.author.send(embed=timeout_embed)
                        return False
                    else:
                        if str(confirmation[0].emoji) == '👍':
                            tempName = poll(ctx.author.id)[4]
                            #print("changing username: "******"uuid" = N\'' +
                                        str(uuid) + '\', "username" = N\'' +
                                        str(mcUser) + '\' WHERE "user_id" = ' +
                                        str(ctx.author.id) + ';')
                            conn.commit()
                            mcr = MCRcon(str(rconIp),
                                         str(rconPass),
                                         port=int(rconPort))
                            mcr.connect()
                            resp = mcr.command("whitelist remove " + tempName)
                            print(resp)
                            resp = mcr.command("whitelist add " + mcUser)
                            print(resp)
                            mcr.disconnect()
                            await ctx.author.send(embed=editConfirm(mcUser))
                            conn.close()
                            return True
Exemple #19
0
    async def query(ctx):
        while True:
            await ctx.author.send(embed=name_embed)

            def check(m):
                return m.author == ctx.author and m.channel.type == discord.ChannelType.private

            try:
                namee = await bot.wait_for('message', check=check, timeout=300)
            except TimeoutError:
                print("User " + str(ctx.author) +
                      "Time out on name query, No changes to database.")
                await ctx.author.send(embed=timeout_embed)
                return False
            else:
                namee = namee.content
                stuff = namee.split()
                if len(stuff) != 2:
                    continue
                await ctx.author.send(embed=addAccount_embed)
                try:
                    mcUser = await bot.wait_for('message',
                                                check=check,
                                                timeout=300)
                except TimeoutError:
                    print(
                        "User " + str(ctx.author) +
                        "Timed out on username query, No changes to database")
                    await ctx.author.send(embed=timeout_embed)
                    return False
                else:
                    mcUser = mcUser.content
                    uuid = MojangAPI.get_uuid(mcUser)
                    if not uuid:
                        await ctx.author.send(embed=UserNotFound_embed)
                        continue
                    elif uuidPoll(uuid):
                        if uuidPoll(uuid)[0] == ctx.author.id:
                            await ctx.author.send(embed=linked_embed)
                            return False
                        await ctx.author.send(embed=existsEmbed(mcUser))
                        continue
                    else:
                        msgPrompt = await ctx.author.send(
                            embed=infoConfirmation(stuff[0], stuff[1], mcUser))
                        thumbsup, thumbsdown = '👍', '👎'
                        await msgPrompt.add_reaction(thumbsup)
                        await msgPrompt.add_reaction(thumbsdown)

                        def checkreact(reaction, react):
                            react = str(reaction.emoji)
                            return ((react == '👍' or react == '👎')
                                    and (reaction.message.id == msgPrompt.id))

                        await asyncio.sleep(.1)
                        try:
                            confirmation = await bot.wait_for('reaction_add',
                                                              check=checkreact,
                                                              timeout=300)
                        except TimeoutError:
                            print(
                                "User " + str(ctx.author) +
                                "Timed out on username confirmation, No changes to database"
                            )
                            await ctx.author.send(embed=timeout_embed)
                            return False
                        else:
                            if str(confirmation[0].emoji) == '👍':
                                return (stuff[0], stuff[1], uuid, mcUser)