Created
July 12, 2019 00:12
-
-
Save anchetaWern/ea69241ab616ab17bb518e53ce3be593 to your computer and use it in GitHub Desktop.
Pokedex Bot: Pokemon endpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (pokemon_endpoint.indexOf(specs) !== -1) { | |
const { data } = await axios_instance.get(`/pokemon/${pokemon}`); | |
let fulfillmentText; | |
const id = String(data.id).padStart(3, '0'); | |
const value = (specs == 'abilities') ? data.abilities.map(item => item.ability.name).join(', ') : data.moves.map(item => item.move.name).join(', '); | |
fulfillmentText = `The ${specs} of ${pokemon} are: ${value}`; | |
Object.assign(response_obj, { fulfillmentText }); | |
if (specs == 'photo') { | |
Object.assign(response_obj, { | |
fulfillmentText: pokemon, | |
payload: { | |
is_image: true, | |
url: `https://www.pkparaiso.com/imagenes/xy/sprites/global_link/${id}.png` | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment