padStart instead of Util.pad

This commit is contained in:
Daniel Odendahl Jr
2018-01-28 02:04:04 +00:00
parent d63cfef8a0
commit d58364a3d1
6 changed files with 10 additions and 11 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ const { Command } = require('discord.js-commando');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const { stripIndents } = require('common-tags');
const { filterPkmn, pad } = require('../../util/Util');
const { filterPkmn } = require('../../util/Util');
module.exports = class PokedexCommand extends Command {
constructor(client) {
@@ -27,7 +27,7 @@ module.exports = class PokedexCommand extends Command {
async run(msg, { pokemon }) {
try {
const { body } = await snekfetch.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}/`);
const id = pad(body.id.toString(), '000');
const id = body.id.toString().padStart(3, '0');
const embed = new MessageEmbed()
.setColor(0xED1C24)
.setAuthor(`#${id} - ${filterPkmn(body.names).name}`, `https://www.serebii.net/pokedex-sm/icon/${id}.png`)