예제 #1
0
def fill_spells(c, api_key):
	api = RiotWatcher(api_key)
	try:
		all_spells = api.static_get_summoner_spell_list(None, None, None, None, "image")
	except:
		print("Error getting all spells:", sys.exc_info()[0])
		return

	for _, spell in all_spells["data"].iteritems():
		c.execute('''
			INSERT INTO Spell (Id, Name, Image)
			VALUES (?, ?, ?)
		''', (spell["id"], spell["name"], spell["image"]["full"]))
예제 #2
0
async def on_ready(bot):

    # Obtain all static data required
    watcher = RiotWatcher(bot.configurations['discrank.py']['token'])
    if not watcher.can_make_request():
        raise BotException(ErrorTypes.STARTUP, EXCEPTION,
            "The given Riot API token cannot get requests.")

    # Add champions by ID and name, and skills by ID
    champions = watcher.static_get_champion_list(data_by_id=True)['data']
    champions_named = watcher.static_get_champion_list()['data']
    champions_named = dict(
            (key.lower(), value) for key, value in champions_named.items())
    champions.update(champions_named)
    spells = watcher.static_get_summoner_spell_list(data_by_id=True)['data']

    # Add game modes by queue type and name
    modes = {
        "0": "Custom",
        "8": "Normal 3v3",
        "2": "Normal",
        "14": "Normal Draft",
        "4": "Dynamic Queue",
        "6": "Dynamic Queue",
        "9": "Ranked 3v3",
        "41": "Ranked 3v3",
        "42": "Ranked 5v5",
        "16": "This Gamemode doesn't even exist anymore",
        "17": "Same with this one",
        "7": "Co-op vs AI",
        "25": "Co-op vs AI",
        "31": "Co-op vs AI",
        "32": "Co-op vs AI",
        "33": "Co-op vs AI",
        "52": "Co-op vs AI (3v3)",
        "61": "Team Builder",
        "65": "ARAM",
        "70": "One For All",
        "72": "Magma Chamber 1v1",
        "73": "Magma Chamber 2v2",
        "75": "Hexakill",
        "76": "URF",
        "83": "Co-op vs AI (URF)",
        "91": "Doom Bots Lv 1",
        "92": "Doom Bots Lv 2",
        "93": "Doom Bots Lv 3",
        "96": "Ascension",
        "98": "Hexakill",
        "100": "Bilgewater",
        "300": "Legend of the Poro King",
        "313": "Bilgewater ARAM",
        "400": "Team Builder",
        "410": "Dynamic Queue",
        "CUSTOM": "0",
        "NORMAL_3x3": "8",
        "NORMAL_5x5_BLIND": "2",
        "NORMAL_5x5_DRAFT": "14",
        "RANKED_SOLO_5x5": "4",
        "RANKED_PREMADE_5x5*": "6",
        "RANKED_PREMADE_3x3*": "9",
        "RANKED_TEAM_3x3": "41",
        "RANKED_TEAM_5x5": "42",
        "ODIN_5x5_BLIND": "16",
        "ODIN_5x5_DRAFT": "17",
        "BOT_5x5*": "7",
        "BOT_ODIN_5x5": "25",
        "BOT_5x5_INTRO": "31",
        "BOT_5x5_BEGINNER": "32",
        "BOT_5x5_INTERMEDIATE": "33",
        "BOT_TT_3x3": "52",
        "GROUP_FINDER_5x5": "61",
        "ARAM_5x5": "65",
        "ONEFORALL_5x5": "70",
        "FIRSTBLOOD_1x1": "72",
        "FIRSTBLOOD_2x2": "73",
        "SR_6x6": "75",
        "URF_5x5": "76",
        "BOT_URF_5x5": "83",
        "NIGHTMARE_BOT_5x5_RANK1": "91",
        "NIGHTMARE_BOT_5x5_RANK2": "92",
        "NIGHTMARE_BOT_5x5_RANK5": "93",
        "ASCENSION_5x5": "96",
        "HEXAKILL": "98",
        "BILGEWATER_ARAM_5x5": "100",
        "KING_PORO_5x5": "300",
        "COUNTER_PICK": "310",
        "BILGEWATER_5x5": "313",
        "TEAM_BUILDER_DRAFT_UNRANKED_5x5": "400",
        "TEAM_BUILDER_DRAFT_RANKED_5x5": "410"
    }

    bot.data['discrank.py'] = [watcher, champions, spells, modes]
예제 #3
0
async def on_ready(bot):

    # Obtain all static data required
    watcher = RiotWatcher(bot.configurations['discrank.py']['token'])
    if not watcher.can_make_request():
        raise BotException(ErrorTypes.STARTUP, EXCEPTION,
                           "The given Riot API token cannot get requests.")

    # Add champions by ID and name, and skills by ID
    champions = watcher.static_get_champion_list(data_by_id=True)['data']
    champions_named = watcher.static_get_champion_list()['data']
    champions_named = dict(
        (key.lower(), value) for key, value in champions_named.items())
    champions.update(champions_named)
    spells = watcher.static_get_summoner_spell_list(data_by_id=True)['data']

    # Add game modes by queue type and name
    modes = {
        "0": "Custom",
        "8": "Normal 3v3",
        "2": "Normal",
        "14": "Normal Draft",
        "4": "Dynamic Queue",
        "6": "Dynamic Queue",
        "9": "Ranked 3v3",
        "41": "Ranked 3v3",
        "42": "Ranked 5v5",
        "16": "This Gamemode doesn't even exist anymore",
        "17": "Same with this one",
        "7": "Co-op vs AI",
        "25": "Co-op vs AI",
        "31": "Co-op vs AI",
        "32": "Co-op vs AI",
        "33": "Co-op vs AI",
        "52": "Co-op vs AI (3v3)",
        "61": "Team Builder",
        "65": "ARAM",
        "70": "One For All",
        "72": "Magma Chamber 1v1",
        "73": "Magma Chamber 2v2",
        "75": "Hexakill",
        "76": "URF",
        "83": "Co-op vs AI (URF)",
        "91": "Doom Bots Lv 1",
        "92": "Doom Bots Lv 2",
        "93": "Doom Bots Lv 3",
        "96": "Ascension",
        "98": "Hexakill",
        "100": "Bilgewater",
        "300": "Legend of the Poro King",
        "313": "Bilgewater ARAM",
        "400": "Team Builder",
        "410": "Dynamic Queue",
        "CUSTOM": "0",
        "NORMAL_3x3": "8",
        "NORMAL_5x5_BLIND": "2",
        "NORMAL_5x5_DRAFT": "14",
        "RANKED_SOLO_5x5": "4",
        "RANKED_PREMADE_5x5*": "6",
        "RANKED_PREMADE_3x3*": "9",
        "RANKED_TEAM_3x3": "41",
        "RANKED_TEAM_5x5": "42",
        "ODIN_5x5_BLIND": "16",
        "ODIN_5x5_DRAFT": "17",
        "BOT_5x5*": "7",
        "BOT_ODIN_5x5": "25",
        "BOT_5x5_INTRO": "31",
        "BOT_5x5_BEGINNER": "32",
        "BOT_5x5_INTERMEDIATE": "33",
        "BOT_TT_3x3": "52",
        "GROUP_FINDER_5x5": "61",
        "ARAM_5x5": "65",
        "ONEFORALL_5x5": "70",
        "FIRSTBLOOD_1x1": "72",
        "FIRSTBLOOD_2x2": "73",
        "SR_6x6": "75",
        "URF_5x5": "76",
        "BOT_URF_5x5": "83",
        "NIGHTMARE_BOT_5x5_RANK1": "91",
        "NIGHTMARE_BOT_5x5_RANK2": "92",
        "NIGHTMARE_BOT_5x5_RANK5": "93",
        "ASCENSION_5x5": "96",
        "HEXAKILL": "98",
        "BILGEWATER_ARAM_5x5": "100",
        "KING_PORO_5x5": "300",
        "COUNTER_PICK": "310",
        "BILGEWATER_5x5": "313",
        "TEAM_BUILDER_DRAFT_UNRANKED_5x5": "400",
        "TEAM_BUILDER_DRAFT_RANKED_5x5": "410"
    }

    bot.data['discrank.py'] = [watcher, champions, spells, modes]