From 2eb7d698fe91837f2c2fbf2f22d4b9cb70334c20 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 16 Jan 2024 19:17:45 +0000 Subject: [PATCH 01/17] Update dependency @types/node to v20.11.0 (#139) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | devDependencies | minor | [`20.10.7` -> `20.11.0`](https://renovatebot.com/diffs/npm/@types%2fnode/20.10.7/20.11.0) | --- ### Configuration ๐Ÿ“… **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). ๐Ÿšฆ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. โ™ป **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. ๐Ÿ”• **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/139 Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 39befbb..2a64cc5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1874,9 +1874,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.10.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.7.tgz", - "integrity": "sha512-fRbIKb8C/Y2lXxB5eVMj4IU7xpdox0Lh8bUPEdtLysaylsml1hOOx1+STloRs/B9nf7C6kPRmmg/V7aQW7usNg==", + "version": "20.11.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.0.tgz", + "integrity": "sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxAjqx41zp9qlIAVFi0IhCNsJcXolEqLWhbFbEeL0PvYm4pcQ==", "dependencies": { "undici-types": "~5.26.4" } From cfff3be143dbc923d93fcdc67c6ec791dbcde0bb Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 16 Jan 2024 19:18:42 +0000 Subject: [PATCH 02/17] Update dependency @typescript-eslint/eslint-plugin to v6.18.1 (#140) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | minor | [`6.16.0` -> `6.18.1`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/6.16.0/6.18.1) | --- ### Release Notes
typescript-eslint/typescript-eslint (@​typescript-eslint/eslint-plugin) ### [`v6.18.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6181-2024-01-08) [Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.18.0...v6.18.1) ##### ๐Ÿฉน Fixes - **eslint-plugin:** \[no-non-null-assertion] provide valid fix when member access is on next line - **eslint-plugin:** \[no-unnecessary-condition] improve checking optional callee - **eslint-plugin:** \[prefer-readonly] support modifiers of unions and intersections - **eslint-plugin:** \[switch-exhaustiveness-check] fix new allowDefaultCaseForExhaustiveSwitch option ##### โค๏ธ Thank You - auvred - James - Josh Goldberg โœจ - YeonJuan You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. ### [`v6.18.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6180-2024-01-06) [Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.17.0...v6.18.0) ##### ๐Ÿš€ Features - **typescript-estree:** throw on invalid update expressions - **eslint-plugin:** \[no-var-requires, no-require-imports] allow option ##### โค๏ธ Thank You - auvred - Joshua Chen You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. ### [`v6.17.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6170-2024-01-01) [Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0) ##### Bug Fixes - **eslint-plugin:** \[no-restricted-imports] prevent crash when `patterns` or `paths` in options are empty ([#​8108](https://github.com/typescript-eslint/typescript-eslint/issues/8108)) ([675e987](https://github.com/typescript-eslint/typescript-eslint/commit/675e987ca1d13244c03d7e09d4e42c6539689d9a)) ##### Features - **eslint-plugin:** \[no-floating-promises] flag result of .map(async) ([#​7897](https://github.com/typescript-eslint/typescript-eslint/issues/7897)) ([5857356](https://github.com/typescript-eslint/typescript-eslint/commit/5857356962060b19aa792bee778f9167ee54154b)) - **eslint-plugin:** \[switch-exhaustiveness-check] add an option to warn against a `default` case on an already exhaustive `switch` ([#​7539](https://github.com/typescript-eslint/typescript-eslint/issues/7539)) ([6a219bd](https://github.com/typescript-eslint/typescript-eslint/commit/6a219bdfe6fcf86aae28158e0d855f87a8bac719)) You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.
--- ### Configuration ๐Ÿ“… **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). ๐Ÿšฆ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. โ™ป **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. ๐Ÿ”• **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/140 Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 279 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 261 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2a64cc5..f5a7b9b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1956,16 +1956,16 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.16.0.tgz", - "integrity": "sha512-O5f7Kv5o4dLWQtPX4ywPPa+v9G+1q1x8mz0Kr0pXUtKsevo+gIJHLkGc8RxaZWtP8RrhwhSNIWThnW42K9/0rQ==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.18.1.tgz", + "integrity": "sha512-nISDRYnnIpk7VCFrGcu1rnZfM1Dh9LRHnfgdkjcbi/l7g16VYRri3TjXi9Ir4lOZSw5N/gnV/3H7jIPQ8Q4daA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.16.0", - "@typescript-eslint/type-utils": "6.16.0", - "@typescript-eslint/utils": "6.16.0", - "@typescript-eslint/visitor-keys": "6.16.0", + "@typescript-eslint/scope-manager": "6.18.1", + "@typescript-eslint/type-utils": "6.18.1", + "@typescript-eslint/utils": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -1990,6 +1990,53 @@ } } }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.18.1.tgz", + "integrity": "sha512-BgdBwXPFmZzaZUuw6wKiHKIovms97a7eTImjkXCZE04TGHysG+0hDQPmygyvgtkoB/aOQwSM/nWv3LzrOIQOBw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.1.tgz", + "integrity": "sha512-4TuMAe+tc5oA7wwfqMtB0Y5OrREPF1GeJBAjqwgZh1lEMH5PJQgWgHGfYufVB51LtjD+peZylmeyxUXPfENLCw==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.1.tgz", + "integrity": "sha512-/kvt0C5lRqGoCfsbmm7/CwMqoSkY3zzHLIjdhHZQW3VFrnz7ATecOHR7nb7V+xn4286MBxfnQfQhAmCI0u+bJA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.18.1", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -2082,13 +2129,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.16.0.tgz", - "integrity": "sha512-ThmrEOcARmOnoyQfYkHw/DX2SEYBalVECmoldVuH6qagKROp/jMnfXpAU/pAIWub9c4YTxga+XwgAkoA0pxfmg==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.18.1.tgz", + "integrity": "sha512-wyOSKhuzHeU/5pcRDP2G2Ndci+4g653V43gXTpt4nbyoIOAASkGDA9JIAgbQCdCkcr1MvpSYWzxTz0olCn8+/Q==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.16.0", - "@typescript-eslint/utils": "6.16.0", + "@typescript-eslint/typescript-estree": "6.18.1", + "@typescript-eslint/utils": "6.18.1", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -2108,6 +2155,64 @@ } } }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.1.tgz", + "integrity": "sha512-4TuMAe+tc5oA7wwfqMtB0Y5OrREPF1GeJBAjqwgZh1lEMH5PJQgWgHGfYufVB51LtjD+peZylmeyxUXPfENLCw==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.18.1.tgz", + "integrity": "sha512-fv9B94UAhywPRhUeeV/v+3SBDvcPiLxRZJw/xZeeGgRLQZ6rLMG+8krrJUyIf6s1ecWTzlsbp0rlw7n9sjufHA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.1.tgz", + "integrity": "sha512-/kvt0C5lRqGoCfsbmm7/CwMqoSkY3zzHLIjdhHZQW3VFrnz7ATecOHR7nb7V+xn4286MBxfnQfQhAmCI0u+bJA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.18.1", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@typescript-eslint/type-utils/node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -2125,6 +2230,26 @@ } } }, + "node_modules/@typescript-eslint/type-utils/node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@typescript-eslint/type-utils/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -2216,17 +2341,17 @@ "dev": true }, "node_modules/@typescript-eslint/utils": { - "version": "6.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.16.0.tgz", - "integrity": "sha512-T83QPKrBm6n//q9mv7oiSvy/Xq/7Hyw9SzSEhMHJwznEmQayfBM87+oAlkNAMEO7/MjIwKyOHgBJbxB0s7gx2A==", + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.18.1.tgz", + "integrity": "sha512-zZmTuVZvD1wpoceHvoQpOiewmWu3uP9FuTWo8vqpy2ffsmfCE8mklRPi+vmnIYAIk9t/4kOThri2QCDgor+OpQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.16.0", - "@typescript-eslint/types": "6.16.0", - "@typescript-eslint/typescript-estree": "6.16.0", + "@typescript-eslint/scope-manager": "6.18.1", + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/typescript-estree": "6.18.1", "semver": "^7.5.4" }, "engines": { @@ -2240,6 +2365,124 @@ "eslint": "^7.0.0 || ^8.0.0" } }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.18.1.tgz", + "integrity": "sha512-BgdBwXPFmZzaZUuw6wKiHKIovms97a7eTImjkXCZE04TGHysG+0hDQPmygyvgtkoB/aOQwSM/nWv3LzrOIQOBw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.1.tgz", + "integrity": "sha512-4TuMAe+tc5oA7wwfqMtB0Y5OrREPF1GeJBAjqwgZh1lEMH5PJQgWgHGfYufVB51LtjD+peZylmeyxUXPfENLCw==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.18.1.tgz", + "integrity": "sha512-fv9B94UAhywPRhUeeV/v+3SBDvcPiLxRZJw/xZeeGgRLQZ6rLMG+8krrJUyIf6s1ecWTzlsbp0rlw7n9sjufHA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.1.tgz", + "integrity": "sha512-/kvt0C5lRqGoCfsbmm7/CwMqoSkY3zzHLIjdhHZQW3VFrnz7ATecOHR7nb7V+xn4286MBxfnQfQhAmCI0u+bJA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.18.1", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils/node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "node_modules/@typescript-eslint/visitor-keys": { "version": "6.16.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.16.0.tgz", From 275a804e28c4ab04db33fa6c00ca352f3aa34154 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Fri, 19 Jan 2024 18:05:46 +0000 Subject: [PATCH 03/17] Update gdrivesync command to error if JSON parsing fails (#143) # Description Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. - Update the gdrivesync command so if the JSON parse function fails, it returns an error message #134 ## Type of change Please delete options that are not relevant. - [x] New feature (non-breaking change which adds functionality) # How Has This Been Tested? Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration. # Checklist - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that provde my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/143 Reviewed-by: VylpesTester Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- .dev.env | 2 +- .prod.env | 2 +- .stage.env | 2 +- src/commands/gdrivesync.ts | 14 ++++++++++---- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.dev.env b/.dev.env index 28da9df..b61d698 100644 --- a/.dev.env +++ b/.dev.env @@ -7,7 +7,7 @@ # any secret values. BOT_TOKEN= -BOT_VER=0.4.0 +BOT_VER=0.5.0 BOT_AUTHOR=Vylpes BOT_OWNERID=147392775707426816 BOT_CLIENTID=682942374040961060 diff --git a/.prod.env b/.prod.env index 79e98fb..a3d5a1e 100644 --- a/.prod.env +++ b/.prod.env @@ -7,7 +7,7 @@ # any secret values. BOT_TOKEN= -BOT_VER=0.4.0 +BOT_VER=0.5.0 BOT_AUTHOR=Vylpes BOT_OWNERID=147392775707426816 BOT_CLIENTID=1093810443589529631 diff --git a/.stage.env b/.stage.env index 8db9eb5..c2f65e6 100644 --- a/.stage.env +++ b/.stage.env @@ -7,7 +7,7 @@ # any secret values. BOT_TOKEN= -BOT_VER=0.4.0 +BOT_VER=0.5.0 BOT_AUTHOR=Vylpes BOT_OWNERID=147392775707426816 BOT_CLIENTID=1147976642942214235 diff --git a/src/commands/gdrivesync.ts b/src/commands/gdrivesync.ts index be36fc1..35cf9cd 100644 --- a/src/commands/gdrivesync.ts +++ b/src/commands/gdrivesync.ts @@ -34,12 +34,18 @@ export default class Gdrivesync extends Command { await interaction.editReply(`Error while running sync command. Safe Mode has been activated. Code: ${error.code}`); await Config.SetValue("safemode", "true"); } else { - await CardMetadataFunction.Execute(); + const result = await CardMetadataFunction.Execute(); - await interaction.editReply("Synced successfully."); + if (result) { + await interaction.editReply("Synced successfully."); - CoreClient.AllowDrops = true; - await Config.SetValue("safemode", "false"); + CoreClient.AllowDrops = true; + await Config.SetValue("safemode", "false"); + } else { + const safemode = await Config.GetValue("safemode"); + + await interaction.editReply(`Sync failed. ${safemode == "true" ? "(Safe Mode is on)": "(Safe Mode is off)"}`); + } } }); } From de08fa26d77de28d4eb797acafaee4719daed6c7 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sat, 20 Jan 2024 14:31:07 +0000 Subject: [PATCH 04/17] Update gdrivesync to show an error message of what failed (#144) # Description Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. Fixes # (issue) ## Type of change Please delete options that are not relevant. - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update # How Has This Been Tested? Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration. # Checklist - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that provde my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/144 Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- src/Functions/CardMetadataFunction.ts | 67 +++++++++++++++++++++------ src/commands/gdrivesync.ts | 13 +++--- src/constants/EmbedColours.ts | 1 + 3 files changed, 60 insertions(+), 21 deletions(-) diff --git a/src/Functions/CardMetadataFunction.ts b/src/Functions/CardMetadataFunction.ts index 99a162e..3a8b97a 100644 --- a/src/Functions/CardMetadataFunction.ts +++ b/src/Functions/CardMetadataFunction.ts @@ -5,37 +5,74 @@ import { glob } from "glob"; import { SeriesMetadata } from "../contracts/SeriesMetadata"; import { CoreClient } from "../client/client"; +export interface CardMetadataResult { + IsSuccess: boolean; + ErrorMessage?: string; +} + +export interface FindMetadataResult { + IsSuccess: boolean; + Result?: SeriesMetadata[]; + Error?: { + File: string; + Message: string; + }; +} + export default class CardMetadataFunction { - public static async Execute(overrideSafeMode: boolean = false): Promise { - if (!overrideSafeMode && await Config.GetValue("safemode") == "true") return false; + public static async Execute(overrideSafeMode: boolean = false): Promise { + if (!overrideSafeMode && await Config.GetValue("safemode") == "true") return { + IsSuccess: false, + ErrorMessage: "Safe mode is on and not overridden", + }; - try { - CoreClient.Cards = await this.FindMetadataJSONs(); + const cardResult = await this.FindMetadataJSONs(); + if (cardResult.IsSuccess) { + CoreClient.Cards = cardResult.Result!; console.log(`Loaded ${CoreClient.Cards.flatMap(x => x.cards).length} cards to database`); - } catch (e) { - console.error(e); - await Config.SetValue("safemode", "true"); - return false; + return { + IsSuccess: true, + }; } - return true; + await Config.SetValue("safemode", "true"); + + return { + IsSuccess: false, + ErrorMessage: `${cardResult.Error!.File}: ${cardResult.Error!.Message}`, + }; } - private static async FindMetadataJSONs(): Promise { + private static async FindMetadataJSONs(): Promise { const res: SeriesMetadata[] = []; const seriesJSONs = await glob(path.join(process.env.DATA_DIR!, "cards", "/**/*.json")); for (const jsonPath of seriesJSONs) { - console.log(`Reading file ${jsonPath}`); - const jsonFile = readFileSync(jsonPath); - const parsedJson: SeriesMetadata[] = JSON.parse(jsonFile.toString()); + try { + console.log(`Reading file ${jsonPath}`); + const jsonFile = readFileSync(jsonPath); + const parsedJson: SeriesMetadata[] = JSON.parse(jsonFile.toString()); - res.push(...parsedJson); + res.push(...parsedJson); + } catch (e) { + console.error(e); + + return { + IsSuccess: false, + Error: { + File: jsonPath, + Message: `${e}`, + } + }; + } } - return res; + return { + IsSuccess: true, + Result: res, + }; } } \ No newline at end of file diff --git a/src/commands/gdrivesync.ts b/src/commands/gdrivesync.ts index 35cf9cd..c8a393c 100644 --- a/src/commands/gdrivesync.ts +++ b/src/commands/gdrivesync.ts @@ -25,7 +25,10 @@ export default class Gdrivesync extends Command { return; } - await interaction.reply("Syncing, this might take a while..."); + await interaction.reply({ + content: "Syncing, this might take a while...", + ephemeral: true, + }); CoreClient.AllowDrops = false; @@ -34,17 +37,15 @@ export default class Gdrivesync extends Command { await interaction.editReply(`Error while running sync command. Safe Mode has been activated. Code: ${error.code}`); await Config.SetValue("safemode", "true"); } else { - const result = await CardMetadataFunction.Execute(); + const result = await CardMetadataFunction.Execute(true); - if (result) { + if (result.IsSuccess) { await interaction.editReply("Synced successfully."); CoreClient.AllowDrops = true; await Config.SetValue("safemode", "false"); } else { - const safemode = await Config.GetValue("safemode"); - - await interaction.editReply(`Sync failed. ${safemode == "true" ? "(Safe Mode is on)": "(Safe Mode is off)"}`); + await interaction.editReply(`Sync failed \`\`\`${result.ErrorMessage}\`\`\``); } } }); diff --git a/src/constants/EmbedColours.ts b/src/constants/EmbedColours.ts index 6094dbf..a54d56f 100644 --- a/src/constants/EmbedColours.ts +++ b/src/constants/EmbedColours.ts @@ -1,5 +1,6 @@ export default class EmbedColours { public static readonly Ok = 0x3050ba; + public static readonly Error = 0xff0000; public static readonly Grey = 0xd3d3d3; public static readonly BronzeCard = 0xcd7f32; public static readonly SilverCard = 0xc0c0c0; From d6b56664ad2b9fda45cc825d14365945eeb05acb Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 22 Jan 2024 17:27:17 +0000 Subject: [PATCH 05/17] Update dependency @types/node to v20.11.5 (#148) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | devDependencies | patch | [`20.11.0` -> `20.11.5`](https://renovatebot.com/diffs/npm/@types%2fnode/20.11.0/20.11.5) | --- ### Configuration ๐Ÿ“… **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). ๐Ÿšฆ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. โ™ป **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. ๐Ÿ”• **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/148 Reviewed-by: Vylpes Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8e3a185..9ee6617 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1874,9 +1874,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.11.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.0.tgz", - "integrity": "sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxAjqx41zp9qlIAVFi0IhCNsJcXolEqLWhbFbEeL0PvYm4pcQ==", + "version": "20.11.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.5.tgz", + "integrity": "sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==", "dependencies": { "undici-types": "~5.26.4" } From b21483c13ee3043f9716d6e3f557b8d04526281d Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 22 Jan 2024 17:28:32 +0000 Subject: [PATCH 06/17] Update dependency dotenv to v16.3.2 (#149) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [dotenv](https://github.com/motdotla/dotenv) | dependencies | patch | [`16.3.1` -> `16.3.2`](https://renovatebot.com/diffs/npm/dotenv/16.3.1/16.3.2) | --- ### Release Notes
motdotla/dotenv (dotenv) ### [`v16.3.2`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1632-2024-01-18) [Compare Source](https://github.com/motdotla/dotenv/compare/v16.3.1...v16.3.2) ##### Added - Add debug message when no encoding set [#​735](https://github.com/motdotla/dotenv/pull/735) ##### Changed - Fix output typing for `populate` [#​792](https://github.com/motdotla/dotenv/pull/792) - Use subarray instead of slice [#​793](https://github.com/motdotla/dotenv/pull/793)
--- ### Configuration ๐Ÿ“… **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). ๐Ÿšฆ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. โ™ป **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. ๐Ÿ”• **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/149 Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9ee6617..bd382b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4411,8 +4411,9 @@ } }, "node_modules/dotenv": { - "version": "16.3.1", - "license": "BSD-2-Clause", + "version": "16.3.2", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.2.tgz", + "integrity": "sha512-HTlk5nmhkm8F6JcdXvHIzaorzCoziNQT9mGxLPVXW8wJF1TiGSL60ZGB4gHWabHOaMmWmhvk2/lPHfnBiT78AQ==", "engines": { "node": ">=12" }, From 93d11c02a624c02d96bd64983fb5d4630a1e16b1 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Fri, 26 Jan 2024 21:02:17 +0000 Subject: [PATCH 07/17] Migrate to woodpecker (#150) # Description Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. - Migrate to Woodpecker CI > **NOTE:** This will require the Drone project to be disabled before merge! #122 ## Type of change Please delete options that are not relevant. - [x] New feature (non-breaking change which adds functionality) # How Has This Been Tested? Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration. # Checklist - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that provde my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/150 Reviewed-by: VylpesTester Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- .woodpecker.yml | 47 +++++++++++++++++++++++++++++++++++++++++ scripts/deploy_prod.sh | 23 +++++--------------- scripts/deploy_stage.sh | 23 +++++--------------- 3 files changed, 57 insertions(+), 36 deletions(-) create mode 100644 .woodpecker.yml diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..30ac056 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,47 @@ +steps: + build: + image: node + commands: + - npm ci + - npm run build + when: + event: push + branch: [ hotfix/*, feature/*, renovate/*, develop, main ] + lint: + image: node + commands: + - npm run lint + when: + event: push + branch: [ hotfix/*, feature/*, renovate/*, develop, main ] + test: + image: node + commands: + - npm test + when: + event: push + branch: [ hotfix/*, feature/*, renovate/*, develop, main ] + stage: + image: alpine + secrets: [ ssh_key, stage_bot_token ] + commands: + - apk add rsync openssh-client + - eval `ssh-agent -s` + - echo "$SSH_KEY" | tr -d '\r' | ssh-add - + - rsync -e "ssh -o StrictHostKeyChecking=no" -r ./* vylpes@192.168.68.120:/home/vylpes/apps/card-drop/card-drop_stage + - ssh vylpes@192.168.68.120 BOT_TOKEN='$${stage_bot_token}' 'bash -s' < ./scripts/deploy_stage.sh + when: + event: push + branch: [ develop ] + deploy: + image: alpine + secrets: [ ssh_key, prod_bot_token ] + commands: + - apk add rsync openssh-client + - eval `ssh-agent -s` + - echo "$SSH_KEY" | tr -d '\r' | ssh-add - + - rsync -e "ssh -o StrictHostKeyChecking=no" -r ./* vylpes@192.168.68.120:/home/vylpes/apps/card-drop/card-drop_prod + - ssh vylpes@192.168.68.120 BOT_TOKEN='$${prod_bot_token}' 'bash -s' < ./scripts/deploy_prod.sh + when: + event: push + branch: [ main ] \ No newline at end of file diff --git a/scripts/deploy_prod.sh b/scripts/deploy_prod.sh index 0c7f799..84f35c6 100644 --- a/scripts/deploy_prod.sh +++ b/scripts/deploy_prod.sh @@ -3,21 +3,8 @@ export PATH="$HOME/.yarn/bin:$PATH" export PATH="$HOME/.nodeuse/bin:$PATH" -export BOT_TOKEN=$(cat $HOME/scripts/card-drop/prod_key.txt) - -cd ~/apps/card-drop/card-drop_prod \ -&& git checkout main \ -&& git fetch \ -&& git pull \ -&& docker compose --file docker-compose.prod.yml down \ -&& (pm2 stop card-drop_prod || true) \ -&& (pm2 delete card-drop_prod || true) \ -&& cp .prod.env .env \ -&& npm run clean \ -&& npm ci \ -&& npm run build \ -&& docker compose --file docker-compose.prod.yml up -d \ -&& echo "Sleeping for 10 seconds to let database load..." \ -&& sleep 10 \ -&& npm run db:up \ -&& NODE_ENV=production pm2 start --name card-drop_prod dist/bot.js \ No newline at end of file +cd ~/apps/card-drop/card-drop_prod +docker compose --file docker-compose.prod.yml up -d +sleep 10 +cp .prod.env .env +pm2 restart card-drop_prod || pm2 start --name card-drop_prod dist/bot.js \ No newline at end of file diff --git a/scripts/deploy_stage.sh b/scripts/deploy_stage.sh index 96fbbe6..9287b53 100644 --- a/scripts/deploy_stage.sh +++ b/scripts/deploy_stage.sh @@ -3,21 +3,8 @@ export PATH="$HOME/.yarn/bin:$PATH" export PATH="$HOME/.nodeuse/bin:$PATH" -export BOT_TOKEN=$(cat $HOME/scripts/card-drop/stage_key.txt) - -cd ~/apps/card-drop/card-drop_stage \ -&& git checkout develop \ -&& git fetch \ -&& git pull \ -&& docker compose --file docker-compose.stage.yml down \ -&& (pm2 stop card-drop_stage || true) \ -&& (pm2 delete card-drop_stage || true) \ -&& cp .stage.env .env \ -&& npm run clean \ -&& npm ci \ -&& npm run build \ -&& docker compose --file docker-compose.stage.yml up -d \ -&& echo "Sleeping for 10 seconds to let database load..." \ -&& sleep 10 \ -&& npm run db:up \ -&& NODE_ENV=production pm2 start --name card-drop_stage dist/bot.js \ No newline at end of file +cd ~/apps/card-drop/card-drop_stage +docker compose --file docker-compose.stage.yml up -d +sleep 10 +cp .stage.env .env +pm2 restart card-drop_stage || pm2 start --name card-drop_stage dist/bot.js \ No newline at end of file From f47882c039c54864abf3838f79b10e3b4a31ceeb Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 29 Jan 2024 18:09:02 +0000 Subject: [PATCH 08/17] Update dependency @types/node to v20.11.10 (#151) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | devDependencies | patch | [`20.11.5` -> `20.11.10`](https://renovatebot.com/diffs/npm/@types%2fnode/20.11.5/20.11.10) | --- ### Configuration ๐Ÿ“… **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). ๐Ÿšฆ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. โ™ป **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. ๐Ÿ”• **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/151 Reviewed-by: Vylpes Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index bd382b7..3a9376d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1874,9 +1874,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.11.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.5.tgz", - "integrity": "sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==", + "version": "20.11.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.10.tgz", + "integrity": "sha512-rZEfe/hJSGYmdfX9tvcPMYeYPW2sNl50nsw4jZmRcaG0HIAb0WYEpsB05GOb53vjqpyE9GUhlDQ4jLSoB5q9kg==", "dependencies": { "undici-types": "~5.26.4" } From 36ec25113edd6da2775da573425e4de513b2af09 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 29 Jan 2024 18:10:25 +0000 Subject: [PATCH 09/17] Update dependency @types/uuid to v9.0.8 (#152) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@types/uuid](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/uuid) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | dependencies | patch | [`9.0.7` -> `9.0.8`](https://renovatebot.com/diffs/npm/@types%2fuuid/9.0.7/9.0.8) | --- ### Configuration ๐Ÿ“… **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). ๐Ÿšฆ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. โ™ป **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. ๐Ÿ”• **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/152 Reviewed-by: Vylpes Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3a9376d..7d0cd8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1934,8 +1934,9 @@ "license": "MIT" }, "node_modules/@types/uuid": { - "version": "9.0.7", - "license": "MIT" + "version": "9.0.8", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz", + "integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==" }, "node_modules/@types/ws": { "version": "8.5.9", From f181c5dbfe869b747e869db496c735a73587eb65 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Fri, 2 Feb 2024 21:53:42 +0000 Subject: [PATCH 10/17] Add view command (#153) # Description Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. - Add view command to let users see specific cards but not claim them #80 ## Type of change Please delete options that are not relevant. - [x] New feature (non-breaking change which adds functionality) # How Has This Been Tested? Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration. # Checklist - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that provde my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/153 Reviewed-by: VylpesTester Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- src/commands/view.ts | 77 ++++++++++++++++++++++++++++++++++++++++++++ src/registry.ts | 2 ++ 2 files changed, 79 insertions(+) create mode 100644 src/commands/view.ts diff --git a/src/commands/view.ts b/src/commands/view.ts new file mode 100644 index 0000000..8f89eb4 --- /dev/null +++ b/src/commands/view.ts @@ -0,0 +1,77 @@ +import { AttachmentBuilder, CommandInteraction, DiscordAPIError, SlashCommandBuilder } from "discord.js"; +import { Command } from "../type/command"; +import { CoreClient } from "../client/client"; +import { readFileSync } from "fs"; +import path from "path"; +import Inventory from "../database/entities/app/Inventory"; +import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata"; + +export default class View extends Command { + constructor() { + super(); + + this.CommandBuilder = new SlashCommandBuilder() + .setName("view") + .setDescription("View a specific command") + .addStringOption(x => + x + .setName("cardnumber") + .setDescription("The card number to view") + .setRequired(true)); + } + + public override async execute(interaction: CommandInteraction) { + const cardNumber = interaction.options.get("cardnumber"); + + if (!cardNumber || !cardNumber.value) { + await interaction.reply("Card number is required."); + return; + } + + const card = CoreClient.Cards + .flatMap(x => x.cards) + .find(x => x.id == cardNumber.value); + + if (!card) { + await interaction.reply("Card not found."); + return; + } + + const series = CoreClient.Cards + .find(x => x.cards.includes(card))!; + + let image: Buffer; + const imageFileName = card.path.split("/").pop()!; + + try { + image = readFileSync(path.join(process.env.DATA_DIR!, "cards", card.path)); + } catch { + await interaction.reply(`Unable to fetch image for card ${card.id}.`); + return; + } + + await interaction.deferReply(); + + const attachment = new AttachmentBuilder(image, { name: imageFileName }); + + const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, card.id); + const quantityClaimed = inventory ? inventory.Quantity : 0; + + const embed = CardDropHelperMetadata.GenerateDropEmbed({ card, series }, quantityClaimed, imageFileName); + + try { + await interaction.editReply({ + embeds: [ embed ], + files: [ attachment ], + }); + } catch (e) { + console.error(e); + + if (e instanceof DiscordAPIError) { + await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. Code: ${e.code}.`); + } else { + await interaction.editReply("Unable to send next drop. Please try again, and report this if it keeps happening. Code: UNKNOWN."); + } + } + } +} \ No newline at end of file diff --git a/src/registry.ts b/src/registry.ts index a7cf494..2fc657d 100644 --- a/src/registry.ts +++ b/src/registry.ts @@ -8,6 +8,7 @@ import Gdrivesync from "./commands/gdrivesync"; import Give from "./commands/give"; import Inventory from "./commands/inventory"; import Resync from "./commands/resync"; +import View from "./commands/view"; // Test Command Imports import Dropnumber from "./commands/stage/dropnumber"; @@ -27,6 +28,7 @@ export default class Registry { CoreClient.RegisterCommand("give", new Give()); CoreClient.RegisterCommand("inventory", new Inventory()); CoreClient.RegisterCommand("resync", new Resync()); + CoreClient.RegisterCommand("view", new View()); // Test Commands CoreClient.RegisterCommand("dropnumber", new Dropnumber(), Environment.Test); From a0ba8d7994457f34706db8fe9bc5dec88fed1245 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Mon, 12 Feb 2024 17:49:51 +0000 Subject: [PATCH 11/17] Update footer text in CardDropHelperMetadata to include card number (#159) # Description Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. - Update the footer text in CardDropHelperMetadata to include card number #127 ## Type of change Please delete options that are not relevant. - [x] New feature (non-breaking change which adds functionality) # How Has This Been Tested? Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration. - This has been tested by running the `/drop`, `/dropnumber` commands, and `Reroll` button event. All display the card number on the footer now # Checklist - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that provde my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/159 Reviewed-by: VylpesTester Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- src/helpers/CardDropHelperMetadata.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/CardDropHelperMetadata.ts b/src/helpers/CardDropHelperMetadata.ts index 27eebb8..762648d 100644 --- a/src/helpers/CardDropHelperMetadata.ts +++ b/src/helpers/CardDropHelperMetadata.ts @@ -63,7 +63,7 @@ export default class CardDropHelperMetadata { return new EmbedBuilder() .setTitle(drop.card.name) .setDescription(description) - .setFooter({ text: CardRarityToString(drop.card.type) }) + .setFooter({ text: `${CardRarityToString(drop.card.type)} ยท ${drop.card.id}` }) .setColor(CardRarityToColour(drop.card.type)) .setImage(`attachment://${imageFileName}`); } From 935629d83176cf34d2425c52138960e8134b6d7a Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 12 Feb 2024 17:56:35 +0000 Subject: [PATCH 12/17] Update dependency @types/jest to v29.5.12 (#157) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | dependencies | patch | [`29.5.11` -> `29.5.12`](https://renovatebot.com/diffs/npm/@types%2fjest/29.5.11/29.5.12) | --- ### Configuration ๐Ÿ“… **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). ๐Ÿšฆ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. โ™ป **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. ๐Ÿ”• **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/157 Reviewed-by: Vylpes Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7d0cd8c..a515477 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1847,9 +1847,9 @@ } }, "node_modules/@types/jest": { - "version": "29.5.11", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.11.tgz", - "integrity": "sha512-S2mHmYIVe13vrm6q4kN6fLYYAka15ALQki/vgDC3mIukEOx8WJlv0kQPM+d4w8Gp6u0uSdKND04IlTXBv0rwnQ==", + "version": "29.5.12", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.12.tgz", + "integrity": "sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==", "dependencies": { "expect": "^29.0.0", "pretty-format": "^29.0.0" From bc4a870305d11884c16e08137aa919780c530daa Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 12 Feb 2024 17:58:11 +0000 Subject: [PATCH 13/17] Update dependency @types/node to v20.11.17 (#158) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | devDependencies | patch | [`20.11.10` -> `20.11.17`](https://renovatebot.com/diffs/npm/@types%2fnode/20.11.10/20.11.17) | --- ### Configuration ๐Ÿ“… **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). ๐Ÿšฆ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. โ™ป **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. ๐Ÿ”• **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/158 Reviewed-by: Vylpes Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index a515477..666ad41 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1874,9 +1874,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.11.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.10.tgz", - "integrity": "sha512-rZEfe/hJSGYmdfX9tvcPMYeYPW2sNl50nsw4jZmRcaG0HIAb0WYEpsB05GOb53vjqpyE9GUhlDQ4jLSoB5q9kg==", + "version": "20.11.17", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.17.tgz", + "integrity": "sha512-QmgQZGWu1Yw9TDyAP9ZzpFJKynYNeOvwMJmaxABfieQoVoiVOS6MN1WSpqpRcbeA5+RW82kraAVxCCJg+780Qw==", "dependencies": { "undici-types": "~5.26.4" } From 96b97b30e6ba9fa909d64d4641509fd827e97e19 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 12 Feb 2024 17:59:01 +0000 Subject: [PATCH 14/17] Update dependency ts-jest to v29.1.2 (#161) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [ts-jest](https://kulshekhar.github.io/ts-jest) ([source](https://github.com/kulshekhar/ts-jest)) | dependencies | patch | [`29.1.1` -> `29.1.2`](https://renovatebot.com/diffs/npm/ts-jest/29.1.1/29.1.2) | --- ### Release Notes
kulshekhar/ts-jest (ts-jest) ### [`v29.1.2`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2912-2024-01-22) [Compare Source](https://github.com/kulshekhar/ts-jest/compare/v29.1.1...v29.1.2) ##### Bug Fixes - calculated cache key based on `supportsStaticESM` ([a5d6f2d](https://github.com/kulshekhar/ts-jest/commit/a5d6f2d4f4bfa1c7c217f6faf9310958797b436f)) - correct error handling in `processAsync` ([e7be4bf](https://github.com/kulshekhar/ts-jest/commit/e7be4bf6a863cd76efec28f40fdd5193b2f50bad)), closes [#​4207](https://github.com/kulshekhar/ts-jest/issues/4207) - use `Config.ProjectConfig` ([918312b](https://github.com/kulshekhar/ts-jest/commit/918312bee22a795ec6bb347f95df4c1ff0a054de)), closes [#​4028](https://github.com/kulshekhar/ts-jest/issues/4028)
--- ### Configuration ๐Ÿ“… **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). ๐Ÿšฆ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. โ™ป **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. ๐Ÿ”• **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/161 Reviewed-by: Vylpes Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index 666ad41..5f1e30c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10916,8 +10916,9 @@ } }, "node_modules/ts-jest": { - "version": "29.1.1", - "license": "MIT", + "version": "29.1.2", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", + "integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==", "dependencies": { "bs-logger": "0.x", "fast-json-stable-stringify": "2.x", @@ -10932,7 +10933,7 @@ "ts-jest": "cli.js" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.0.0 || >=20.0.0" }, "peerDependencies": { "@babel/core": ">=7.0.0-beta.0 <8", @@ -10956,21 +10957,6 @@ } } }, - "node_modules/ts-jest/node_modules/jest-util": { - "version": "29.6.2", - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.1", - "@types/node": "*", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", - "picomatch": "^2.2.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, "node_modules/ts-mixer": { "version": "6.0.3", "license": "MIT" From 4c97d41495eecac1877d6ea2b9403cfd2726befe Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 12 Feb 2024 18:00:03 +0000 Subject: [PATCH 15/17] Update dependency typeorm to v0.3.20 (#162) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [typeorm](https://typeorm.io) ([source](https://github.com/typeorm/typeorm)) | dependencies | patch | [`0.3.19` -> `0.3.20`](https://renovatebot.com/diffs/npm/typeorm/0.3.19/0.3.20) | --- ### Release Notes
typeorm/typeorm (typeorm) ### [`v0.3.20`](https://github.com/typeorm/typeorm/blob/HEAD/CHANGELOG.md#0320-2024-01-26) [Compare Source](https://github.com/typeorm/typeorm/compare/0.3.19...0.3.20) ##### Bug Fixes - added missing parentheses in where conditions ([#​10650](https://github.com/typeorm/typeorm/issues/10650)) ([4624930](https://github.com/typeorm/typeorm/commit/46249303be03adea74266837b8e6eb49227f476e)), closes [#​10534](https://github.com/typeorm/typeorm/issues/10534) - don't escape indexPredicate ([#​10618](https://github.com/typeorm/typeorm/issues/10618)) ([dd49a25](https://github.com/typeorm/typeorm/commit/dd49a254dc475eedfe72378be2670cc6a61aacf1)) - fallback runMigrations transaction to DataSourceOptions ([#​10601](https://github.com/typeorm/typeorm/issues/10601)) ([0cab0dd](https://github.com/typeorm/typeorm/commit/0cab0dd7308d2cb8ba5600ce46899bd14a062565)) - hangup when load relations with relationLoadStrategy: query ([#​10630](https://github.com/typeorm/typeorm/issues/10630)) ([54d8d9e](https://github.com/typeorm/typeorm/commit/54d8d9efe9bb41671f44f41ea6372b7b5d2ad0f1)), closes [#​10481](https://github.com/typeorm/typeorm/issues/10481) - include asExpression columns in returning clause ([#​10632](https://github.com/typeorm/typeorm/issues/10632)) ([f232ba7](https://github.com/typeorm/typeorm/commit/f232ba780872660fbfd2467b52ef5b97cb6f2935)), closes [#​8450](https://github.com/typeorm/typeorm/issues/8450) [#​8450](https://github.com/typeorm/typeorm/issues/8450) - multiple insert in SAP Hana ([#​10597](https://github.com/typeorm/typeorm/issues/10597)) ([1b34c9a](https://github.com/typeorm/typeorm/commit/1b34c9a49e99fa937dd9894ddb7e6bba85c08a42)) - resolve issue CREATE/DROP Index concurrently ([#​10634](https://github.com/typeorm/typeorm/issues/10634)) ([8aa8690](https://github.com/typeorm/typeorm/commit/8aa8690f94c12c9740bf746b2ec55def13941d35)), closes [#​10626](https://github.com/typeorm/typeorm/issues/10626) - type inferencing of EntityManager#create ([#​10569](https://github.com/typeorm/typeorm/issues/10569)) ([99d8249](https://github.com/typeorm/typeorm/commit/99d8249e450f7e649685105b372e265f41a0ee47)) ##### Features - add json type support for Oracle ([#​10611](https://github.com/typeorm/typeorm/issues/10611)) ([7e85460](https://github.com/typeorm/typeorm/commit/7e85460f10b0c6f57dda9d532fe925ebf0711fe9)) - add postgres multirange column types ([#​10627](https://github.com/typeorm/typeorm/issues/10627)) ([d0b7670](https://github.com/typeorm/typeorm/commit/d0b76703cc1c7919f5c6a974ad0889c331d78672)), closes [#​10556](https://github.com/typeorm/typeorm/issues/10556) - add table comment for postgres ([#​10613](https://github.com/typeorm/typeorm/issues/10613)) ([4493db4](https://github.com/typeorm/typeorm/commit/4493db4d1b02eaa2c3f997ff256057d01cc48323)) ##### Reverts - Revert "fix: prevent using absolute table path in migrations unless required ([#​10123](https://github.com/typeorm/typeorm/issues/10123))" ([#​10624](https://github.com/typeorm/typeorm/issues/10624)) ([8f371f2](https://github.com/typeorm/typeorm/commit/8f371f23978600c36a2edf8222fec1024ae09c2e)), closes [#​10123](https://github.com/typeorm/typeorm/issues/10123) [#​10624](https://github.com/typeorm/typeorm/issues/10624) - revert "feat: nullable embedded entities ([#​10289](https://github.com/typeorm/typeorm/issues/10289))" ([#​10614](https://github.com/typeorm/typeorm/issues/10614)) ([15de46f](https://github.com/typeorm/typeorm/commit/15de46fd5d31cd742477821e7a32bc98c9616d30)), closes [#​10289](https://github.com/typeorm/typeorm/issues/10289) [#​10614](https://github.com/typeorm/typeorm/issues/10614)
--- ### Configuration ๐Ÿ“… **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). ๐Ÿšฆ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. โ™ป **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. ๐Ÿ”• **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/162 Reviewed-by: Vylpes Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 17 +++++++++-------- package.json | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5f1e30c..d934954 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "minimatch": "9.0.3", "mysql": "^2.18.1", "ts-jest": "^29.0.0", - "typeorm": "0.3.19" + "typeorm": "0.3.20" }, "devDependencies": { "@types/node": "^20.0.0", @@ -9867,8 +9867,9 @@ "license": "MIT" }, "node_modules/reflect-metadata": { - "version": "0.1.13", - "license": "Apache-2.0" + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.1.tgz", + "integrity": "sha512-i5lLI6iw9AU3Uu4szRNPPEkomnkjRTaVt9hy/bn5g/oSzekBSMeLZblcjP74AW0vBabqERLLIrz+gR8QYR54Tw==" }, "node_modules/registry-auth-token": { "version": "4.2.2", @@ -11015,9 +11016,9 @@ } }, "node_modules/typeorm": { - "version": "0.3.19", - "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.19.tgz", - "integrity": "sha512-OGelrY5qEoAU80mR1iyvmUHiKCPUydL6xp6bebXzS7jyv/X70Gp/jBWRAfF4qGOfy2A7orMiGRfwsBUNbEL65g==", + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.20.tgz", + "integrity": "sha512-sJ0T08dV5eoZroaq9uPKBoNcGslHBR4E4y+EBHs//SiGbblGe7IeduP/IH4ddCcj0qp3PHwDwGnuvqEAnKlq/Q==", "dependencies": { "@sqltools/formatter": "^1.2.5", "app-root-path": "^3.1.0", @@ -11029,7 +11030,7 @@ "dotenv": "^16.0.3", "glob": "^10.3.10", "mkdirp": "^2.1.3", - "reflect-metadata": "^0.1.13", + "reflect-metadata": "^0.2.1", "sha.js": "^2.4.11", "tslib": "^2.5.0", "uuid": "^9.0.0", @@ -11041,7 +11042,7 @@ "typeorm-ts-node-esm": "cli-ts-node-esm.js" }, "engines": { - "node": ">= 12.9.0" + "node": ">=16.13.0" }, "funding": { "url": "https://opencollective.com/typeorm" diff --git a/package.json b/package.json index f0194d2..de70d54 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "minimatch": "9.0.3", "mysql": "^2.18.1", "ts-jest": "^29.0.0", - "typeorm": "0.3.19" + "typeorm": "0.3.20" }, "resolutions": {}, "devDependencies": { From 6ee8db6232a1d3678cc0dab24dcb715825e20592 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Fri, 16 Feb 2024 17:21:50 +0000 Subject: [PATCH 16/17] Add ability to view another's inventory (#155) # Description Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. - Add ability to view another user's inventory - Fix bug where the inventory generation logic was overriding the main array #131, #138 ## Type of change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) # How Has This Been Tested? Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration. # Checklist - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that provde my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/155 Reviewed-by: VylpesTester Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- package-lock.json | 58 ++++++++++++++++++++++++++++++++++ package.json | 2 ++ src/buttonEvents/Inventory.ts | 14 ++++++-- src/commands/inventory.ts | 9 ++++-- src/helpers/InventoryHelper.ts | 5 ++- 5 files changed, 83 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index d934954..cbb4f38 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,10 +10,12 @@ "license": "MIT", "dependencies": { "@discordjs/rest": "^2.0.0", + "@types/clone-deep": "^4.0.4", "@types/express": "^4.17.20", "@types/jest": "^29.0.0", "@types/uuid": "^9.0.0", "body-parser": "^1.20.2", + "clone-deep": "^4.0.1", "discord.js": "^14.3.0", "dotenv": "^16.0.0", "express": "^4.18.2", @@ -1785,6 +1787,11 @@ "@types/responselike": "^1.0.0" } }, + "node_modules/@types/clone-deep": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/clone-deep/-/clone-deep-4.0.4.tgz", + "integrity": "sha512-vXh6JuuaAha6sqEbJueYdh5zNBPPgG1OYumuz2UvLvriN6ABHDSW8ludREGWJb1MLIzbwZn4q4zUbUCerJTJfA==" + }, "node_modules/@types/connect": { "version": "3.4.38", "license": "MIT", @@ -3788,6 +3795,19 @@ "node": ">=0.8" } }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/clone-response": { "version": "1.0.3", "dev": true, @@ -6425,6 +6445,17 @@ "node": ">=8" } }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-promise": { "version": "2.2.2", "dev": true, @@ -6500,6 +6531,14 @@ "version": "2.0.0", "license": "ISC" }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/issue-regex": { "version": "4.1.0", "dev": true, @@ -7300,6 +7339,14 @@ "json-buffer": "3.0.1" } }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/kleur": { "version": "3.0.3", "license": "MIT", @@ -10242,6 +10289,17 @@ "sha.js": "bin.js" } }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "license": "MIT", diff --git a/package.json b/package.json index de70d54..75d7880 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,12 @@ "funding": "https://ko-fi.com/vylpes", "dependencies": { "@discordjs/rest": "^2.0.0", + "@types/clone-deep": "^4.0.4", "@types/express": "^4.17.20", "@types/jest": "^29.0.0", "@types/uuid": "^9.0.0", "body-parser": "^1.20.2", + "clone-deep": "^4.0.1", "discord.js": "^14.3.0", "dotenv": "^16.0.0", "express": "^4.18.2", diff --git a/src/buttonEvents/Inventory.ts b/src/buttonEvents/Inventory.ts index 6a71029..4bfffc1 100644 --- a/src/buttonEvents/Inventory.ts +++ b/src/buttonEvents/Inventory.ts @@ -4,17 +4,27 @@ import InventoryHelper from "../helpers/InventoryHelper"; export default class Inventory extends ButtonEvent { public override async execute(interaction: ButtonInteraction) { + if (!interaction.guild) return; + const userid = interaction.customId.split(" ")[1]; const page = interaction.customId.split(" ")[2]; + const member = interaction.guild.members.cache.find(x => x.id == userid) || await interaction.guild.members.fetch(userid); + + if (!member) { + await interaction.reply("Unable to find user."); + return; + } + try { - const embed = await InventoryHelper.GenerateInventoryPage(interaction.user.username, userid, Number(page)); + const embed = await InventoryHelper.GenerateInventoryPage(member.user.username, member.user.id, Number(page)); await interaction.update({ embeds: [ embed.embed ], components: [ embed.row ], }); - } catch { + } catch (e) { + console.error(e); await interaction.reply("No page for user found."); } } diff --git a/src/commands/inventory.ts b/src/commands/inventory.ts index 7ab951f..868b14d 100644 --- a/src/commands/inventory.ts +++ b/src/commands/inventory.ts @@ -12,11 +12,16 @@ export default class Inventory extends Command { .addNumberOption(x => x .setName("page") - .setDescription("The page to start with")); + .setDescription("The page to start with")) + .addUserOption(x => + x + .setName("user") + .setDescription("The user to view (Defaults to yourself)")); } public override async execute(interaction: CommandInteraction) { const page = interaction.options.get("page"); + const user = interaction.options.getUser("user") || interaction.user; try { let pageNumber = 0; @@ -25,7 +30,7 @@ export default class Inventory extends Command { pageNumber = Number(page.value) - 1; } - const embed = await InventoryHelper.GenerateInventoryPage(interaction.user.username, interaction.user.id, pageNumber); + const embed = await InventoryHelper.GenerateInventoryPage(user.username, user.id, pageNumber); await interaction.reply({ embeds: [ embed.embed ], diff --git a/src/helpers/InventoryHelper.ts b/src/helpers/InventoryHelper.ts index 3f4e4e9..1103694 100644 --- a/src/helpers/InventoryHelper.ts +++ b/src/helpers/InventoryHelper.ts @@ -3,6 +3,7 @@ import Inventory from "../database/entities/app/Inventory"; import { CoreClient } from "../client/client"; import EmbedColours from "../constants/EmbedColours"; import { CardRarity, CardRarityToString } from "../constants/CardRarity"; +import cloneDeep from "clone-deep"; interface InventoryPage { id: number, @@ -24,7 +25,9 @@ export default class InventoryHelper { const inventory = await Inventory.FetchAllByUserId(userid); - const allSeriesClaimed = CoreClient.Cards + const clientCards = cloneDeep(CoreClient.Cards); + + const allSeriesClaimed = clientCards .sort((a, b) => a.id - b.id) .filter(x => { x.cards = x.cards From 70d1589584657350ba2778b809bfdd4ce7d7cf8a Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sat, 17 Feb 2024 17:52:34 +0000 Subject: [PATCH 17/17] 0.5.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index cbb4f38..d6339c8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "card-drop", - "version": "0.4.2", + "version": "0.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "card-drop", - "version": "0.4.2", + "version": "0.5.0", "license": "MIT", "dependencies": { "@discordjs/rest": "^2.0.0", diff --git a/package.json b/package.json index 75d7880..732ab99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "card-drop", - "version": "0.4.2", + "version": "0.5.0", "main": "./dist/bot.js", "typings": "./dist", "scripts": {