forked from TeeSeal/discord.js-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
575 additions
and
557 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,5 @@ | ||
## discord.js docs | ||
## hypixel-api-reborn docs | ||
|
||
A parser and wrapper for the [discord.js](https://github.com/discordjs/discord.js) docs. | ||
A parser and wrapper for the [hypixel-api-reborn](https://github.com/hypixel-api-reborn/hypixel-api-reborn) docs. | ||
|
||
## Usage | ||
|
||
### Doc | ||
|
||
```js | ||
const Doc = require('discord.js-docs'); | ||
``` | ||
|
||
### Doc.fetch(sourceName[, options]) | ||
|
||
Fetches and parses the docs for the given project.\ | ||
`sourceName` can be any of the predefined values (`stable`, `main`, `commando`, `rpc`, `akairo`, `collection`, | ||
`builders`, `voice` and `rest`) or an URL which will return the raw generated docs (e.g | ||
https://raw.githubusercontent.com/discordjs/docs/main/discord.js/main.json ).\ | ||
Once a documentation is fetched it will be cached. Use `options.force` to avoid this behavior. | ||
|
||
**Params**: | ||
|
||
| name | type | required | | ||
| :--------: | :----: | :------: | | ||
| sourceName | string | yes | | ||
| options | object | no | | ||
|
||
**Returns**: `Promise<Doc?>` | ||
|
||
```js | ||
const doc = await Doc.fetch('main'); | ||
const doc = await Doc.fetch('akairo', { force: true }); | ||
const doc = await Doc.fetch('https://raw.githubusercontent.com/discordjs/rpc/docs/master.json', { force: true }); | ||
``` | ||
|
||
### Doc#get(parent[, child1[ ...[, childN]]]) | ||
|
||
Gets documention for one element. Multiple properties/methods can be chained. **Params**: | ||
|
||
| name | type | required | | ||
| :---------: | :----: | :------: | | ||
| parent | string | yes | | ||
| ...children | string | no | | ||
|
||
**Returns**: `DocElement?` | ||
|
||
```js | ||
doc.get('message'); | ||
doc.get('message', 'guild'); | ||
doc.get('message', 'guild', 'members'); | ||
``` | ||
|
||
### Doc#search(query) | ||
|
||
Searches the documentation using fuzzy search for the given query and returns top 10 hits. | ||
|
||
**Params**: | ||
|
||
| name | type | required | | ||
| :---: | :----: | :------: | | ||
| query | string | yes | | ||
|
||
**Returns**: `Array<DocElement>?` | ||
|
||
### Doc#resolveEmbed(query) | ||
|
||
Tries to resolve the query into a `DocElement` using `Doc#get`. The search terms are expected to be separated by `#` or | ||
`.`, example: `message#pin`. If an element cannot be resolved, falls back to `Doc#search`. The result is then formatted | ||
into an object representing a Discord embed which can be sent directly to a Discord channel. | ||
|
||
**Params**: | ||
|
||
| name | type | required | | ||
| :---: | :----: | :------: | | ||
| query | string | yes | | ||
|
||
**Returns**: `object?` | ||
|
||
### DocElement | ||
|
||
#### Properties: | ||
|
||
- `doc` - the Doc this element originates from; | ||
- `docType` - the type of this documentation element. One of `class`, `event`, `interface`, `method`, `param`, `prop` | ||
and `typedef`; | ||
- `parent` - parent element if present; | ||
- `name` - self-explanatory; | ||
- `description` - self-explanatory; | ||
- `meta` - any meta information if present; | ||
- `returns` - the type this element returns, if applicable; | ||
- `examples` - code examples, if any; | ||
- `type` - the JS type of this element, if applicable; | ||
- `nullable` - tells whether this element can be null; | ||
- `deprecated` - tells whether this element has been deprecated; | ||
- `access` - access level for this element. Defaults to `public`; | ||
Cloned from [TeeSeal/discord.js-docs](https://github.com/TeeSeal/discord.js-docs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,72 @@ | ||
import globals from 'globals'; | ||
import js from '@eslint/js'; | ||
|
||
export default [ | ||
js.configs.recommended, | ||
{ | ||
ignores: ['docs/**', 'tests/**', 'node_modules/*'], | ||
languageOptions: { | ||
ecmaVersion: 2021, | ||
sourceType: 'commonjs', | ||
globals: { | ||
...globals.commonjs, | ||
...globals.es2021, | ||
...globals.node | ||
} | ||
}, | ||
rules: { | ||
'max-len': ['error', { code: 120, ignoreUrls: true, ignoreComments: true }], | ||
'no-constant-condition': ['error', { checkLoops: false }], | ||
'prefer-const': ['warn', { destructuring: 'all' }], | ||
'no-unused-vars': ['error', { args: 'none' }], | ||
curly: ['warn', 'multi-line', 'consistent'], | ||
'logical-assignment-operators': 'warn', | ||
'no-template-curly-in-string': 'error', | ||
'quote-props': ['error', 'as-needed'], | ||
'comma-dangle': ['error', 'never'], | ||
'no-useless-constructor': 'error', | ||
'no-useless-assignment': 'error', | ||
'no-inner-declarations': 'error', | ||
'no-implicit-coercion': 'error', | ||
'no-use-before-define': 'warn', | ||
'no-underscore-dangle': 'warn', | ||
'no-unneeded-ternary': 'error', | ||
'default-param-last': 'error', | ||
'one-var': ['warn', 'never'], | ||
'no-inline-comments': 'warn', | ||
'no-empty-function': 'error', | ||
'no-useless-return': 'error', | ||
'no-useless-rename': 'warn', | ||
'no-useless-concat': 'warn', | ||
'no-throw-literal': 'error', | ||
'no-extend-native': 'error', | ||
'default-case-last': 'warn', | ||
'no-self-compare': 'error', | ||
'no-new-wrappers': 'error', | ||
'no-lone-blocks': 'error', | ||
'no-undef-init': 'error', | ||
'no-else-return': 'warn', | ||
'no-extra-semi': 'error', | ||
'require-await': 'warn', | ||
yoda: ['error', 'always'], | ||
'default-case': 'error', | ||
'dot-notation': 'error', | ||
'no-sequences': 'warn', | ||
'no-multi-str': 'warn', | ||
'no-lonely-if': 'warn', | ||
'no-new-func': 'error', | ||
'no-console': 'error', | ||
camelcase: 'warn', | ||
'no-var': 'warn', | ||
eqeqeq: 'warn', | ||
semi: 'error' | ||
} | ||
} | ||
]; | ||
import globals from 'globals'; | ||
import prettier from 'eslint-config-prettier'; | ||
import sortImports from '@j4cobi/eslint-plugin-sort-imports'; | ||
import js from '@eslint/js'; | ||
|
||
export default [ | ||
js.configs.recommended, | ||
prettier, | ||
{ | ||
ignores: ['**/node_modules/', '**/pnpm-lock.yaml'], | ||
languageOptions: { | ||
ecmaVersion: 2022, | ||
sourceType: 'module', | ||
globals: { | ||
...globals.es2022, | ||
...globals.node | ||
} | ||
}, | ||
plugins: { 'sort-imports': sortImports }, | ||
rules: { | ||
'sort-imports/sort-imports': [ | ||
'error', | ||
{ ignoreCase: false, ignoreMemberSort: false, memberSyntaxSortOrder: ['all', 'single', 'multiple', 'none'] } | ||
], | ||
'max-len': ['error', { code: 120, ignoreUrls: true, ignoreComments: true }], | ||
'no-constant-condition': ['error', { checkLoops: false }], | ||
'prefer-const': ['warn', { destructuring: 'all' }], | ||
'no-unused-vars': ['error', { args: 'none' }], | ||
curly: ['warn', 'multi-line', 'consistent'], | ||
'logical-assignment-operators': 'warn', | ||
'no-template-curly-in-string': 'error', | ||
'quote-props': ['error', 'as-needed'], | ||
'comma-dangle': ['error', 'never'], | ||
'no-useless-constructor': 'error', | ||
'no-useless-assignment': 'error', | ||
'no-inner-declarations': 'error', | ||
'no-implicit-coercion': 'error', | ||
'no-use-before-define': 'warn', | ||
'no-underscore-dangle': 'warn', | ||
'no-unneeded-ternary': 'error', | ||
'default-param-last': 'error', | ||
'one-var': ['warn', 'never'], | ||
'no-inline-comments': 'warn', | ||
'no-empty-function': 'error', | ||
'no-useless-return': 'error', | ||
'no-useless-rename': 'warn', | ||
'no-useless-concat': 'warn', | ||
'no-throw-literal': 'error', | ||
'no-extend-native': 'error', | ||
'default-case-last': 'warn', | ||
'no-self-compare': 'error', | ||
'no-new-wrappers': 'error', | ||
'no-lone-blocks': 'error', | ||
'no-undef-init': 'error', | ||
'no-else-return': 'warn', | ||
'no-extra-semi': 'error', | ||
'require-await': 'warn', | ||
yoda: ['error', 'always'], | ||
'default-case': 'error', | ||
'dot-notation': 'error', | ||
'no-sequences': 'warn', | ||
'no-multi-str': 'warn', | ||
'no-lonely-if': 'warn', | ||
'no-new-func': 'error', | ||
'no-console': 'error', | ||
camelcase: 'warn', | ||
'no-var': 'warn', | ||
eqeqeq: 'warn', | ||
semi: 'error' | ||
} | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
{ | ||
"name": "discord.js-docs", | ||
"version": "0.3.0", | ||
"description": "A discord.js docs parser and wrapper.", | ||
"main": "index.js", | ||
"repository": "[email protected]:TeeSeal/discord.js-docs.git", | ||
"author": "TeeSeal <[email protected]>", | ||
"license": "MIT", | ||
"types": "types/index.d.ts", | ||
"engines": { | ||
"node": ">=16.20.2" | ||
}, | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"lint:check": "npx eslint src/", | ||
"lint": "npx eslint src/ --fix", | ||
"prettier": "npx prettier --write src/ types/", | ||
"prettier:check": "npx prettier --check src/ types/" | ||
}, | ||
"dependencies": { | ||
"common-tags": "^1.8.2", | ||
"discord.js": "^13.17.1", | ||
"fuse.js": "^3.6.1", | ||
"node-fetch": "^2.7.0" | ||
}, | ||
"devDependencies": { | ||
"@eslint/js": "^9.9.0", | ||
"eslint": "^9.9.0", | ||
"globals": "^15.9.0", | ||
"prettier": "^3.3.3" | ||
} | ||
} | ||
{ | ||
"name": "discord.js-docs", | ||
"version": "0.3.0", | ||
"description": "A discord.js docs parser and wrapper.", | ||
"main": "index.js", | ||
"repository": "[email protected]:TeeSeal/discord.js-docs.git", | ||
"author": "TeeSeal <[email protected]>", | ||
"license": "MIT", | ||
"types": "types/index.d.ts", | ||
"engines": { | ||
"node": ">=16.20.2" | ||
}, | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"lint:check": "npx eslint src/ index.js", | ||
"lint": "npx eslint --fix src/ index.js", | ||
"prettier:check": "npx prettier --check src/ index.js", | ||
"prettier": "npx prettier --write src/ index.js" | ||
}, | ||
"dependencies": { | ||
"common-tags": "^1.8.2", | ||
"discord.js": "^14.16.2", | ||
"fuse.js": "^3.6.1", | ||
"node-fetch": "^2.7.0" | ||
}, | ||
"devDependencies": { | ||
"@eslint/js": "^9.11.1", | ||
"@j4cobi/eslint-plugin-sort-imports": "^1.0.2", | ||
"@types/eslint": "^9.6.1", | ||
"eslint": "^9.11.1", | ||
"eslint-config-prettier": "^9.1.0", | ||
"prettier": "^3.3.3" | ||
} | ||
} |
Oops, something went wrong.