fixed get_json function call
This commit is contained in:
parent
c7fe4b2c2a
commit
dac2f68f80
1 changed files with 1 additions and 14 deletions
|
|
@ -8,19 +8,6 @@ import math
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#@commands.cooldown(1, 60, commands.BucketType.user) Cooldowns....
|
|
||||||
|
|
||||||
class Pokemon:
|
|
||||||
async def __init__(self, id: int, generate: bool = True) -> None:
|
|
||||||
if generate: # Should I even do it this way?
|
|
||||||
self.json_data = await self.get_pkmn_from_id(id)
|
|
||||||
|
|
||||||
async def get_pkmn_from_id(id):
|
|
||||||
url = 'https://pokeapi.co/api/v2/pokemon/' + str(id)
|
|
||||||
json_data = await self.get_json(url)
|
|
||||||
return json_data
|
|
||||||
|
|
||||||
class PokemonGame(commands.Cog):
|
class PokemonGame(commands.Cog):
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
|
|
@ -45,7 +32,7 @@ class PokemonGame(commands.Cog):
|
||||||
|
|
||||||
async def starter_picker(self, id): #id = pokedex number
|
async def starter_picker(self, id): #id = pokedex number
|
||||||
url = "https://pokeapi.co/api/v2/pokemon-species/" + str(id)
|
url = "https://pokeapi.co/api/v2/pokemon-species/" + str(id)
|
||||||
json_data = await get_json(url)
|
json_data = await self.get_json(url)
|
||||||
if (json_data["evolves_from_species"] == None) and (not json_data['is_mythical']) and (not json_data['is_legendary']):
|
if (json_data["evolves_from_species"] == None) and (not json_data['is_mythical']) and (not json_data['is_legendary']):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue