Starter code pulling in pokemon API and displaying the info (image, health, weight) in an embed
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let pokemon_name = context.params.event.content.replace('!pokemon ', '');
let request = await lib.http.request['@1.1.7'].get({
url: `https://pokeapi.co/api/v2/pokemon/${pokemon_name}`,
queryParams: {
name: pokemon_name,
},
});
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: '',
tts: false,
components: [
{
type: 1,
components: [
{
style: 3,
label: `${request.data.stats[0].base_stat}`,
custom_id: `health_button`,
disabled: false,
emoji: {
id: null,
name: `❤`,
},
type: 2,
},
{
style: 1,
label: `${request.data.weight}`,
custom_id: `weight_button`,
disabled: false,
emoji: {
id: null,
name: `🐳`,
},
type: 2,
},
],
},
],
embeds: [
{
type: 'rich',
title: `${request.data.name}`,
description: '',
color: 0x00ffff,
image: {
url: `${request.data.sprites.front_default}`,
height: 0,
width: 0,
},
},
],
});