Create a command to find word meanings in dictionary

Asked Feb 21, 2022·1 reply·Last activity 4 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

1 reply

Hey @Hasty Bat!

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)