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

Problem with the random cat and urban dictionary api code you put. #115

Closed
zaida04 opened this issue Jul 23, 2018 · 5 comments
Closed

Problem with the random cat and urban dictionary api code you put. #115

zaida04 opened this issue Jul 23, 2018 · 5 comments

Comments

@zaida04
Copy link

zaida04 commented Jul 23, 2018

So, I tried one of your tutorial code files so I could implement a feature from here into my bot. The one I tried is located at: guide/code-samples/additional-info/rest-api/index.js. When i tried to execute the code it worked. But when I executed the command it gave me an error: (I renamed the index.js to test.js)
https://i.imgur.com/CMAOqvY.png
https://i.imgur.com/jHaXNGh.png

I tried editing it heavily and body.result_list and body.list were included in the error messages that i got from them:
https://i.imgur.com/nBSDTKm.png
https://i.imgur.com/yuorJyb.png

@Danktuary
Copy link
Member

Danktuary commented Jul 24, 2018

From what I can tell, It seems like the Urban Dictionary API has changed a bit, or their site is having some issues.

At one point, if a definition had tags, it would be included in the API response. But that doesn't seem to be the case anymore (screenshot 1 - screenshot 2). Not all definitions have tags, but it's not showing the tags for tags that do either way. In addition to that, if you click on the tag, it'll take you to a page that's supposed to show you a list of all the definitions tagged with said tag, but right now, it'll tell you that there aren't any definitions tagged with said tag.

Since this is the first report of this I've seen of this, I'm not sure how long ago this started, if it's temporary, if it's a bug, or if it's intentional. I'll keep an eye out for any updates regarding this and decide on what to do afterwards. For the time being, I'd recommend just removing this line from the file:

.setFooter(`Tags: ${body.tags.join(', ')}`);

It should work fine after that.

@zaida04
Copy link
Author

zaida04 commented Jul 24, 2018

i tried your suggestion annnnnd
https://i.imgur.com/xRVTJx6.png

ill link to my code in a pastebin:
https://pastebin.com/E66q4zQr

@zaida04
Copy link
Author

zaida04 commented Jul 24, 2018

^above
im using a command handler, so thats why its in a module.exports wrapper and also why im not using large parts of your index.js file

@Danktuary
Copy link
Member

You receive that error because you're missing await before snekfetch.get(). Also be sure to add async before execute() { ....

@zaida04
Copy link
Author

zaida04 commented Jul 24, 2018

Aighty now it works, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants