Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { RichEmbed } = require('discord.js');
- const { noBotPerms } = require('../utils/errors');
- const pokemon = require('../db/pokemon.js');
- exports.run = async (client, message, args) => {
- let perms = message.guild.me.permissions;
- if (!perms.has('EMBED_LINKS')) return noBotPerms(message, 'EMBED_LINKS');
- var msg = message;
- if(!args) {
- const embed = new RichEmbed()
- .setTitle("Error")
- .setDescription("A pokemon needs to be entered.")
- message.channel.send(embed)
- return;
- }
- let pkmon = args.toString().toLowerCase();
- for(var i=0;i<pokemon.length;i++){
- if(pkmon == pokemon[i].species.toLowerCase()){
- let description = pokemon[i].description;
- let otherFormes = pokemon[i].otherFormes;
- const db = "https://db.lockyzgroup.net/dismon/sprites/"+pokemon[i].species.toLowerCase()+".gif"
- const embed = new RichEmbed()
- .setTitle("NĀ° "+pokemon[i].num+ " " +pokemon[i].species)
- .setThumbnail(db)
- .setAuthor("Pokedex")
- .addField(`Type`, pokemon[i].types, true)
- if(pokemon[i].num >= 0 && pokemon[i].num <= 151) {
- embed.addField('Gen', '1', true)
- }
- if(pokemon[i].num >= 152 && pokemon[i].num <= 251) {
- embed.addField('Gen', '2', true)
- }
- if(pokemon[i].num >= 252 && pokemon[i].num <= 386) {
- embed.addField('Gen', '3', true)
- }
- if(pokemon[i].num >= 387 && pokemon[i].num <= 493) {
- embed.addField('Gen', '4', true)
- }
- if(pokemon[i].num >= 494 && pokemon[i].num <= 649) {
- embed.addField('Gen', '5', true)
- }
- if(pokemon[i].num >= 650 && pokemon[i].num <= 721) {
- embed.addField('Gen', '6', true)
- }
- if(pokemon[i].num >= 722 && pokemon[i].num <= 809) {
- embed.addField('Gen', '7', true)
- }
- if(pokemon[i].num >= 810 && pokemon[i].num <= 894) {
- embed.addField('Gen', '8', true)
- }
- if(otherFormes === undefined) {
- embed.addField(`Formes`, "No formes found", true)
- } else {
- embed.addField(`Formes`, otherFormes, true)
- }
- embed.addBlankField()
- //embed.addField('Base Stats')
- embed.addField('HP', pokemon[i].baseStats.hp, true)
- embed.addField('ATK', pokemon[i].baseStats.atk, true)
- embed.addField('DEF', pokemon[i].baseStats.def, true)
- embed.addField('S. ATK', pokemon[i].baseStats.spa, true)
- embed.addField('S. DEF', pokemon[i].baseStats.spd, true)
- embed.addBlankField(true)
- if(description === undefined) {
- embed.setDescription("A description could not be found. Please help us update our database [here](https://github.com/lockyz/dismon-database)")
- } else {
- embed.setDescription(description)
- }
- embed.addBlankField()
- embed.addField(`Ability 1`, pokemon[i].abilities[0], true)
- if(pokemon[i].abilities[1] === undefined) {
- } else {
- embed.addField(`Ability 2`, pokemon[i].abilities[1], true)
- }
- if(pokemon[i].abilities.H === undefined) {
- } else {
- embed.addField(`Hidden Ability`, pokemon[i].abilities.H, true)
- }
- embed.addField(`Innacurate Information?`, `Help us update it [here](https://github.com/lockyz/dismon-database)`)
- return message.channel.send({embed});
- }
- }
- for(var i=0;!i<pokemon.length;i++){
- const embed = new RichEmbed()
- .setTitle(`Typedex`)
- .setThumbnail("https://db.lockyzgroup.net/dismon/unknown.png")
- .setDescription("Your Type could not be found.\nIf you believe this was done in error help us update our database [here](https://github.com/lockyz/dismon-database)")
- message.channel.send(embed)
- return;
- }
- return;
- };
- exports.help = {
- name: 'pokedex',
- aliases: ['poke', 'pdex'],
- description: 'Get Poke Information.',
- usage: 'pokedex {Pokemon}'
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement