making it pretty
This commit is contained in:
		
							parent
							
								
									88b17808d1
								
							
						
					
					
						commit
						11f70984b2
					
				
					 1 changed files with 42 additions and 12 deletions
				
			
		| 
						 | 
					@ -8,7 +8,7 @@ module.exports = class {
 | 
				
			||||||
        this.category = category,
 | 
					        this.category = category,
 | 
				
			||||||
        this.enabled = true,
 | 
					        this.enabled = true,
 | 
				
			||||||
        this.devOnly = false,
 | 
					        this.devOnly = false,
 | 
				
			||||||
        this.aliases = ['pokedex', 'dex'],
 | 
					        this.aliases = ['type'],
 | 
				
			||||||
        this.userPerms = [],
 | 
					        this.userPerms = [],
 | 
				
			||||||
        this.botPerms = [],
 | 
					        this.botPerms = [],
 | 
				
			||||||
        this.cooldown = 5000,
 | 
					        this.cooldown = 5000,
 | 
				
			||||||
| 
						 | 
					@ -94,25 +94,55 @@ module.exports = class {
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                const typeMatchup = json.data.getTypeMatchup;
 | 
					                const typeMatchup = json.data.getTypeMatchup;
 | 
				
			||||||
                            
 | 
					
 | 
				
			||||||
 | 
					                let effectless = '';
 | 
				
			||||||
 | 
					                if (typeMatchup.attacking.effectlessTypes.length > 0) effectless = `
 | 
				
			||||||
 | 
					                **Doesn't effect:**
 | 
				
			||||||
 | 
					                ${typeMatchup.attacking.effectlessTypes.map(type => `\`${type.toProperCase()}\``).join(' ')}
 | 
				
			||||||
 | 
					                `;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                let immune = '';
 | 
				
			||||||
 | 
					                if (typeMatchup.defending.effectlessTypes.length > 0) immune = `
 | 
				
			||||||
 | 
					                **Immune to:**
 | 
				
			||||||
 | 
					                ${typeMatchup.defending.effectlessTypes.map(type => `\`${type.toProperCase()}\``).join(' ')}
 | 
				
			||||||
 | 
					                `;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                console.log(this.parseEffectiveTypes(typeMatchup.attacking.effectiveTypes, typeMatchup.attacking.doubleEffectiveTypes));    
 | 
				
			||||||
                const embed = new Embed()
 | 
					                const embed = new Embed()
 | 
				
			||||||
                    .setTitle('Offensive')
 | 
					                    .setColour(client.functions.displayHexColour(message.channel.guild, client.user.id))
 | 
				
			||||||
                    .addField('Weak to:', typeMatchup.attacking.effectiveTypes.join(', '))
 | 
					                    .setTitle('Type effectiveness of ' + types.split(',').join(' and').toProperCase())
 | 
				
			||||||
                    .addField('Strong against:', typeMatchup.attacking.resistedTypes.join(', '));
 | 
					                    .addField('Offensive:', `
 | 
				
			||||||
                    //.addField('Immune to:', typeMatchup.effectlessTypes.join(' '));
 | 
					                        **Super-effective:**
 | 
				
			||||||
                    //.addField('External Resources:', `[Bulbapedia](${pokemon.bulbapediaPage}) | [Serebii](${pokemon.serebiiPage}) | [Smogon](${pokemon.smogonPage})`);
 | 
					                        ${this.parseEffectiveTypes(typeMatchup.attacking.effectiveTypes, typeMatchup.attacking.doubleEffectiveTypes)} 
 | 
				
			||||||
 | 
					                        **Normal damage:**
 | 
				
			||||||
 | 
					                        ${typeMatchup.attacking.normalTypes.map(type => `\`${type.toProperCase()}\``).join(' ')}
 | 
				
			||||||
 | 
					                        **Not very effective:**
 | 
				
			||||||
 | 
					                        ${this.parseResistedTypes(typeMatchup.attacking.resistedTypes, typeMatchup.attacking.doubleResistedTypes)}${effectless} 
 | 
				
			||||||
 | 
					                    `)
 | 
				
			||||||
 | 
					                    .addField('Defensive:', `
 | 
				
			||||||
 | 
					                    **Vulnerable to:**
 | 
				
			||||||
 | 
					                    ${this.parseEffectiveTypes(typeMatchup.defending.effectiveTypes, typeMatchup.defending.doubleEffectiveTypes)} 
 | 
				
			||||||
 | 
					                    **Normal damage:**
 | 
				
			||||||
 | 
					                    ${typeMatchup.defending.normalTypes.map(type => `\`${type.toProperCase()}\``).join(' ')}
 | 
				
			||||||
 | 
					                    **Resists:**
 | 
				
			||||||
 | 
					                    ${this.parseResistedTypes(typeMatchup.defending.resistedTypes, typeMatchup.defending.doubleResistedTypes)}${immune}
 | 
				
			||||||
 | 
					                `);
 | 
				
			||||||
                message.channel.createMessage({ embed: embed });
 | 
					                message.channel.createMessage({ embed: embed });
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
            .catch(err => client.logger.error('TYPEMATCHUP_CMD_ERROR', err.stack));
 | 
					            .catch(err => client.logger.error('TYPEMATCHUP_CMD_ERROR', err.stack));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    parseEffectiveTypes (effective, doubleEffective) {
 | 
					    parseEffectiveTypes (effective, doubleEffective) {
 | 
				
			||||||
 | 
					        return doubleEffective
 | 
				
			||||||
 | 
					            .map(type => `\`${type.toProperCase()} (x4)\``)
 | 
				
			||||||
 | 
					            .concat(effective.map(type => `\`${type.toProperCase()} (x2)\``))
 | 
				
			||||||
 | 
					            .join(' ');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    parseResistedTtypes (resisted, doubleResisted) {
 | 
					    parseResistedTypes (resisted, doubleResisted) {
 | 
				
			||||||
 | 
					        return doubleResisted
 | 
				
			||||||
 | 
					            .map(type => `\`${type.toProperCase()} (x0.25)\``)
 | 
				
			||||||
 | 
					            .concat(resisted.map(type => `\`${type.toProperCase()} (x0.5)\``))
 | 
				
			||||||
 | 
					            .join(' ');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue