Create a command to find word meanings in dictionary

I am trying to make a command which gives me the meaning of a desired word using this API
https://api.dictionaryapi.dev/api/v2/entries/en/
but I just can’t get it to work with nightbot
I don’t know much about these things anyway

1 Like

Hey @Clauwasaki!

You need to use $(eval), $(urlfetch), and $(query), if you don’t know what these do, please read the documentation.
You also need to use the documentation of the API you gave us, you’ll notice the API output is in JSON, the example given allows us to figure out how to exploit it with Javascript, but we could have gotten the same information by just trying the API in the browser.

With all that said, here’s the command to get the first result of any single word search:

$(eval $(urlfetch json https://api.dictionaryapi.dev/api/v2/entries/en/$(query))[0].meanings[0].definitions[0].definition)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.