unbold titles
This commit is contained in:
		
							parent
							
								
									bd0f53c1ed
								
							
						
					
					
						commit
						88b17808d1
					
				
					 4 changed files with 77 additions and 87 deletions
				
			
		| 
						 | 
					@ -45,7 +45,7 @@ module.exports = class {
 | 
				
			||||||
                 `
 | 
					                 `
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
            categories.forEach(category => {
 | 
					            categories.forEach(category => {
 | 
				
			||||||
                embed.addField(`${prettified[category].emoji} **${category}**`, `*${prettified[category].description}*\n${client.commands.filter(cmd => cmd.category === category).length} commands`, true);
 | 
					                embed.addField(`${prettified[category].emoji} ${category}`, `*${prettified[category].description}*\n${client.commands.filter(cmd => cmd.category === category).length} commands`, true);
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            embed.setFooter('<> = required, / = either/or, [] = optional');
 | 
					            embed.setFooter('<> = required, / = either/or, [] = optional');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,13 +80,13 @@ module.exports = class {
 | 
				
			||||||
                .setTitle(prettified[command.category].emoji + ' ' + command.category + ' -> ' + command.name.toProperCase())
 | 
					                .setTitle(prettified[command.category].emoji + ' ' + command.category + ' -> ' + command.name.toProperCase())
 | 
				
			||||||
                .setColour(client.functions.displayHexColour(message.channel.guild, client.user.id))
 | 
					                .setColour(client.functions.displayHexColour(message.channel.guild, client.user.id))
 | 
				
			||||||
                .setDescription(command.help.description)
 | 
					                .setDescription(command.help.description)
 | 
				
			||||||
                .addField('**Format:**', `\`${message.prefix + command.name} ${command.help.arguments}`.trim() + '`');
 | 
					                .addField('Format:', `\`${message.prefix + command.name} ${command.help.arguments}`.trim() + '`');
 | 
				
			||||||
            if (command.help.details.length > 0) embed.addField('**Parameters:**', command.help.details);
 | 
					            if (command.help.details.length > 0) embed.addField('Parameters:', command.help.details);
 | 
				
			||||||
            if (command.help.examples.length > 0) embed.addField('**Examples**', command.help.examples);
 | 
					            if (command.help.examples.length > 0) embed.addField('Examples', command.help.examples);
 | 
				
			||||||
            if (command.aliases.length > 0) embed.addField('**Aliases:**', '`' + command.aliases.join('`, `') + '`');
 | 
					            if (command.aliases.length > 0) embed.addField('Aliases:', '`' + command.aliases.join('`, `') + '`');
 | 
				
			||||||
            if (command.userPerms.length > 0) embed.addField('**User permissions:**', command.userPerms.join(', '), true);
 | 
					            if (command.userPerms.length > 0) embed.addField('User permissions:', command.userPerms.join(', '), true);
 | 
				
			||||||
            if (command.botPerms.length > 0) embed.addField('**Bot permissions:', command.botPerms.join(', '), true);
 | 
					            if (command.botPerms.length > 0) embed.addField('Bot permissions:', command.botPerms.join(', '), true);
 | 
				
			||||||
            embed.addField('**Cooldown:**', `${command.cooldown / 1000} seconds`, true);
 | 
					            embed.addField('Cooldown:', `${command.cooldown / 1000} seconds`, true);
 | 
				
			||||||
            embed.setFooter('<> = required, / = either/or, [] = optional');
 | 
					            embed.setFooter('<> = required, / = either/or, [] = optional');
 | 
				
			||||||
            return message.channel.createMessage({ embed: embed });
 | 
					            return message.channel.createMessage({ embed: embed });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -69,7 +69,7 @@ module.exports = class {
 | 
				
			||||||
                    .setColour(client.functions.displayHexColour(message.channel.guild, client.user.id))
 | 
					                    .setColour(client.functions.displayHexColour(message.channel.guild, client.user.id))
 | 
				
			||||||
                    .setTitle(ability.name.toProperCase())
 | 
					                    .setTitle(ability.name.toProperCase())
 | 
				
			||||||
                    .setDescription(ability.desc)
 | 
					                    .setDescription(ability.desc)
 | 
				
			||||||
                    .addField('**External Resources:**', `[Bulbapedia](${ability.bulbapediaPage}) | [Serebii](${ability.serebiiPage}) | [Smogon](${ability.smogonPage})`);
 | 
					                    .addField('External Resources:', `[Bulbapedia](${ability.bulbapediaPage}) | [Serebii](${ability.serebiiPage}) | [Smogon](${ability.smogonPage})`);
 | 
				
			||||||
                message.channel.createMessage({ embed: embed });
 | 
					                message.channel.createMessage({ embed: embed });
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
            .catch(err => console.log(err));
 | 
					            .catch(err => console.log(err));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
const Embed = require('../../util/embed');
 | 
					const Embed = require('../../util/embed');
 | 
				
			||||||
const colours = require('../../assets/constants/typeColours.json');
 | 
					const { typeArray, colours } = require('../../assets/constants/pokemon.json');
 | 
				
			||||||
const fetch = require('node-fetch');
 | 
					const fetch = require('node-fetch');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module.exports = class {
 | 
					module.exports = class {
 | 
				
			||||||
| 
						 | 
					@ -16,41 +16,34 @@ module.exports = class {
 | 
				
			||||||
            description: 'Get useful data on any pokemon you ask me to!',
 | 
					            description: 'Get useful data on any pokemon you ask me to!',
 | 
				
			||||||
            arguments: '<pokemon>',
 | 
					            arguments: '<pokemon>',
 | 
				
			||||||
            details: '',
 | 
					            details: '',
 | 
				
			||||||
            examples: '`pokemon mudkip`\n`pokemon giratina-origin`'
 | 
					            examples: '`pokemon mudkip`\n`pokemon giratina origin`'
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async run (client, message, args, data) { //eslint-disable-line no-unused-vars
 | 
					    async run (client, message, args, data) { //eslint-disable-line no-unused-vars
 | 
				
			||||||
        if (!args[0]) return message.channel.createMessage(
 | 
					        if (!args[0]) return message.channel.createMessage(
 | 
				
			||||||
            `${client.constants.emojis.userError} You didn't give me a pokemon to look up!`
 | 
					            `${client.constants.emojis.userError} You didn't give me a pokemon or type combination to look up! Usage: \`${message.prefix + this.name + ' ' + this.help.arguments}\``
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        message.channel.sendTyping();
 | 
					        message.channel.sendTyping();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const query = args.join(' ').toLowerCase();
 | 
					        let types;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        fetch('https://graphqlpokemon.favware.tech/', {
 | 
					        if (!typeArray.includes(args[0].toProperCase())) {
 | 
				
			||||||
 | 
					            const res = await fetch('https://graphqlpokemon.favware.tech/', {
 | 
				
			||||||
                method: 'POST',
 | 
					                method: 'POST',
 | 
				
			||||||
                headers: {
 | 
					                headers: {
 | 
				
			||||||
                    'Content-Type': 'application/json'
 | 
					                    'Content-Type': 'application/json'
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                body: JSON.stringify({ query: `
 | 
					                body: JSON.stringify({ query: `
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                    getPokemonDetailsByFuzzy(pokemon: "${query}") {
 | 
					                        getPokemonDetailsByFuzzy(pokemon: "${args.join(' ').toLowerCase()}") {
 | 
				
			||||||
                        num
 | 
					 | 
				
			||||||
                        species
 | 
					 | 
				
			||||||
                            types
 | 
					                            types
 | 
				
			||||||
                        sprite
 | 
					 | 
				
			||||||
                        shinySprite
 | 
					 | 
				
			||||||
                        bulbapediaPage
 | 
					 | 
				
			||||||
                        serebiiPage
 | 
					 | 
				
			||||||
                        smogonPage
 | 
					 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                `})
 | 
					                `})
 | 
				
			||||||
        })
 | 
					            });
 | 
				
			||||||
            .then(res => res.json())
 | 
					            const json = await res.json();
 | 
				
			||||||
            .then(json => {
 | 
					 | 
				
			||||||
            if (json.errors) {
 | 
					            if (json.errors) {
 | 
				
			||||||
                json.errors.forEach(error => {
 | 
					                json.errors.forEach(error => {
 | 
				
			||||||
                    if (error.message.startsWith('No Pokémon found')) {
 | 
					                    if (error.message.startsWith('No Pokémon found')) {
 | 
				
			||||||
| 
						 | 
					@ -64,10 +57,11 @@ module.exports = class {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            console.log(json)
 | 
				
			||||||
                const pokemon = json.data.getPokemonDetailsByFuzzy;
 | 
					            types = json.data.getPokemonDetailsByFuzzy.types.join(', ').toLowerCase();
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
                console.log(pokemon.types)
 | 
					            types = args.join(', ').toLowerCase();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        fetch('https://graphqlpokemon.favware.tech/', {
 | 
					        fetch('https://graphqlpokemon.favware.tech/', {
 | 
				
			||||||
            method: 'POST',
 | 
					            method: 'POST',
 | 
				
			||||||
| 
						 | 
					@ -76,53 +70,49 @@ module.exports = class {
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            body: JSON.stringify({ query: `
 | 
					            body: JSON.stringify({ query: `
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                            getTypeMatchup(types: [water]) {
 | 
					                    getTypeMatchup(types: [${types}]) {
 | 
				
			||||||
                                attacking { doubleEffectiveTypes effectiveTypes resistedTypes doubleResistedTypes effectlessTypes }
 | 
					                        attacking { doubleEffectiveTypes effectiveTypes normalTypes resistedTypes doubleResistedTypes effectlessTypes }
 | 
				
			||||||
 | 
					                        defending { doubleEffectiveTypes effectiveTypes normalTypes resistedTypes doubleResistedTypes effectlessTypes }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            `})
 | 
					            `})
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
            .then(res => res.json())
 | 
					            .then(res => res.json())
 | 
				
			||||||
            .then(json => {
 | 
					            .then(json => {
 | 
				
			||||||
                        console.log(json)
 | 
					                console.log(json.data)
 | 
				
			||||||
                if (json.errors) {
 | 
					                if (json.errors) {
 | 
				
			||||||
                    json.errors.forEach(error => {
 | 
					                    json.errors.forEach(error => {
 | 
				
			||||||
 | 
					                        if (error.message.startsWith('No Pokémon found')) {
 | 
				
			||||||
 | 
					                            message.channel.createMessage(
 | 
				
			||||||
 | 
					                                `${client.constants.emojis.userError} I couldn't find any Pokemon with names similar to ${query}. Check your spelling, maybe?`
 | 
				
			||||||
 | 
					                            );
 | 
				
			||||||
 | 
					                        } else {
 | 
				
			||||||
                            client.logger.error('POKEMON_FETCH_ERROR', error.message);
 | 
					                            client.logger.error('POKEMON_FETCH_ERROR', error.message);
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                    });
 | 
					                    });
 | 
				
			||||||
        
 | 
					 | 
				
			||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        console.log(json.data)
 | 
					 | 
				
			||||||
                const typeMatchup = json.data.getTypeMatchup;
 | 
					                const typeMatchup = json.data.getTypeMatchup;
 | 
				
			||||||
                            
 | 
					                            
 | 
				
			||||||
                        let doubleEffective = '';
 | 
					 | 
				
			||||||
                        if (typeMatchup.doubleEffectiveTypes && typeMatchup.doubleEffectiveTypes.length > 0) {
 | 
					 | 
				
			||||||
                            doubleEffective = '**' + typeMatchup.doubleEffectiveTypes.join('**, **') + '**';
 | 
					 | 
				
			||||||
                            doubleEffective = doubleEffective.concat(typeMatchup.effectiveTypes).join(', ');
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                        let doubleResists = '';
 | 
					 | 
				
			||||||
                        if (typeMatchup.doubleResistedTypes &&  typeMatchup.doubleResistedTypes.length > 0) {
 | 
					 | 
				
			||||||
                            doubleResists = '**' + typeMatchup.doubleResistedTypes.join('** **') + '**';
 | 
					 | 
				
			||||||
                            doubleResists = doubleResists.split(' ');
 | 
					 | 
				
			||||||
                            doubleResists = doubleResists.concat(typeMatchup.resistedTypes).join(', ');
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                const embed = new Embed()
 | 
					                const embed = new Embed()
 | 
				
			||||||
                            .setColour(colours[pokemon.types[0]])
 | 
					                    .setTitle('Offensive')
 | 
				
			||||||
                            .setTitle(`${pokemon.species.toProperCase()} (No. ${pokemon.num})`)
 | 
					                    .addField('Weak to:', typeMatchup.attacking.effectiveTypes.join(', '))
 | 
				
			||||||
                            .setThumbnail(pokemon.sprite)
 | 
					                    .addField('Strong against:', typeMatchup.attacking.resistedTypes.join(', '));
 | 
				
			||||||
                            .addField('**Types:**', pokemon.types.join(', '), true)
 | 
					                    //.addField('Immune to:', typeMatchup.effectlessTypes.join(' '));
 | 
				
			||||||
                            .addField('**Weak to:**', doubleEffective)
 | 
					                    //.addField('External Resources:', `[Bulbapedia](${pokemon.bulbapediaPage}) | [Serebii](${pokemon.serebiiPage}) | [Smogon](${pokemon.smogonPage})`);
 | 
				
			||||||
                            .addField('**Strong against:**', doubleResists)
 | 
					 | 
				
			||||||
                            .addField('**Immune to:**', typeMatchup.effectlessTypes.join(' '))
 | 
					 | 
				
			||||||
                            .addField('**External Resources:**', `[Bulbapedia](${pokemon.bulbapediaPage}) | [Serebii](${pokemon.serebiiPage}) | [Smogon](${pokemon.smogonPage})`);
 | 
					 | 
				
			||||||
                message.channel.createMessage({ embed: embed });
 | 
					                message.channel.createMessage({ embed: embed });
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
                    .catch(err => client.logger.error('TYPEMATCHUP_CMD_ERROR', err));
 | 
					            .catch(err => client.logger.error('TYPEMATCHUP_CMD_ERROR', err.stack));
 | 
				
			||||||
            })
 | 
					 | 
				
			||||||
            .catch(err => client.logger.error('TYPEMATCHUP_CMD_ERROR', err));
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    parseEffectiveTypes (effective, doubleEffective) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    parseResistedTtypes (resisted, doubleResisted) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -61,15 +61,15 @@ module.exports = class {
 | 
				
			||||||
                        .setTitle(`Weather for ${city + ', ' + ISO2.code[json.sys.country]}`)
 | 
					                        .setTitle(`Weather for ${city + ', ' + ISO2.code[json.sys.country]}`)
 | 
				
			||||||
                        .setThumbnail(`https://openweathermap.org/img/wn/${json.weather[0].icon}@4x.png`)
 | 
					                        .setThumbnail(`https://openweathermap.org/img/wn/${json.weather[0].icon}@4x.png`)
 | 
				
			||||||
                        .setColour(embedColour)
 | 
					                        .setColour(embedColour)
 | 
				
			||||||
                        .addField('**Condition:**', json.weather[0].main, true)
 | 
					                        .addField('Condition:', json.weather[0].main, true)
 | 
				
			||||||
                        .addField('**Temperature:**', `${tempCelcius}°C | ${Math.round(json.main.temp * 9/5 - 459.67)}°F`, true)
 | 
					                        .addField('Temperature:', `${tempCelcius}°C | ${Math.round(json.main.temp * 9/5 - 459.67)}°F`, true)
 | 
				
			||||||
                        .addField('**Min/Max**:', `
 | 
					                        .addField('Min/Max:', `
 | 
				
			||||||
                            ${Math.round(json.main.temp_min - 273.15)}°C - ${Math.round(json.main.temp_max - 273.15)}°C
 | 
					                            ${Math.round(json.main.temp_min - 273.15)}°C - ${Math.round(json.main.temp_max - 273.15)}°C
 | 
				
			||||||
                            ${Math.round(json.main.temp_min * 9/5 - 459.67)}°F - ${Math.round(json.main.temp_max * 9/5 - 459.67)}°F
 | 
					                            ${Math.round(json.main.temp_min * 9/5 - 459.67)}°F - ${Math.round(json.main.temp_max * 9/5 - 459.67)}°F
 | 
				
			||||||
                        `, true)
 | 
					                        `, true)
 | 
				
			||||||
                        .addField('**Humidity:**', `${json.main.humidity}%`, true)
 | 
					                        .addField('Humidity:', `${json.main.humidity}%`, true)
 | 
				
			||||||
                        .addField('**Wind Speed:**', `${Math.round(json.wind.speed * 10) / 10}km/h | ${Math.round(json.wind.speed * 10 / 1.609344)}mi/h`, true)
 | 
					                        .addField('Wind Speed:', `${Math.round(json.wind.speed * 10) / 10}km/h | ${Math.round(json.wind.speed * 10 / 1.609344)}mi/h`, true)
 | 
				
			||||||
                        .addField('**Wind Direction:**', windrose.getPoint(json.wind.deg).name, true)
 | 
					                        .addField('Wind Direction:', windrose.getPoint(json.wind.deg).name, true)
 | 
				
			||||||
                        .setFooter('Powered by openweathermap.org');
 | 
					                        .setFooter('Powered by openweathermap.org');
 | 
				
			||||||
                    return message.channel.createMessage({ embed:embed });
 | 
					                    return message.channel.createMessage({ embed:embed });
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue