Skip to content

MDN documentation command #11

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

Merged
merged 15 commits into from
Dec 11, 2021

Conversation

jhmaster2000
Copy link
Contributor

Adds a new command, docs!mdn <query> which returns results from anywhere in https://developer.mozilla.org/, not limited to JavaScript.

This is NOT achieved by scraping, not a single bit of HTML is even touched, the data to search is obtained by fetching MDN's sitemap at https://developer.mozilla.org/sitemaps/en-us/sitemap.xml.gz, which is cached in memory and refreshed once every 12 hours on demand. (Because of this, consistency between the bot's results and MDN's own search box cannot be guaranteed and more often than not WILL be different)

When only a single result is found, instead of a list of results, in-depth data of the result's page is fetched from its /index.json (see: https://developer.mozilla.org/en-US/docs/MDN/Tools/Unsupported_GET_API) and displayed as a website embed, except with a small thumbnail image instead of MDN's default website embeds which give a massive useless image that floods the Discord channel. More data from /index.json may be used in the future such as the compatibility table and specification references but for now they are not used.

This PR contains a few other smaller miscellaneous changes such as updating some dependencies to fix reported vulnerabilities, adding a start script to the package.json and fixing some minor typos etc.

@ItsAzaria ItsAzaria merged commit 9f9144d into the-programmers-hangout:master Dec 11, 2021
@ItsAzaria
Copy link
Contributor

Thank you for the PR!

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

Successfully merging this pull request may close these issues.

3 participants