type while waiting for API
This commit is contained in:
parent
afd3b7197e
commit
6bca81b7a9
1 changed files with 7 additions and 5 deletions
|
@ -11,12 +11,12 @@ module.exports = class {
|
||||||
this.aliases = ['pokedex', 'dex'],
|
this.aliases = ['pokedex', 'dex'],
|
||||||
this.userPerms = [],
|
this.userPerms = [],
|
||||||
this.botPerms = [],
|
this.botPerms = [],
|
||||||
this.cooldown = 2000,
|
this.cooldown = 5000,
|
||||||
this.help = {
|
this.help = {
|
||||||
description: '',
|
description: 'Get useful data on any pokemon you ask me to!',
|
||||||
arguments: '',
|
arguments: '<pokemon>',
|
||||||
details: '',
|
details: '',
|
||||||
examples: ''
|
examples: '`pokemon mudkip`\n`pokemon giratina-origin`'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@ module.exports = class {
|
||||||
`${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 to look up!`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
message.channel.sendTyping();
|
||||||
|
|
||||||
const query = args.join(' ').toLowerCase();
|
const query = args.join(' ').toLowerCase();
|
||||||
|
|
||||||
fetch('https://graphqlpokemon.favware.tech/', {
|
fetch('https://graphqlpokemon.favware.tech/', {
|
||||||
|
@ -67,7 +69,7 @@ module.exports = class {
|
||||||
json.errors.forEach(error => {
|
json.errors.forEach(error => {
|
||||||
if (error.message.startsWith('No Pokémon found')) {
|
if (error.message.startsWith('No Pokémon found')) {
|
||||||
message.channel.createMessage(
|
message.channel.createMessage(
|
||||||
`${client.constants.emojis.userError} I couldn't find any Pokemon called ${query}c`
|
`${client.constants.emojis.userError} I couldn't find any Pokemon called ${query}`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
client.logger.error('POKEMON_FETCH_ERROR', error.message);
|
client.logger.error('POKEMON_FETCH_ERROR', error.message);
|
||||||
|
|
Loading…
Reference in a new issue