From 391d972d98884423c07e183305a9d199f4ba8622 Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Fri, 6 May 2022 21:17:20 +0700 Subject: [PATCH] document --- .github/workflows/lint.yml | 2 +- docs/index.yml | 5 +++ package-lock.json | 38 +++++++++---------- package.json | 9 +++-- src/client/Client.js | 10 ++++- .../websocket/handlers/RELATIONSHIP_ADD.js | 4 +- .../websocket/handlers/RELATIONSHIP_REMOVE.js | 4 +- src/structures/PartialGroupDMChannel.js | 1 + src/structures/User.js | 2 + src/util/Constants.js | 2 +- 10 files changed, 47 insertions(+), 30 deletions(-) create mode 100644 docs/index.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6e04d2e..19c7cb6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,4 +21,4 @@ jobs: with: node-version: ${{ matrix.node-version }} - run: npm i - - run: npm run lint:all \ No newline at end of file + - run: npm run test \ No newline at end of file diff --git a/docs/index.yml b/docs/index.yml new file mode 100644 index 00000000..0aea5a7 --- /dev/null +++ b/docs/index.yml @@ -0,0 +1,5 @@ +- name: General + files: + - name: Welcome + id: welcome + path: ../../README.md \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index dd4694d..c7fa1f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,7 +42,7 @@ "devDependencies": { "@commitlint/cli": "^16.0.1", "@commitlint/config-angular": "^16.0.0", - "@discordjs/docgen": "^0.11.0", + "@discordjs/docgen": "^0.11.1", "@favware/npm-deprecate": "^1.0.4", "@types/node": "^16.11.12", "conventional-changelog-cli": "^2.2.2", @@ -8114,9 +8114,9 @@ } }, "node_modules/jsdoc/node_modules/marked": { - "version": "4.0.14", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.14.tgz", - "integrity": "sha512-HL5sSPE/LP6U9qKgngIIPTthuxC0jrfxpYMZ3LdGDD3vTnLs59m2Z7r6+LNDR3ToqEQdkKd6YaaEfJhodJmijQ==", + "version": "4.0.15", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.15.tgz", + "integrity": "sha512-esX5lPdTfG4p8LDkv+obbRCyOKzB+820ZZyMOXJZygZBHrH9b3xXR64X4kT3sPe9Nx8qQXbmcz6kFSMt4Nfk6Q==", "dev": true, "bin": { "marked": "bin/marked.js" @@ -8794,9 +8794,9 @@ } }, "node_modules/markdown-it-anchor": { - "version": "8.6.2", - "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.2.tgz", - "integrity": "sha512-JNaekTlIwwyYGBN3zifZDxgz4bSL8sbEj58fdTZGmPSMMGXBZapFjcZk2I33Jy79c1fvCKHpF7MA/67FOTjvzA==", + "version": "8.6.3", + "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.3.tgz", + "integrity": "sha512-3IiHYh/kJHY2IcuKv5qv+IKNxDwXjVoYQ5FvbBUPywcwCQ4ICLIw5z0QrhYBtcD7h88MfFK3zKAkABTvPMxm7A==", "dev": true, "peerDependencies": { "@types/markdown-it": "*", @@ -14190,9 +14190,9 @@ } }, "node_modules/underscore": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.2.tgz", - "integrity": "sha512-ekY1NhRzq0B08g4bGuX4wd2jZx5GnKz6mKSqFL4nqBlfyMGiG10gDFhDTMEfYmDL6Jy0FUIZp7wiRB+0BP7J2g==", + "version": "1.13.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.3.tgz", + "integrity": "sha512-QvjkYpiD+dJJraRA8+dGAU4i7aBbb2s0S3jA45TFOvg2VgqvdCDd/3N6CqA8gluk1W91GLoXg5enMUx560QzuA==", "dev": true }, "node_modules/undici": { @@ -20894,9 +20894,9 @@ "dev": true }, "marked": { - "version": "4.0.14", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.14.tgz", - "integrity": "sha512-HL5sSPE/LP6U9qKgngIIPTthuxC0jrfxpYMZ3LdGDD3vTnLs59m2Z7r6+LNDR3ToqEQdkKd6YaaEfJhodJmijQ==", + "version": "4.0.15", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.15.tgz", + "integrity": "sha512-esX5lPdTfG4p8LDkv+obbRCyOKzB+820ZZyMOXJZygZBHrH9b3xXR64X4kT3sPe9Nx8qQXbmcz6kFSMt4Nfk6Q==", "dev": true }, "mkdirp": { @@ -21489,9 +21489,9 @@ } }, "markdown-it-anchor": { - "version": "8.6.2", - "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.2.tgz", - "integrity": "sha512-JNaekTlIwwyYGBN3zifZDxgz4bSL8sbEj58fdTZGmPSMMGXBZapFjcZk2I33Jy79c1fvCKHpF7MA/67FOTjvzA==", + "version": "8.6.3", + "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.3.tgz", + "integrity": "sha512-3IiHYh/kJHY2IcuKv5qv+IKNxDwXjVoYQ5FvbBUPywcwCQ4ICLIw5z0QrhYBtcD7h88MfFK3zKAkABTvPMxm7A==", "dev": true, "requires": {} }, @@ -25370,9 +25370,9 @@ } }, "underscore": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.2.tgz", - "integrity": "sha512-ekY1NhRzq0B08g4bGuX4wd2jZx5GnKz6mKSqFL4nqBlfyMGiG10gDFhDTMEfYmDL6Jy0FUIZp7wiRB+0BP7J2g==", + "version": "1.13.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.3.tgz", + "integrity": "sha512-QvjkYpiD+dJJraRA8+dGAU4i7aBbb2s0S3jA45TFOvg2VgqvdCDd/3N6CqA8gluk1W91GLoXg5enMUx560QzuA==", "dev": true }, "undici": { diff --git a/package.json b/package.json index 935f692..0fb1c19 100644 --- a/package.json +++ b/package.json @@ -5,14 +5,17 @@ "main": "./src/index.js", "types": "./typings/index.d.ts", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "npm run lint:all && npm run lint:typings && npm run docs:test", + "test:typescript": "tsc --noEmit && tsd", "lint": "eslint .", "lint:fix": "eslint . --fix", "lint:typings": "tslint typings/index.d.ts", "lint:typings:fix": "tslint typings/index.d.ts --fix", "format": "prettier --write src/**/*.js typings/**/*.ts", "lint:all": "npm run lint && npm run lint:typings", - "checkup": "node update.mjs" + "checkup": "node update.mjs", + "docs": "docgen --source src --custom docs/index.yml --output docs/docs.json", + "docs:test": "docgen --source src --custom docs/index.yml" }, "files": [ "src", @@ -83,7 +86,7 @@ "devDependencies": { "@commitlint/cli": "^16.0.1", "@commitlint/config-angular": "^16.0.0", - "@discordjs/docgen": "^0.11.0", + "@discordjs/docgen": "^0.11.1", "@favware/npm-deprecate": "^1.0.4", "@types/node": "^16.11.12", "conventional-changelog-cli": "^2.2.2", diff --git a/src/client/Client.js b/src/client/Client.js index f538a07..966a7b4 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -127,10 +127,16 @@ class Client extends BaseClient { */ this.users = new UserManager(this); - /** Patch - * + // Patch + /** + * All of the relationships {@link User} + * @type {RelationshipsManager} */ this.relationships = new RelationshipsManager(this); + /** + * All of the settings {@link Object} + * @type {ClientUserSettingManager} + */ this.setting = new ClientUserSettingManager(this); /** * All of the guilds the client is currently handling, mapped by their ids - diff --git a/src/client/websocket/handlers/RELATIONSHIP_ADD.js b/src/client/websocket/handlers/RELATIONSHIP_ADD.js index ad07c80..061d803 100644 --- a/src/client/websocket/handlers/RELATIONSHIP_ADD.js +++ b/src/client/websocket/handlers/RELATIONSHIP_ADD.js @@ -9,8 +9,8 @@ module.exports = (client, { d: data }) => { client.relationships.cache.set(data.id, data.type); /** * Emitted whenever a relationship is updated. - * @event Client#relationshipUpdate - * @param {UserID} user The userID that was updated + * @event Client#relationshipAdd + * @param {UserId} user The userID that was updated * @param {Number} type The new relationship type */ client.emit(Events.RELATIONSHIP_ADD, data.id, data.type); diff --git a/src/client/websocket/handlers/RELATIONSHIP_REMOVE.js b/src/client/websocket/handlers/RELATIONSHIP_REMOVE.js index dafa6c5..4662f7b 100644 --- a/src/client/websocket/handlers/RELATIONSHIP_REMOVE.js +++ b/src/client/websocket/handlers/RELATIONSHIP_REMOVE.js @@ -6,8 +6,8 @@ module.exports = (client, { d: data }) => { client.relationships.cache.delete(data.id); /** * Emitted whenever a relationship is updated. - * @event Client#relationshipUpdate - * @param {UserID} user The userID that was updated + * @event Client#relationshipRemove + * @param {UserId} user The userID that was updated */ client.emit(Events.RELATIONSHIP_REMOVE, data.id); }; diff --git a/src/structures/PartialGroupDMChannel.js b/src/structures/PartialGroupDMChannel.js index 78e79da..a20bb9d 100644 --- a/src/structures/PartialGroupDMChannel.js +++ b/src/structures/PartialGroupDMChannel.js @@ -68,6 +68,7 @@ class PartialGroupDMChannel extends Channel { /** * Invites fetch + * @type {Collection} */ this.invites = new Collection(); diff --git a/src/structures/User.js b/src/structures/User.js index 447150a..65d87f0 100644 --- a/src/structures/User.js +++ b/src/structures/User.js @@ -127,6 +127,7 @@ class User extends Base { /** * Check relationship status + * @type {Relationship} * @readonly */ get relationships() { @@ -136,6 +137,7 @@ class User extends Base { /** * Check note + * @type {?string} * @readonly */ get note() { diff --git a/src/util/Constants.js b/src/util/Constants.js index 1ee89f9..a14d332 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -195,7 +195,7 @@ exports.Opcodes = { INVALID_SESSION: 9, // # Receive used to notify client they have an invalid session id HELLO: 10, // # Receive sent immediately after connecting, contains heartbeat and server debug information HEARTBEAT_ACK: 11, // # Sent immediately following a client heartbeat that was received - // GUILD_SYNC: 12, // # Receive guild_sync but not used anymore + GUILD_SYNC: 12, // # Receive guild_sync but not used anymore /** Add some opcode from Discum /* @extends https://github.com/Merubokkusu/Discord-S.C.U.M/blob/master/discum/gateway/gateway.py#L56 */