Closed ghost closed 4 years ago
The pokemon
endpoint gives type as a list as seen here in the docs and it looks like you're trying to invoke it like a function with this line here: await ctx.send(poke.types())
.
I'm not too familiar with discord.py, but I think you can access the pokemon's type with something like this: poke.types[0].type
. That would give you one of the types the pokemon has. You can see the structure of the API with the link to the docs I linked above.
Pokebase returns a dict object apparently, so you access it like: poke.types
Remember that the .types
property will be itself a list of dicts.
types: [
{
slot: 1,
type: {
name: "water",
url: "https://pokeapi.co/api/v2/type/11/"
}
}
],
I have been working on a project which gives the stats of pokemon. How do i get the types of the pokemon with discord.py?
i get:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'list' object is not callable