Esempio n. 1
0
class BedWars(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    hypixel.setKeys([os.environ.get('HYPIXEL_KEY')])

    @commands.command(aliases=['bw'])
    @commands.cooldown(1, 3, commands.BucketType.user)
    async def bedwars(self, ctx, player):
        colors = color_db.find_one({"_id": ctx.author.id})
        if colors is None:
            color = 0
        else:
            color = colors['color']
        try:
            user = hypixel.Player(player).JSON
            print(user)
            displayName = user['displayname']
            bedwars = user['stats']['Bedwars']
            gamesPlayed = bedwars['games_played_bedwars_1']
            deaths = bedwars['deaths_bedwars']
            bedsLost = bedwars['beds_lost_bedwars']
            kills = bedwars["kills_bedwars"]
            winstreak = bedwars["winstreak"]
            bedsBroken = bedwars["beds_broken_bedwars"]
            wins = bedwars['wins_bedwars']
            finalDeaths = bedwars['final_deaths_bedwars']
            finalKills = bedwars['final_kills_bedwars']
            gamesLost = gamesPlayed - wins
            embed = discord.Embed(title=f'{displayName}\'s BedWars Stats',
                                  color=discord.Color(color))
            kdr = kills / deaths
            kdr_rounded = round(kdr, 2)
            fkdr = round((finalKills / finalDeaths), 2)
            embed.add_field(name="Total Games Played", value=gamesPlayed)
            embed.add_field(name="Kills", value=kills)
            embed.add_field(name="Wins/Losses", value=f'{wins}-{gamesLost}')
            embed.add_field(name="Winstreak", value=winstreak)
            embed.add_field(name="Beds Broken", value=bedsBroken)
            embed.add_field(name="Deaths", value=deaths)
            embed.add_field(name="Beds Lost", value=bedsLost)
            embed.add_field(name="KDR (Kill Death Ratio)", value=kdr_rounded)
            embed.add_field(name="FKDR (Final Kill Death Ratio)", value=fkdr)
            embed.set_thumbnail(url=f'https://minotar.net/avatar/{player}/200')
            await ctx.send(embed=embed)
        except hypixel.PlayerNotFoundException:
            e2 = discord.Embed(
                title=':x: Player Not Found',
                description=
                f"{ctx.author.mention}, {player} was nowhere to be found :O",
                color=0xff0000)
            await ctx.send(embed=e2)

        except KeyError:
            e2 = discord.Embed(
                title=':x: Hypixel Error',
                description=
                f"{ctx.author.mention}, there was an error. Either {player} has not played BedWars before, or something is wrong with the Hypixel API.",
                color=0xff0000)
            await ctx.send(embed=e2)
Esempio n. 2
0
]

Repeats = 5

import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '..'))
import hypixel
from time import time
from random import shuffle

print("Test \"{}\" is now running...\n".format(os.path.basename(__file__)))

API_KEY = os.environ['apikey']

hypixel.setKeys([API_KEY])

start = time()  # Start timer.

for i in range(0, Repeats - 1):
    shuffle(ActualData)  # Randomize the order of the data
    for InputUUID in ActualData:
        Player = hypixel.Player(InputUUID)
        print(Player.getPlayerInfo())

end = time()

totalTime = start - end

print("\nDone! Speed test finished. Time taken: {}".format(end - start))
Esempio n. 3
0
from fortnite_python.domain import Mode
from fortnite_python.domain import Platform
import os
import aiohttp
import json
import time

#Bot Setup and APIs

client = commands.Bot("/")

startup_extensions = ["Music"]

HYPIXELAPI = os.environ.get('HYPIXEL_KEY')
API_KEYS = [HYPIXELAPI]
hypixel.setKeys(API_KEYS)

REDDITID = os.environ.get('REDDIT_ID')
REDDITSECRET = os.environ.get('REDDIT_SECRET')

post = praw.Reddit(client_id=REDDITID,
                   client_secret=REDDITSECRET,
                   user_agent='Shima Rin Bot v0.1 by DjDarkAssassin')

FORTNITEKEY = os.environ.get('FORTNITE_KEY')

fortnite = Fortnite(FORTNITEKEY)

USER1 = os.environ.get('USER_1')

Esempio n. 4
0
""" This is an example of how you can use this API to create cool things.
    Just run this and you should see cool stuff. c:"""

import hypixel

API_KEYS = ['API_KEY_HERE_PLS']
hypixel.setKeys(API_KEYS)  # This sets the API keys that are going to be used.

Player = hypixel.Player(
    'Snuggle'
)  # This creates a Player-object and puts it to a variable called "Player".

PlayerName = Player.getName(
)  # This gets the player's name and puts it in a variable called "PlayerName". :3
print("Player is called ", end='')
print(PlayerName)

PlayerLevel = Player.getLevel()
print(PlayerName + " is level: ", end='')
print(PlayerLevel)  # This prints the level that we got, two lines up!

PlayerRank = Player.getRank()
print(PlayerName + " is rank: ", end='')
print(PlayerRank['rank'])
Esempio n. 5
0
from fire.jsontable import table2json
from PIL import Image
from io import BytesIO
from . import mcfont

remcolor = r'\u00A7[0-9A-FK-OR]'

now = datetime.datetime.utcnow()
launchtime = datetime.datetime.utcnow()

with open('config.json', 'r') as cfg:
    config = json.load(cfg)

hypixelkey = config['hypixel']
keys = [config['hypixel']]
hypixel.setKeys(keys)

uuidToName = {}

picklegames = {
    'QUAKECRAFT': 'Quake',
    'WALLS': 'Walls',
    'PAINTBALL': 'Paintball',
    'SURVIVAL_GAMES': 'Blitz SG',
    'TNTGAMES': 'TNT Games',
    'VAMPIREZ': 'VampireZ',
    'WALLS3': 'Mega Walls',
    'ARCADE': 'Arcade',
    'ARENA': 'Arena',
    'UHC': 'UHC Champions',
    'MCGO': 'Cops and Crims',
Esempio n. 6
0
# ========== IMPORTS ==========
import hypixel
import json
import utils

from datetime import datetime

# ========== SETUPS ==========
hypixel.setKeys(['<key>'])


# ========== UTILS ==========
def analyzeUUIDFromMojang(text):
    uuidText = text.split("\",\"")[1]
    uuid = uuidText.split("\"")[2]

    return uuid


# ========== METHODS ==========
def getPlayerStats(discord, p, uuid, response):
    data = json.loads(json.dumps(p.JSON))

    if str(p.getGuildID()) == 'None':
        guild = 'None'
    else:
        guild = str(
            hypixel.Guild(p.getGuildID()).JSON
        )[int(str(hypixel.Guild(p.getGuildID()).JSON).index('name')
              ):int(str(hypixel.Guild(p.getGuildID()).JSON).index('name')) +
          28].split('\'')[2]
Esempio n. 7
0
import hypixel
import time
import linecache
global flag
num = 0
flag = True
true = 0
global usern

global user

global username
hypixel.setKeys([
    '2d1542cb-9502-4f5a-931d-88a2ba015ddc',
    '447d42b8-bb79-4687-9142-562eb8e12db0',
    '36e366b0-6d8f-46f9-8e83-e0989ba936d0'
])  #
f = open("result.txt", "w")
f1 = open("result-exist.txt", "w")
#combo = dict()
#def getline(the_file_path, line_number):
#  if line_number < 1:
#    return ''
#  for cur_line_number, line in enumerate(open(the_file_path, 'rU')):
#    if cur_line_number == line_number-1:
#      return line
#  return ''


def checkuser(username):
    try:
Esempio n. 8
0
 def __init__(self, bot):
     self.bot = bot
     keys = bot.config['hypixel']
     hypixel.setKeys(keys)
     self.uuidcache = {}