Skip to content

Commit 3b0eada

Browse files
committed
Clean up
1 parent c5cd542 commit 3b0eada

15 files changed

+575
-557
lines changed

README.md

+3-93
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,5 @@
1-
## discord.js docs
1+
## hypixel-api-reborn docs
22

3-
A parser and wrapper for the [discord.js](https://github.com/discordjs/discord.js) docs.
3+
A parser and wrapper for the [hypixel-api-reborn](https://github.com/hypixel-api-reborn/hypixel-api-reborn) docs.
44

5-
## Usage
6-
7-
### Doc
8-
9-
```js
10-
const Doc = require('discord.js-docs');
11-
```
12-
13-
### Doc.fetch(sourceName[, options])
14-
15-
Fetches and parses the docs for the given project.\
16-
`sourceName` can be any of the predefined values (`stable`, `main`, `commando`, `rpc`, `akairo`, `collection`,
17-
`builders`, `voice` and `rest`) or an URL which will return the raw generated docs (e.g
18-
https://raw.githubusercontent.com/discordjs/docs/main/discord.js/main.json ).\
19-
Once a documentation is fetched it will be cached. Use `options.force` to avoid this behavior.
20-
21-
**Params**:
22-
23-
| name | type | required |
24-
| :--------: | :----: | :------: |
25-
| sourceName | string | yes |
26-
| options | object | no |
27-
28-
**Returns**: `Promise<Doc?>`
29-
30-
```js
31-
const doc = await Doc.fetch('main');
32-
const doc = await Doc.fetch('akairo', { force: true });
33-
const doc = await Doc.fetch('https://raw.githubusercontent.com/discordjs/rpc/docs/master.json', { force: true });
34-
```
35-
36-
### Doc#get(parent[, child1[ ...[, childN]]])
37-
38-
Gets documention for one element. Multiple properties/methods can be chained. **Params**:
39-
40-
| name | type | required |
41-
| :---------: | :----: | :------: |
42-
| parent | string | yes |
43-
| ...children | string | no |
44-
45-
**Returns**: `DocElement?`
46-
47-
```js
48-
doc.get('message');
49-
doc.get('message', 'guild');
50-
doc.get('message', 'guild', 'members');
51-
```
52-
53-
### Doc#search(query)
54-
55-
Searches the documentation using fuzzy search for the given query and returns top 10 hits.
56-
57-
**Params**:
58-
59-
| name | type | required |
60-
| :---: | :----: | :------: |
61-
| query | string | yes |
62-
63-
**Returns**: `Array<DocElement>?`
64-
65-
### Doc#resolveEmbed(query)
66-
67-
Tries to resolve the query into a `DocElement` using `Doc#get`. The search terms are expected to be separated by `#` or
68-
`.`, example: `message#pin`. If an element cannot be resolved, falls back to `Doc#search`. The result is then formatted
69-
into an object representing a Discord embed which can be sent directly to a Discord channel.
70-
71-
**Params**:
72-
73-
| name | type | required |
74-
| :---: | :----: | :------: |
75-
| query | string | yes |
76-
77-
**Returns**: `object?`
78-
79-
### DocElement
80-
81-
#### Properties:
82-
83-
- `doc` - the Doc this element originates from;
84-
- `docType` - the type of this documentation element. One of `class`, `event`, `interface`, `method`, `param`, `prop`
85-
and `typedef`;
86-
- `parent` - parent element if present;
87-
- `name` - self-explanatory;
88-
- `description` - self-explanatory;
89-
- `meta` - any meta information if present;
90-
- `returns` - the type this element returns, if applicable;
91-
- `examples` - code examples, if any;
92-
- `type` - the JS type of this element, if applicable;
93-
- `nullable` - tells whether this element can be null;
94-
- `deprecated` - tells whether this element has been deprecated;
95-
- `access` - access level for this element. Defaults to `public`;
5+
Cloned from [TeeSeal/discord.js-docs](https://github.com/TeeSeal/discord.js-docs)

eslint.config.mjs

+72-65
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,72 @@
1-
import globals from 'globals';
2-
import js from '@eslint/js';
3-
4-
export default [
5-
js.configs.recommended,
6-
{
7-
ignores: ['docs/**', 'tests/**', 'node_modules/*'],
8-
languageOptions: {
9-
ecmaVersion: 2021,
10-
sourceType: 'commonjs',
11-
globals: {
12-
...globals.commonjs,
13-
...globals.es2021,
14-
...globals.node
15-
}
16-
},
17-
rules: {
18-
'max-len': ['error', { code: 120, ignoreUrls: true, ignoreComments: true }],
19-
'no-constant-condition': ['error', { checkLoops: false }],
20-
'prefer-const': ['warn', { destructuring: 'all' }],
21-
'no-unused-vars': ['error', { args: 'none' }],
22-
curly: ['warn', 'multi-line', 'consistent'],
23-
'logical-assignment-operators': 'warn',
24-
'no-template-curly-in-string': 'error',
25-
'quote-props': ['error', 'as-needed'],
26-
'comma-dangle': ['error', 'never'],
27-
'no-useless-constructor': 'error',
28-
'no-useless-assignment': 'error',
29-
'no-inner-declarations': 'error',
30-
'no-implicit-coercion': 'error',
31-
'no-use-before-define': 'warn',
32-
'no-underscore-dangle': 'warn',
33-
'no-unneeded-ternary': 'error',
34-
'default-param-last': 'error',
35-
'one-var': ['warn', 'never'],
36-
'no-inline-comments': 'warn',
37-
'no-empty-function': 'error',
38-
'no-useless-return': 'error',
39-
'no-useless-rename': 'warn',
40-
'no-useless-concat': 'warn',
41-
'no-throw-literal': 'error',
42-
'no-extend-native': 'error',
43-
'default-case-last': 'warn',
44-
'no-self-compare': 'error',
45-
'no-new-wrappers': 'error',
46-
'no-lone-blocks': 'error',
47-
'no-undef-init': 'error',
48-
'no-else-return': 'warn',
49-
'no-extra-semi': 'error',
50-
'require-await': 'warn',
51-
yoda: ['error', 'always'],
52-
'default-case': 'error',
53-
'dot-notation': 'error',
54-
'no-sequences': 'warn',
55-
'no-multi-str': 'warn',
56-
'no-lonely-if': 'warn',
57-
'no-new-func': 'error',
58-
'no-console': 'error',
59-
camelcase: 'warn',
60-
'no-var': 'warn',
61-
eqeqeq: 'warn',
62-
semi: 'error'
63-
}
64-
}
65-
];
1+
import globals from 'globals';
2+
import prettier from 'eslint-config-prettier';
3+
import sortImports from '@j4cobi/eslint-plugin-sort-imports';
4+
import js from '@eslint/js';
5+
6+
export default [
7+
js.configs.recommended,
8+
prettier,
9+
{
10+
ignores: ['**/node_modules/', '**/pnpm-lock.yaml'],
11+
languageOptions: {
12+
ecmaVersion: 2022,
13+
sourceType: 'module',
14+
globals: {
15+
...globals.es2022,
16+
...globals.node
17+
}
18+
},
19+
plugins: { 'sort-imports': sortImports },
20+
rules: {
21+
'sort-imports/sort-imports': [
22+
'error',
23+
{ ignoreCase: false, ignoreMemberSort: false, memberSyntaxSortOrder: ['all', 'single', 'multiple', 'none'] }
24+
],
25+
'max-len': ['error', { code: 120, ignoreUrls: true, ignoreComments: true }],
26+
'no-constant-condition': ['error', { checkLoops: false }],
27+
'prefer-const': ['warn', { destructuring: 'all' }],
28+
'no-unused-vars': ['error', { args: 'none' }],
29+
curly: ['warn', 'multi-line', 'consistent'],
30+
'logical-assignment-operators': 'warn',
31+
'no-template-curly-in-string': 'error',
32+
'quote-props': ['error', 'as-needed'],
33+
'comma-dangle': ['error', 'never'],
34+
'no-useless-constructor': 'error',
35+
'no-useless-assignment': 'error',
36+
'no-inner-declarations': 'error',
37+
'no-implicit-coercion': 'error',
38+
'no-use-before-define': 'warn',
39+
'no-underscore-dangle': 'warn',
40+
'no-unneeded-ternary': 'error',
41+
'default-param-last': 'error',
42+
'one-var': ['warn', 'never'],
43+
'no-inline-comments': 'warn',
44+
'no-empty-function': 'error',
45+
'no-useless-return': 'error',
46+
'no-useless-rename': 'warn',
47+
'no-useless-concat': 'warn',
48+
'no-throw-literal': 'error',
49+
'no-extend-native': 'error',
50+
'default-case-last': 'warn',
51+
'no-self-compare': 'error',
52+
'no-new-wrappers': 'error',
53+
'no-lone-blocks': 'error',
54+
'no-undef-init': 'error',
55+
'no-else-return': 'warn',
56+
'no-extra-semi': 'error',
57+
'require-await': 'warn',
58+
yoda: ['error', 'always'],
59+
'default-case': 'error',
60+
'dot-notation': 'error',
61+
'no-sequences': 'warn',
62+
'no-multi-str': 'warn',
63+
'no-lonely-if': 'warn',
64+
'no-new-func': 'error',
65+
'no-console': 'error',
66+
camelcase: 'warn',
67+
'no-var': 'warn',
68+
eqeqeq: 'warn',
69+
semi: 'error'
70+
}
71+
}
72+
];

package.json

+34-32
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
1-
{
2-
"name": "discord.js-docs",
3-
"version": "0.3.0",
4-
"description": "A discord.js docs parser and wrapper.",
5-
"main": "index.js",
6-
"repository": "[email protected]:TeeSeal/discord.js-docs.git",
7-
"author": "TeeSeal <[email protected]>",
8-
"license": "MIT",
9-
"types": "types/index.d.ts",
10-
"engines": {
11-
"node": ">=16.20.2"
12-
},
13-
"packageManager": "[email protected]",
14-
"scripts": {
15-
"lint:check": "npx eslint src/",
16-
"lint": "npx eslint src/ --fix",
17-
"prettier": "npx prettier --write src/ types/",
18-
"prettier:check": "npx prettier --check src/ types/"
19-
},
20-
"dependencies": {
21-
"common-tags": "^1.8.2",
22-
"discord.js": "^13.17.1",
23-
"fuse.js": "^3.6.1",
24-
"node-fetch": "^2.7.0"
25-
},
26-
"devDependencies": {
27-
"@eslint/js": "^9.9.0",
28-
"eslint": "^9.9.0",
29-
"globals": "^15.9.0",
30-
"prettier": "^3.3.3"
31-
}
32-
}
1+
{
2+
"name": "discord.js-docs",
3+
"version": "0.3.0",
4+
"description": "A discord.js docs parser and wrapper.",
5+
"main": "index.js",
6+
"repository": "[email protected]:TeeSeal/discord.js-docs.git",
7+
"author": "TeeSeal <[email protected]>",
8+
"license": "MIT",
9+
"types": "types/index.d.ts",
10+
"engines": {
11+
"node": ">=16.20.2"
12+
},
13+
"packageManager": "[email protected]",
14+
"scripts": {
15+
"lint:check": "npx eslint src/ index.js",
16+
"lint": "npx eslint --fix src/ index.js",
17+
"prettier:check": "npx prettier --check src/ index.js",
18+
"prettier": "npx prettier --write src/ index.js"
19+
},
20+
"dependencies": {
21+
"common-tags": "^1.8.2",
22+
"discord.js": "^14.16.2",
23+
"fuse.js": "^3.6.1",
24+
"node-fetch": "^2.7.0"
25+
},
26+
"devDependencies": {
27+
"@eslint/js": "^9.11.1",
28+
"@j4cobi/eslint-plugin-sort-imports": "^1.0.2",
29+
"@types/eslint": "^9.6.1",
30+
"eslint": "^9.11.1",
31+
"eslint-config-prettier": "^9.1.0",
32+
"prettier": "^3.3.3"
33+
}
34+
}

0 commit comments

Comments
 (0)