Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lol-item API call giving undefined status code #1

Closed
c3duan opened this issue Sep 14, 2018 · 0 comments
Closed

lol-item API call giving undefined status code #1

c3duan opened this issue Sep 14, 2018 · 0 comments

Comments

@c3duan
Copy link
Owner

c3duan commented Sep 14, 2018

kayn.DDragon.Item .list() .version(config.riot_api_version) .callback((error, list) => { if (error) { console.error(error); return message.reply('sorry an api error occurred, please try again.'); }

            const items = list.data;
            const item = Object.entries(items).find(weapon => weapon.name.toLowerCase() === itemName);
            if (!item) {
                return message.reply('sorry no such item exists, please try again.');
            }
            const embed = new Discord.RichEmbed()
                .setTitle(item.name)
                .setDescription(item.description.replace(/\s*\<.*?\>\s*/g, ''))
                .setThumbnail(`http://ddragon.leagueoflegends.com/cdn/${config.riot_api_version}/img/item/${item.image.full}`)
                .addField(`${item.plaintext} into ${item.into.join('/')}`)
                .addField('Purchase Price', item.gold.total, true)
                .addField('Sell Price', item.gold.sell, true);
                
            message.channel.reply(embed);
        });`

{ statusCode: undefined, url: 'https://ddragon.leagueoflegends.com/cdn/8.18.2/data/en_US/item.json', error: TypeError: Cannot read property 'statusCode' of null at kayn.DDragon.Item.list.version.callback }

@c3duan c3duan closed this as completed Sep 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant