From 756f536370d9c9bd988a653664e04e7619bc2dab Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 19 Feb 2024 15:10:19 +0000 Subject: [PATCH 01/32] Update dependency @types/node to v20.11.19 (#167) 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.17` -> `20.11.19`](https://renovatebot.com/diffs/npm/@types%2fnode/20.11.17/20.11.19) | --- ### 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/167 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 d6339c8..5c76b98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1881,9 +1881,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.11.17", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.17.tgz", - "integrity": "sha512-QmgQZGWu1Yw9TDyAP9ZzpFJKynYNeOvwMJmaxABfieQoVoiVOS6MN1WSpqpRcbeA5+RW82kraAVxCCJg+780Qw==", + "version": "20.11.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", + "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", "dependencies": { "undici-types": "~5.26.4" } From 9a278b3dc16bceed81bf50cdaf2dc96894b0de2c Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 19 Feb 2024 15:11:33 +0000 Subject: [PATCH 02/32] Update dependency @typescript-eslint/eslint-plugin to v6.21.0 (#168) 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.18.1` -> `6.21.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/6.18.1/6.21.0) | --- ### Release Notes
typescript-eslint/typescript-eslint (@​typescript-eslint/eslint-plugin) ### [`v6.21.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6210-2024-02-05) [Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.20.0...v6.21.0) ##### 🚀 Features - export plugin metadata - allow `parserOptions.project: false` - **eslint-plugin:** add rule prefer-find ##### 🩹 Fixes - **eslint-plugin:** \[no-unused-vars] don't report on types referenced in export assignment expression - **eslint-plugin:** \[switch-exhaustiveness-check] better support for intersections, infinite types, non-union values - **eslint-plugin:** \[consistent-type-imports] dont report on types used in export assignment expressions - **eslint-plugin:** \[no-unnecessary-condition] handle left-hand optional with exactOptionalPropertyTypes option - **eslint-plugin:** \[class-literal-property-style] allow getter when same key setter exists - **eslint-plugin:** \[no-unnecessary-type-assertion] provide valid fixes for assertions with extra tokens before `as` keyword ##### ❤️ Thank You - auvred - Brad Zacher - Kirk Waiblinger - Pete Gonzalez - 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.20.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6200-2024-01-29) [Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.19.1...v6.20.0) ##### 🚀 Features - **eslint-plugin:** \[member-ordering] allow easy reuse of the default ordering ##### 🩹 Fixes - **eslint-plugin:** \[no-useless-template-literals] incorrect bigint autofix result - **eslint-plugin:** \[prefer-nullish-coalescing] treat any/unknown as non-nullable - **eslint-plugin:** \[no-useless-template-literals] report Infinity & NaN - **eslint-plugin:** \[prefer-readonly] disable checking accessors ##### ❤️ Thank You - Alex Parloti - auvred - James Browning - StyleShit - 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.19.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6191-2024-01-22) [Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.19.0...v6.19.1) ##### 🩹 Fixes - **type-utils:** preventing isUnsafeAssignment infinite recursive calls - **eslint-plugin:** \[no-unnecessary-condition] fix false positive for type variable ##### ❤️ Thank You - 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.19.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6190-2024-01-15) [Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.18.1...v6.19.0) ##### 🚀 Features - **eslint-plugin:** \[prefer-promise-reject-errors] add rule - **eslint-plugin:** \[no-array-delete] add new rule - **eslint-plugin:** \[no-useless-template-literals] add fix suggestions ##### 🩹 Fixes - **eslint-plugin:** \[no-unnecessary-type-assertion] detect unnecessary non-null-assertion on a call expression - **eslint-plugin:** \[no-unnecesary-type-assertion] treat unknown/any as nullable ##### ❤️ Thank You - auvred - Brad Zacher - Josh Goldberg ✨ - Joshua Chen - LJX - Steven - StyleShit 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/168 Reviewed-by: Vylpes Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 124 +++++++++++++++++++++++----------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5c76b98..e300fd2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1910,9 +1910,9 @@ } }, "node_modules/@types/semver": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", - "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.7.tgz", + "integrity": "sha512-/wdoPq1QqkSj9/QOeKkFquEuPzQbHTWAMPH/PaUMB+JuR31lXhlWXRZ52IpfDYVlDOUBvX09uBrPwxGT1hjNBg==", "dev": true }, "node_modules/@types/send": { @@ -1964,16 +1964,16 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "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==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", + "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@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", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/type-utils": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -1999,13 +1999,13 @@ } }, "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==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.18.1", - "@typescript-eslint/visitor-keys": "6.18.1" + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2016,9 +2016,9 @@ } }, "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==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2029,12 +2029,12 @@ } }, "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==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/types": "6.21.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -2137,13 +2137,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "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==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", + "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.18.1", - "@typescript-eslint/utils": "6.18.1", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/utils": "6.21.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -2164,9 +2164,9 @@ } }, "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==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2177,13 +2177,13 @@ } }, "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==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.18.1", - "@typescript-eslint/visitor-keys": "6.18.1", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -2205,12 +2205,12 @@ } }, "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==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/types": "6.21.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -2349,17 +2349,17 @@ "dev": true }, "node_modules/@typescript-eslint/utils": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.18.1.tgz", - "integrity": "sha512-zZmTuVZvD1wpoceHvoQpOiewmWu3uP9FuTWo8vqpy2ffsmfCE8mklRPi+vmnIYAIk9t/4kOThri2QCDgor+OpQ==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", + "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", "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.18.1", - "@typescript-eslint/types": "6.18.1", - "@typescript-eslint/typescript-estree": "6.18.1", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", "semver": "^7.5.4" }, "engines": { @@ -2374,13 +2374,13 @@ } }, "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==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.18.1", - "@typescript-eslint/visitor-keys": "6.18.1" + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2391,9 +2391,9 @@ } }, "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==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2404,13 +2404,13 @@ } }, "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==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.18.1", - "@typescript-eslint/visitor-keys": "6.18.1", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -2432,12 +2432,12 @@ } }, "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==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/types": "6.21.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { From 3e09cf7f43d36e145528e2179e02366ef23c9e42 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Fri, 23 Feb 2024 18:37:48 +0000 Subject: [PATCH 03/32] Add trade command (#172) # 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 trade command to the bot, as well as its corresponding button events - Only the target user can accept - Both the target user and initiating user can decline, no one else can - Auto expires after 15 minutes #165 ## 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/172 Reviewed-by: VylpesTester Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- src/buttonEvents/Trade.ts | 204 ++++++++++++++++++++++++++++++++++ src/commands/trade.ts | 143 ++++++++++++++++++++++++ src/constants/EmbedColours.ts | 1 + src/registry.ts | 6 +- 4 files changed, 353 insertions(+), 1 deletion(-) create mode 100644 src/buttonEvents/Trade.ts create mode 100644 src/commands/trade.ts diff --git a/src/buttonEvents/Trade.ts b/src/buttonEvents/Trade.ts new file mode 100644 index 0000000..28b08ee --- /dev/null +++ b/src/buttonEvents/Trade.ts @@ -0,0 +1,204 @@ +import { ActionRowBuilder, ButtonBuilder, ButtonInteraction, ButtonStyle, EmbedBuilder } from "discord.js"; +import { ButtonEvent } from "../type/buttonEvent"; +import { CoreClient } from "../client/client"; +import Inventory from "../database/entities/app/Inventory"; +import EmbedColours from "../constants/EmbedColours"; + +export default class Trade extends ButtonEvent { + public override async execute(interaction: ButtonInteraction) { + const action = interaction.customId.split(" ")[1]; + + switch (action) { + case "accept": + await this.AcceptTrade(interaction); + break; + case "decline": + await this.DeclineTrade(interaction); + break; + } + } + + private async AcceptTrade(interaction: ButtonInteraction) { + const giveUserId = interaction.customId.split(" ")[2]; + const receiveUserId = interaction.customId.split(" ")[3]; + const giveCardNumber = interaction.customId.split(" ")[4]; + const receiveCardNumber = interaction.customId.split(" ")[5]; + const expiry = interaction.customId.split(" ")[6]; + const timeoutId = interaction.customId.split(" ")[7]; + + const expiryDate = new Date(expiry); + + if (expiryDate < new Date()) { + await interaction.reply("Trade has expired"); + return; + } + + if (interaction.user.id !== receiveUserId) { + await interaction.reply("You are not the user who the trade is intended for"); + return; + } + + const giveItem = CoreClient.Cards + .flatMap(x => x.cards) + .find(x => x.id === giveCardNumber); + + const receiveItem = CoreClient.Cards + .flatMap(x => x.cards) + .find(x => x.id === receiveCardNumber); + + if (!giveItem || !receiveItem) { + await interaction.reply("One or more of the items you are trying to trade does not exist."); + return; + } + + const giveUser = interaction.client.users.cache.get(giveUserId) || await interaction.client.users.fetch(giveUserId); + const receiveUser = interaction.client.users.cache.get(receiveUserId) || await interaction.client.users.fetch(receiveUserId); + + const giveUserInventory1 = await Inventory.FetchOneByCardNumberAndUserId(giveUserId, giveCardNumber); + const receiveUserInventory1 = await Inventory.FetchOneByCardNumberAndUserId(receiveUserId, receiveCardNumber); + + if (!giveUserInventory1 || !receiveUserInventory1) { + await interaction.reply("One or more of the items you are trying to trade does not exist."); + return; + } + + if (giveUserInventory1.Quantity < 1 || receiveUserInventory1.Quantity < 1) { + await interaction.reply("One or more of the items you are trying to trade does not exist."); + return; + } + + giveUserInventory1.SetQuantity(giveUserInventory1.Quantity - 1); + receiveUserInventory1.SetQuantity(receiveUserInventory1.Quantity - 1); + + await giveUserInventory1.Save(Inventory, giveUserInventory1); + await receiveUserInventory1.Save(Inventory, receiveUserInventory1); + + let giveUserInventory2 = await Inventory.FetchOneByCardNumberAndUserId(receiveUserId, giveCardNumber); + let receiveUserInventory2 = await Inventory.FetchOneByCardNumberAndUserId(giveUserId, receiveCardNumber); + + if (!giveUserInventory2) { + giveUserInventory2 = new Inventory(receiveUserId, giveCardNumber, 1); + } else { + giveUserInventory2.SetQuantity(giveUserInventory2.Quantity + 1); + } + + if (!receiveUserInventory2) { + receiveUserInventory2 = new Inventory(giveUserId, receiveCardNumber, 1); + } else { + receiveUserInventory2.SetQuantity(receiveUserInventory2.Quantity + 1); + } + + await giveUserInventory2.Save(Inventory, giveUserInventory2); + await receiveUserInventory2.Save(Inventory, receiveUserInventory2); + + clearTimeout(timeoutId); + + const tradeEmbed = new EmbedBuilder() + .setTitle("Trade Accepted") + .setDescription(`Trade initiated between ${receiveUser.username} and ${giveUser.username}`) + .setColor(EmbedColours.Success) + .setImage("https://i.imgur.com/9w5f1ls.gif") + .addFields([ + { + name: `${receiveUser.username} is giving`, + value: `${giveItem.id}: ${giveItem.name}`, + inline: true, + }, + { + name: `${giveUser.username} is giving`, + value: `${receiveItem.id}: ${receiveItem.name}`, + inline: true, + }, + { + name: "Complete", + value: new Date().toLocaleString(), + } + ]); + + const row = new ActionRowBuilder() + .addComponents([ + new ButtonBuilder() + .setCustomId("trade expired accept") + .setLabel("Accept") + .setStyle(ButtonStyle.Success) + .setDisabled(true), + new ButtonBuilder() + .setCustomId("trade expired decline") + .setLabel("Decline") + .setStyle(ButtonStyle.Danger) + .setDisabled(true), + ]); + + await interaction.update({ embeds: [ tradeEmbed ], components: [ row ]}); + } + + private async DeclineTrade(interaction: ButtonInteraction) { + const giveUserId = interaction.customId.split(" ")[2]; + const receiveUserId = interaction.customId.split(" ")[3]; + const giveCardNumber = interaction.customId.split(" ")[4]; + const receiveCardNumber = interaction.customId.split(" ")[5]; + // No need to get expiry date + const timeoutId = interaction.customId.split(" ")[7]; + + if (interaction.user.id !== receiveUserId || interaction.user.id !== giveUserId) { + await interaction.reply("You are not the user who the trade is intended for"); + return; + } + + const giveUser = interaction.client.users.cache.get(giveUserId) || await interaction.client.users.fetch(giveUserId); + const receiveUser = interaction.client.users.cache.get(receiveUserId) || await interaction.client.users.fetch(receiveUserId); + + const giveItem = CoreClient.Cards + .flatMap(x => x.cards) + .find(x => x.id === giveCardNumber); + + const receiveItem = CoreClient.Cards + .flatMap(x => x.cards) + .find(x => x.id === receiveCardNumber); + + if (!giveItem || !receiveItem) { + await interaction.reply("One or more of the items you are trying to trade does not exist."); + return; + } + + clearTimeout(timeoutId); + + const tradeEmbed = new EmbedBuilder() + .setTitle("Trade Declined") + .setDescription(`Trade initiated between ${receiveUser.username} and ${giveUser.username}`) + .setColor(EmbedColours.Error) + .setImage("https://i.imgur.com/9w5f1ls.gif") + .addFields([ + { + name: `${receiveUser.username} is giving`, + value: `${giveItem.id}: ${giveItem.name}`, + inline: true, + }, + { + name: `${giveUser.username} is giving`, + value: `${receiveItem.id}: ${receiveItem.name}`, + inline: true, + }, + { + name: "Declined", + value: new Date().toLocaleString(), + } + ]); + + const row = new ActionRowBuilder() + .addComponents([ + new ButtonBuilder() + .setCustomId("trade expired accept") + .setLabel("Accept") + .setStyle(ButtonStyle.Success) + .setDisabled(true), + new ButtonBuilder() + .setCustomId("trade expired decline") + .setLabel("Decline") + .setStyle(ButtonStyle.Danger) + .setDisabled(true), + ]); + + await interaction.update({ embeds: [ tradeEmbed ], components: [ row ]}); + } +} \ No newline at end of file diff --git a/src/commands/trade.ts b/src/commands/trade.ts new file mode 100644 index 0000000..60e78d8 --- /dev/null +++ b/src/commands/trade.ts @@ -0,0 +1,143 @@ +import { ActionRowBuilder, ButtonBuilder, ButtonStyle, CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js"; +import { Command } from "../type/command"; +import Inventory from "../database/entities/app/Inventory"; +import { CoreClient } from "../client/client"; +import EmbedColours from "../constants/EmbedColours"; + +export default class Trade extends Command { + constructor() { + super(); + + this.CommandBuilder = new SlashCommandBuilder() + .setName("trade") + .setDescription("Initiate a trade with another user.") + .addUserOption(x => + x + .setName("user") + .setDescription("User to trade with") + .setRequired(true)) + .addStringOption(x => + x + .setName("give") + .setDescription("Item to give") + .setRequired(true)) + .addStringOption(x => + x + .setName("receive") + .setDescription("Item to receive") + .setRequired(true)); + } + + public override async execute(interaction: CommandInteraction) { + const user = interaction.options.getUser("user")!; + const give = interaction.options.get("give")!; + const receive = interaction.options.get("receive")!; + + const giveItemEntity = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, give.value!.toString()); + const receiveItemEntity = await Inventory.FetchOneByCardNumberAndUserId(user.id, receive.value!.toString()); + + if (!giveItemEntity) { + await interaction.reply("You do not have the item you are trying to trade."); + return; + } + + if (!receiveItemEntity) { + await interaction.reply("The user you are trying to trade with does not have the item you are trying to trade for."); + return; + } + + const giveItem = CoreClient.Cards + .flatMap(x => x.cards) + .find(x => x.id === give.value!.toString()); + + const receiveItem = CoreClient.Cards + .flatMap(x => x.cards) + .find(x => x.id === receive.value!.toString()); + + if (!giveItem || !receiveItem) { + await interaction.reply("One or more of the items you are trying to trade does not exist."); + return; + } + + const now = new Date(); + const expiry = now.setMinutes(now.getMinutes() + 15); + + const tradeEmbed = new EmbedBuilder() + .setTitle("Trade Offer") + .setDescription(`Trade initiated between ${interaction.user.username} and ${user.username}`) + .setColor(EmbedColours.Grey) + .setImage("https://media1.tenor.com/m/KkZwKl2AQ2QAAAAd/trade-offer.gif") + .addFields([ + { + name: `${interaction.user.username} is giving`, + value: `${giveItem.id}: ${giveItem.name}`, + inline: true, + }, + { + name: `${user.username} is giving`, + value: `${receiveItem.id}: ${receiveItem.name}`, + inline: true, + }, + { + name: "Expires", + value: new Date(expiry).toLocaleString(), + } + ]); + + const timeoutId = setTimeout(async () => this.autoDecline(interaction, interaction.user.username, user.username, giveItem.id, receiveItem.id, giveItem.name, receiveItem.name), 1000 * 60 * 15); // 15 minutes + + const row = new ActionRowBuilder() + .addComponents([ + new ButtonBuilder() + .setCustomId(`trade accept ${interaction.user.id} ${user.id} ${giveItem.id} ${receiveItem.id} ${expiry} ${timeoutId}`) + .setLabel("Accept") + .setStyle(ButtonStyle.Success), + new ButtonBuilder() + .setCustomId(`trade decline ${interaction.user.id} ${user.id} ${giveItem.id} ${receiveItem.id} ${expiry} ${timeoutId}`) + .setLabel("Decline") + .setStyle(ButtonStyle.Danger), + ]); + + await interaction.reply({ content: `${user}`, embeds: [ tradeEmbed ], components: [ row ] }); + } + + private async autoDecline(interaction: CommandInteraction, giveUsername: string, receiveUsername: string, giveCardNumber: string, receiveCardNumber: string, giveCardName: string, receiveCardName: string) { + const tradeEmbed = new EmbedBuilder() + .setTitle("Trade Expired") + .setDescription(`Trade initiated between ${receiveUsername} and ${giveUsername}`) + .setColor(EmbedColours.Error) + .setImage("https://media1.tenor.com/m/KkZwKl2AQ2QAAAAd/trade-offer.gif") + .addFields([ + { + name: `${receiveUsername} is giving`, + value: `${giveCardNumber}: ${giveCardName}`, + inline: true, + }, + { + name: `${giveUsername} is giving`, + value: `${receiveCardNumber}: ${receiveCardName}`, + inline: true, + }, + { + name: "Expired", + value: new Date().toLocaleString(), + } + ]); + + const row = new ActionRowBuilder() + .addComponents([ + new ButtonBuilder() + .setCustomId("trade expired accept") + .setLabel("Accept") + .setStyle(ButtonStyle.Success) + .setDisabled(true), + new ButtonBuilder() + .setCustomId("trade expired declined") + .setLabel("Decline") + .setStyle(ButtonStyle.Danger) + .setDisabled(true), + ]); + + await interaction.editReply({ embeds: [ tradeEmbed ], components: [ row ]}); + } +} \ No newline at end of file diff --git a/src/constants/EmbedColours.ts b/src/constants/EmbedColours.ts index a54d56f..36777e3 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 Success = 0x50c878; public static readonly Error = 0xff0000; public static readonly Grey = 0xd3d3d3; public static readonly BronzeCard = 0xcd7f32; diff --git a/src/registry.ts b/src/registry.ts index 2fc657d..1087cda 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 Trade from "./commands/trade"; import View from "./commands/view"; // Test Command Imports @@ -18,6 +19,7 @@ import Droprarity from "./commands/stage/droprarity"; import Claim from "./buttonEvents/Claim"; import InventoryButtonEvent from "./buttonEvents/Inventory"; import Reroll from "./buttonEvents/Reroll"; +import TradeButtonEvent from "./buttonEvents/Trade"; export default class Registry { public static RegisterCommands() { @@ -28,6 +30,7 @@ export default class Registry { CoreClient.RegisterCommand("give", new Give()); CoreClient.RegisterCommand("inventory", new Inventory()); CoreClient.RegisterCommand("resync", new Resync()); + CoreClient.RegisterCommand("trade", new Trade()); CoreClient.RegisterCommand("view", new View()); // Test Commands @@ -41,7 +44,8 @@ export default class Registry { public static RegisterButtonEvents() { CoreClient.RegisterButtonEvent("claim", new Claim()); - CoreClient.RegisterButtonEvent("inventory", new InventoryButtonEvent); + CoreClient.RegisterButtonEvent("inventory", new InventoryButtonEvent()); CoreClient.RegisterButtonEvent("reroll", new Reroll()); + CoreClient.RegisterButtonEvent("trade", new TradeButtonEvent()); } } \ No newline at end of file From cd2abf031507cfef108472da18d527331540ea97 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Fri, 23 Feb 2024 18:39:36 +0000 Subject: [PATCH 04/32] Add try/catch to command execution (#173) # 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 try/catch around command execution to console log to stderr and reply in case a command breaks #67 ## 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/173 Reviewed-by: VylpesTester Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- src/client/interactionCreate/Button.ts | 8 +++++++- src/client/interactionCreate/ChatInputCommand.ts | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/client/interactionCreate/Button.ts b/src/client/interactionCreate/Button.ts index fac2b78..6d6a926 100644 --- a/src/client/interactionCreate/Button.ts +++ b/src/client/interactionCreate/Button.ts @@ -12,6 +12,12 @@ export default class Button { return; } - item.Event.execute(interaction); + try { + item.Event.execute(interaction); + } catch (e) { + console.error(e); + + await interaction.reply("An error occurred while executing the event"); + } } } \ No newline at end of file diff --git a/src/client/interactionCreate/ChatInputCommand.ts b/src/client/interactionCreate/ChatInputCommand.ts index 3890744..784ce6e 100644 --- a/src/client/interactionCreate/ChatInputCommand.ts +++ b/src/client/interactionCreate/ChatInputCommand.ts @@ -22,6 +22,12 @@ export default class ChatInputCommand { itemToUse = itemForServer; } - itemToUse.Command.execute(interaction); + try { + itemToUse.Command.execute(interaction); + } catch (e) { + console.error(e); + + await interaction.reply("An error occurred while executing the command"); + } } } \ No newline at end of file From 4ceefe20f94beddf135c3cf48bfd41af9f7e1d94 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 27 Feb 2024 18:32:36 +0000 Subject: [PATCH 05/32] Update dependency @types/node to v20.11.20 (#175) 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.19` -> `20.11.20`](https://renovatebot.com/diffs/npm/@types%2fnode/20.11.19/20.11.20) | --- ### 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/175 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 e300fd2..baf4ec9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1881,9 +1881,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.11.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", - "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "version": "20.11.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.20.tgz", + "integrity": "sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==", "dependencies": { "undici-types": "~5.26.4" } From 806dcb9ab37bfcb6faf7efd024ea35de39e1fe8e Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 27 Feb 2024 18:33:36 +0000 Subject: [PATCH 06/32] Update dependency @typescript-eslint/parser to v6.21.0 (#176) 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/parser](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | minor | [`6.16.0` -> `6.21.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/6.16.0/6.21.0) | --- ### Release Notes
typescript-eslint/typescript-eslint (@​typescript-eslint/parser) ### [`v6.21.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#6210-2024-02-05) [Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.20.0...v6.21.0) ##### 🚀 Features - allow `parserOptions.project: false` ##### ❤️ Thank You - auvred - Brad Zacher - Kirk Waiblinger - Pete Gonzalez - 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.20.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#6200-2024-01-29) [Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.19.1...v6.20.0) This was a version bump only for parser to align it with other projects, there were no code changes. 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.19.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#6191-2024-01-22) [Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.19.0...v6.19.1) This was a version bump only for parser to align it with other projects, there were no code changes. 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.19.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#6190-2024-01-15) [Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.18.1...v6.19.0) This was a version bump only for parser to align it with other projects, there were no code changes. 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.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#6181-2024-01-08) [Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.18.0...v6.18.1) This was a version bump only for parser to align it with other projects, there were no code changes. 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/parser/CHANGELOG.md#6180-2024-01-06) [Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.17.0...v6.18.0) This was a version bump only for parser to align it with other projects, there were no code changes. 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/parser/CHANGELOG.md#6170-2024-01-01) [Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0) **Note:** Version bump only for package [@​typescript-eslint/parser](https://github.com/typescript-eslint/parser) 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/176 Reviewed-by: Vylpes Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 285 ++++------------------------------------------ 1 file changed, 21 insertions(+), 264 deletions(-) diff --git a/package-lock.json b/package-lock.json index baf4ec9..ee09231 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1998,53 +1998,6 @@ } } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", - "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0" - }, - "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.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", - "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", - "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.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", - "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "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", @@ -2069,15 +2022,15 @@ "dev": true }, "node_modules/@typescript-eslint/parser": { - "version": "6.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.16.0.tgz", - "integrity": "sha512-H2GM3eUo12HpKZU9njig3DF5zJ58ja6ahj1GoHEHOgQvYxzoFJJEvC1MQ7T2l9Ha+69ZSOn7RTxOdpC/y3ikMw==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", + "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.16.0", - "@typescript-eslint/types": "6.16.0", - "@typescript-eslint/typescript-estree": "6.16.0", - "@typescript-eslint/visitor-keys": "6.16.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4" }, "engines": { @@ -2120,13 +2073,13 @@ "dev": true }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.16.0.tgz", - "integrity": "sha512-0N7Y9DSPdaBQ3sqSCwlrm9zJwkpOuc6HYm7LpzLAPqBL7dmzAUimr4M29dMkOP/tEwvOCC/Cxo//yOfJD3HUiw==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.16.0", - "@typescript-eslint/visitor-keys": "6.16.0" + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2163,64 +2116,6 @@ } } }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", - "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", - "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.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", - "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", - "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.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", - "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "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", @@ -2238,26 +2133,6 @@ } } }, - "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", @@ -2265,9 +2140,9 @@ "dev": true }, "node_modules/@typescript-eslint/types": { - "version": "6.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.16.0.tgz", - "integrity": "sha512-hvDFpLEvTJoHutVl87+MG/c5C8I6LOgEx05zExTSJDEVU7hhR3jhV8M5zuggbdFCw98+HhZWPHZeKS97kS3JoQ==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2278,13 +2153,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.16.0.tgz", - "integrity": "sha512-VTWZuixh/vr7nih6CfrdpmFNLEnoVBF1skfjdyGnNwXOH1SLeHItGdZDHhhAIzd3ACazyY2Fg76zuzOVTaknGA==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.16.0", - "@typescript-eslint/visitor-keys": "6.16.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -2373,65 +2248,7 @@ "eslint": "^7.0.0 || ^8.0.0" } }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", - "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0" - }, - "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.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", - "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", - "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.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", - "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", - "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": { + "node_modules/@typescript-eslint/visitor-keys": { "version": "6.21.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", @@ -2448,66 +2265,6 @@ "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", - "integrity": "sha512-QSFQLruk7fhs91a/Ep/LqRdbJCZ1Rq03rqBdKT5Ky17Sz8zRLUksqIe9DW0pKtg/Z35/ztbLQ6qpOCN6rOC11A==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.16.0", - "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/@ungap/structured-clone": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", From 2f9d80f430e72fcd0281e510a14e800f9efd12f9 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Fri, 1 Mar 2024 20:02:11 +0000 Subject: [PATCH 07/32] Fix trade command (#177) # 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. - Fix the decline button not working for the initiating user - Update labels on embed to follow "I Receive" and "You Receive" #165 ## Type of change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) # 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/177 Reviewed-by: VylpesTester Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- src/buttonEvents/Trade.ts | 18 +++++++++--------- src/commands/trade.ts | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/buttonEvents/Trade.ts b/src/buttonEvents/Trade.ts index 28b08ee..d272d9f 100644 --- a/src/buttonEvents/Trade.ts +++ b/src/buttonEvents/Trade.ts @@ -100,13 +100,13 @@ export default class Trade extends ButtonEvent { .setImage("https://i.imgur.com/9w5f1ls.gif") .addFields([ { - name: `${receiveUser.username} is giving`, - value: `${giveItem.id}: ${giveItem.name}`, + name: "I receieve", + value: `${receiveItem.id}: ${receiveItem.name}`, inline: true, }, { - name: `${giveUser.username} is giving`, - value: `${receiveItem.id}: ${receiveItem.name}`, + name: "You receieve", + value: `${giveItem.id}: ${giveItem.name}`, inline: true, }, { @@ -140,7 +140,7 @@ export default class Trade extends ButtonEvent { // No need to get expiry date const timeoutId = interaction.customId.split(" ")[7]; - if (interaction.user.id !== receiveUserId || interaction.user.id !== giveUserId) { + if (interaction.user.id != receiveUserId && interaction.user.id !==giveUserId) { await interaction.reply("You are not the user who the trade is intended for"); return; } @@ -170,13 +170,13 @@ export default class Trade extends ButtonEvent { .setImage("https://i.imgur.com/9w5f1ls.gif") .addFields([ { - name: `${receiveUser.username} is giving`, - value: `${giveItem.id}: ${giveItem.name}`, + name: "I Receive", + value: `${receiveItem.id}: ${receiveItem.name}`, inline: true, }, { - name: `${giveUser.username} is giving`, - value: `${receiveItem.id}: ${receiveItem.name}`, + name: "You Receive", + value: `${giveItem.id}: ${giveItem.name}`, inline: true, }, { diff --git a/src/commands/trade.ts b/src/commands/trade.ts index 60e78d8..8414ae9 100644 --- a/src/commands/trade.ts +++ b/src/commands/trade.ts @@ -63,19 +63,19 @@ export default class Trade extends Command { const expiry = now.setMinutes(now.getMinutes() + 15); const tradeEmbed = new EmbedBuilder() - .setTitle("Trade Offer") + .setTitle("⚠️ Trade Offer ⚠️") .setDescription(`Trade initiated between ${interaction.user.username} and ${user.username}`) .setColor(EmbedColours.Grey) .setImage("https://media1.tenor.com/m/KkZwKl2AQ2QAAAAd/trade-offer.gif") .addFields([ { - name: `${interaction.user.username} is giving`, - value: `${giveItem.id}: ${giveItem.name}`, + name: "I Receive", + value: `${receiveItem.id}: ${receiveItem.name}`, inline: true, }, { - name: `${user.username} is giving`, - value: `${receiveItem.id}: ${receiveItem.name}`, + name: "You Receive", + value: `${giveItem.id}: ${giveItem.name}`, inline: true, }, { @@ -109,13 +109,13 @@ export default class Trade extends Command { .setImage("https://media1.tenor.com/m/KkZwKl2AQ2QAAAAd/trade-offer.gif") .addFields([ { - name: `${receiveUsername} is giving`, - value: `${giveCardNumber}: ${giveCardName}`, + name: "I Receive", + value: `${receiveCardNumber}: ${receiveCardName}`, inline: true, }, { - name: `${giveUsername} is giving`, - value: `${receiveCardNumber}: ${receiveCardName}`, + name: "You Receive", + value: `${giveCardNumber}: ${giveCardName}`, inline: true, }, { From 42883c3a99df0cd340a92ee7d6216e40c96e6b2b Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Fri, 1 Mar 2024 20:03:34 +0000 Subject: [PATCH 08/32] Fix give command using the wrong username (#178) # 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. - Fix the give command incorrectly using the username of the user who used the command instead of the user who it was actually given to #174 ## Type of change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) # 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/178 Reviewed-by: VylpesTester Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- src/commands/give.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/give.ts b/src/commands/give.ts index ad360a9..7bc24be 100644 --- a/src/commands/give.ts +++ b/src/commands/give.ts @@ -63,6 +63,6 @@ export default class Give extends Command { await inventory.Save(Inventory, inventory); - await interaction.reply(`${card.name} given to ${interaction.user}, they now have ${inventory.Quantity}`); + await interaction.reply(`${card.name} given to ${user.username}, they now have ${inventory.Quantity}`); } } \ No newline at end of file From 0c94c5817f518321b78b3fd1bde43a9c691f990a Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 5 Mar 2024 18:38:18 +0000 Subject: [PATCH 09/32] Update dependency @types/node to v20.11.24 (#179) 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.20` -> `20.11.24`](https://renovatebot.com/diffs/npm/@types%2fnode/20.11.20/20.11.24) | --- ### 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/179 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 ee09231..91e48a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1881,9 +1881,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.11.20", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.20.tgz", - "integrity": "sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==", + "version": "20.11.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz", + "integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==", "dependencies": { "undici-types": "~5.26.4" } From 2377397a2e77f7f264a634dfed876aeb2873e9d1 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 5 Mar 2024 18:39:23 +0000 Subject: [PATCH 10/32] Update dependency express to v4.18.3 (#180) 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 | |---|---|---|---| | [express](http://expressjs.com/) ([source](https://github.com/expressjs/express)) | dependencies | patch | [`4.18.2` -> `4.18.3`](https://renovatebot.com/diffs/npm/express/4.18.2/4.18.3) | --- ### Release Notes
expressjs/express (express) ### [`v4.18.3`](https://github.com/expressjs/express/blob/HEAD/History.md#4183--2024-02-26) [Compare Source](https://github.com/expressjs/express/compare/4.18.2...4.18.3) \========== - Fix routing requests without method - deps: body-parser@1.20.2 - Fix strict json error message on Node.js 19+ - deps: content-type@~1.0.5 - deps: raw-body@2.5.2
--- ### 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/180 Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 42 ++++-------------------------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/package-lock.json b/package-lock.json index 91e48a2..b7bee01 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4692,12 +4692,13 @@ } }, "node_modules/express": { - "version": "4.18.2", - "license": "MIT", + "version": "4.18.3", + "resolved": "https://registry.npmjs.org/express/-/express-4.18.3.tgz", + "integrity": "sha512-6VyCijWQ+9O7WuVMTRBTl+cjNNIzD5cY5mQ1WM8r/LEkI2u8EYpOotESNwzNlyCn3g+dmjKYI6BmNneSr/FSRw==", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.1", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", "cookie": "0.5.0", @@ -4731,41 +4732,6 @@ "node": ">= 0.10.0" } }, - "node_modules/express/node_modules/body-parser": { - "version": "1.20.1", - "license": "MIT", - "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/express/node_modules/raw-body": { - "version": "2.5.1", - "license": "MIT", - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/external-editor": { "version": "3.1.0", "dev": true, From 2d2c76a266ec251f29b4196efa1e870adddfab74 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 11 Mar 2024 19:48:03 +0000 Subject: [PATCH 11/32] Update dependency @types/node to v20.11.25 (#181) 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.24` -> `20.11.25`](https://renovatebot.com/diffs/npm/@types%2fnode/20.11.24/20.11.25) | --- ### 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/181 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 b7bee01..5ca011f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1881,9 +1881,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.11.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz", - "integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==", + "version": "20.11.25", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.25.tgz", + "integrity": "sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==", "dependencies": { "undici-types": "~5.26.4" } From e32105a849103d3feb6dc39b5458d194af853cc9 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 11 Mar 2024 19:54:37 +0000 Subject: [PATCH 12/32] Update dependency dotenv to v16.4.5 (#182) 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 | minor | [`16.3.2` -> `16.4.5`](https://renovatebot.com/diffs/npm/dotenv/16.3.2/16.4.5) | --- ### Release Notes
motdotla/dotenv (dotenv) ### [`v16.4.5`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1645-2024-02-19) [Compare Source](https://github.com/motdotla/dotenv/compare/v16.4.4...v16.4.5) ##### Changed - 🐞 fix recent regression when using `path` option. return to historical behavior: do not attempt to auto find `.env` if `path` set. (regression was introduced in `16.4.3`) [#​814](https://github.com/motdotla/dotenv/pull/814) ### [`v16.4.4`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1644-2024-02-13) [Compare Source](https://github.com/motdotla/dotenv/compare/v16.4.3...v16.4.4) ##### Changed - 🐞 Replaced chaining operator `?.` with old school `&&` (fixing node 12 failures) [#​812](https://github.com/motdotla/dotenv/pull/812) ### [`v16.4.3`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1643-2024-02-12) [Compare Source](https://github.com/motdotla/dotenv/compare/v16.4.2...v16.4.3) ##### Changed - Fixed processing of multiple files in `options.path` [#​805](https://github.com/motdotla/dotenv/pull/805) ### [`v16.4.2`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1642-2024-02-10) [Compare Source](https://github.com/motdotla/dotenv/compare/v16.4.1...v16.4.2) ##### Changed - Changed funding link in package.json to [`dotenvx.com`](https://dotenvx.com) ### [`v16.4.1`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1641-2024-01-24) [Compare Source](https://github.com/motdotla/dotenv/compare/v16.4.0...v16.4.1) - Patch support for array as `path` option [#​797](https://github.com/motdotla/dotenv/pull/797) ### [`v16.4.0`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1640-2024-01-23) [Compare Source](https://github.com/motdotla/dotenv/compare/v16.3.2...v16.4.0) - Add `error.code` to error messages around `.env.vault` decryption handling [#​795](https://github.com/motdotla/dotenv/pull/795) - Add ability to find `.env.vault` file when filename(s) passed as an array [#​784](https://github.com/motdotla/dotenv/pull/784)
--- ### 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/182 Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5ca011f..5e99ee0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4189,14 +4189,14 @@ } }, "node_modules/dotenv": { - "version": "16.3.2", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.2.tgz", - "integrity": "sha512-HTlk5nmhkm8F6JcdXvHIzaorzCoziNQT9mGxLPVXW8wJF1TiGSL60ZGB4gHWabHOaMmWmhvk2/lPHfnBiT78AQ==", + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", "engines": { "node": ">=12" }, "funding": { - "url": "https://github.com/motdotla/dotenv?sponsor=1" + "url": "https://dotenvx.com" } }, "node_modules/eastasianwidth": { From 5dd50a3f3b1ff25176e6bbd69d971ffc5cc59fa1 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Fri, 15 Mar 2024 17:33:12 +0000 Subject: [PATCH 13/32] Add logger to project (#183) # 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 the winston package to handle logging - Add logging to the project's logic #146 ## 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/183 Reviewed-by: VylpesTester Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- .dev.env | 1 + .prod.env | 1 + .stage.env | 1 + package-lock.json | 222 +++++++++++++++++- package.json | 3 +- src/Functions/CardMetadataFunction.ts | 22 +- src/buttonEvents/Claim.ts | 3 + src/buttonEvents/Inventory.ts | 8 +- src/buttonEvents/Reroll.ts | 8 +- src/buttonEvents/Trade.ts | 7 + src/client/appLogger.ts | 65 +++++ src/client/client.ts | 50 +++- src/client/events.ts | 5 +- src/client/interactionCreate/Button.ts | 8 +- .../interactionCreate/ChatInputCommand.ts | 8 +- src/client/util.ts | 5 + src/commands/drop.ts | 7 +- src/commands/gdrivesync.ts | 10 + src/commands/give.ts | 3 + src/commands/inventory.ts | 7 +- src/commands/resync.ts | 7 + src/commands/trade.ts | 5 + src/commands/view.ts | 7 +- src/helpers/CardDropHelperMetadata.ts | 17 ++ src/helpers/InventoryHelper.ts | 5 +- src/hooks/ReloadDB.ts | 3 +- src/webhooks.ts | 3 +- 27 files changed, 465 insertions(+), 26 deletions(-) create mode 100644 src/client/appLogger.ts diff --git a/.dev.env b/.dev.env index 9965665..aa54d10 100644 --- a/.dev.env +++ b/.dev.env @@ -12,6 +12,7 @@ BOT_AUTHOR=Vylpes BOT_OWNERID=147392775707426816 BOT_CLIENTID=682942374040961060 BOT_ENV=4 +BOT_LOGLEVEL=info BOT_ADMINS=147392775707426816,887272961504071690 ABOUT_FUNDING= diff --git a/.prod.env b/.prod.env index da1fc9c..80de62d 100644 --- a/.prod.env +++ b/.prod.env @@ -12,6 +12,7 @@ BOT_AUTHOR=Vylpes BOT_OWNERID=147392775707426816 BOT_CLIENTID=1093810443589529631 BOT_ENV=1 +BOT_LOGLEVEL=info BOT_ADMINS=147392775707426816,887272961504071690 ABOUT_FUNDING= diff --git a/.stage.env b/.stage.env index 0c9264a..09120c1 100644 --- a/.stage.env +++ b/.stage.env @@ -12,6 +12,7 @@ BOT_AUTHOR=Vylpes BOT_OWNERID=147392775707426816 BOT_CLIENTID=1147976642942214235 BOT_ENV=2 +BOT_LOGLEVEL=info BOT_ADMINS=147392775707426816,887272961504071690 ABOUT_FUNDING= diff --git a/package-lock.json b/package-lock.json index e2d71ad..d222db8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,8 @@ "minimatch": "9.0.3", "mysql": "^2.18.1", "ts-jest": "^29.0.0", - "typeorm": "0.3.20" + "typeorm": "0.3.20", + "winston": "^3.11.0" }, "devDependencies": { "@types/node": "^20.0.0", @@ -711,6 +712,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@colors/colors": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz", + "integrity": "sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==", + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/@dabh/diagnostics": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz", + "integrity": "sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==", + "dependencies": { + "colorspace": "1.1.x", + "enabled": "2.0.x", + "kuler": "^2.0.0" + } + }, "node_modules/@discordjs/builders": { "version": "1.7.0", "license": "Apache-2.0", @@ -1940,6 +1959,11 @@ "version": "2.0.3", "license": "MIT" }, + "node_modules/@types/triple-beam": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz", + "integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==" + }, "node_modules/@types/uuid": { "version": "9.0.8", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz", @@ -2576,6 +2600,11 @@ "node": ">=8" } }, + "node_modules/async": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", + "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==" + }, "node_modules/babel-jest": { "version": "29.7.0", "license": "MIT", @@ -3582,6 +3611,15 @@ "version": "1.0.2", "license": "MIT" }, + "node_modules/color": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", + "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", + "dependencies": { + "color-convert": "^1.9.3", + "color-string": "^1.6.0" + } + }, "node_modules/color-convert": { "version": "2.0.1", "license": "MIT", @@ -3596,6 +3634,15 @@ "version": "1.1.4", "license": "MIT" }, + "node_modules/color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, "node_modules/color-support": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", @@ -3606,6 +3653,28 @@ "color-support": "bin.js" } }, + "node_modules/color/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, + "node_modules/colorspace": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.4.tgz", + "integrity": "sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w==", + "dependencies": { + "color": "^3.1.3", + "text-hex": "1.0.x" + } + }, "node_modules/commander": { "version": "6.2.1", "dev": true, @@ -4211,6 +4280,11 @@ "version": "8.0.0", "license": "MIT" }, + "node_modules/enabled": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz", + "integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==" + }, "node_modules/encodeurl": { "version": "1.0.2", "license": "MIT", @@ -4767,6 +4841,11 @@ "bser": "2.1.1" } }, + "node_modules/fecha": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz", + "integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==" + }, "node_modules/figures": { "version": "2.0.0", "dev": true, @@ -4859,6 +4938,11 @@ "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, + "node_modules/fn.name": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", + "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" + }, "node_modules/foreground-child": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", @@ -7055,6 +7139,11 @@ "node": ">=6" } }, + "node_modules/kuler": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz", + "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==" + }, "node_modules/latest-version": { "version": "7.0.0", "dev": true, @@ -7555,6 +7644,27 @@ "node": ">=4" } }, + "node_modules/logform": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/logform/-/logform-2.6.0.tgz", + "integrity": "sha512-1ulHeNPp6k/LD8H91o7VYFBng5i1BDE7HoKxVbZiGFidS1Rj65qcywLxX+pVfAPoQJEjRdvKcusKwOupHCVOVQ==", + "dependencies": { + "@colors/colors": "1.6.0", + "@types/triple-beam": "^1.3.2", + "fecha": "^4.2.0", + "ms": "^2.1.1", + "safe-stable-stringify": "^2.3.1", + "triple-beam": "^1.3.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/logform/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, "node_modules/lowercase-keys": { "version": "2.0.0", "dev": true, @@ -8670,6 +8780,14 @@ "wrappy": "1" } }, + "node_modules/one-time": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", + "integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==", + "dependencies": { + "fn.name": "1.x.x" + } + }, "node_modules/onetime": { "version": "5.1.2", "license": "MIT", @@ -9887,6 +10005,14 @@ ], "license": "MIT" }, + "node_modules/safe-stable-stringify": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", + "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", + "engines": { + "node": ">=10" + } + }, "node_modules/safer-buffer": { "version": "2.1.2", "license": "MIT" @@ -10034,6 +10160,19 @@ "version": "3.0.7", "license": "ISC" }, + "node_modules/simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", + "dependencies": { + "is-arrayish": "^0.3.1" + } + }, + "node_modules/simple-swizzle/node_modules/is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" + }, "node_modules/sisteransi": { "version": "1.0.5", "license": "MIT" @@ -10223,6 +10362,14 @@ "node": ">=8" } }, + "node_modules/stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==", + "engines": { + "node": "*" + } + }, "node_modules/stack-utils": { "version": "2.0.6", "license": "MIT", @@ -10571,6 +10718,11 @@ "node": "*" } }, + "node_modules/text-hex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", + "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==" + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -10656,6 +10808,14 @@ "optional": true, "peer": true }, + "node_modules/triple-beam": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.4.1.tgz", + "integrity": "sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==", + "engines": { + "node": ">= 14.0.0" + } + }, "node_modules/ts-api-utils": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", @@ -11244,6 +11404,66 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/winston": { + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.11.0.tgz", + "integrity": "sha512-L3yR6/MzZAOl0DsysUXHVjOwv8mKZ71TrA/41EIduGpOOV5LQVodqN+QdQ6BS6PJ/RdIshZhq84P/fStEZkk7g==", + "dependencies": { + "@colors/colors": "^1.6.0", + "@dabh/diagnostics": "^2.0.2", + "async": "^3.2.3", + "is-stream": "^2.0.0", + "logform": "^2.4.0", + "one-time": "^1.0.0", + "readable-stream": "^3.4.0", + "safe-stable-stringify": "^2.3.1", + "stack-trace": "0.0.x", + "triple-beam": "^1.3.0", + "winston-transport": "^4.5.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/winston-transport": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.7.0.tgz", + "integrity": "sha512-ajBj65K5I7denzer2IYW6+2bNIVqLGDHqDw3Ow8Ohh+vdW+rv4MZ6eiDvHoKhfJFZ2auyN8byXieDDJ96ViONg==", + "dependencies": { + "logform": "^2.3.2", + "readable-stream": "^3.6.0", + "triple-beam": "^1.3.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/winston-transport/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/winston/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/wrap-ansi": { "version": "8.1.0", "license": "MIT", diff --git a/package.json b/package.json index d481825..3f77778 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,8 @@ "minimatch": "9.0.3", "mysql": "^2.18.1", "ts-jest": "^29.0.0", - "typeorm": "0.3.20" + "typeorm": "0.3.20", + "winston": "^3.11.0" }, "overrides": { "undici": "^5.28.3" diff --git a/src/Functions/CardMetadataFunction.ts b/src/Functions/CardMetadataFunction.ts index 3a8b97a..733c50c 100644 --- a/src/Functions/CardMetadataFunction.ts +++ b/src/Functions/CardMetadataFunction.ts @@ -4,6 +4,7 @@ import Config from "../database/entities/app/Config"; import { glob } from "glob"; import { SeriesMetadata } from "../contracts/SeriesMetadata"; import { CoreClient } from "../client/client"; +import AppLogger from "../client/appLogger"; export interface CardMetadataResult { IsSuccess: boolean; @@ -21,16 +22,22 @@ export interface FindMetadataResult { export default class CardMetadataFunction { 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", - }; + AppLogger.LogInfo("Functions/CardMetadataFunction", "Executing"); + + if (!overrideSafeMode && await Config.GetValue("safemode") == "true") { + AppLogger.LogWarn("Functions/CardMetadataFunction", "Safe Mode is active, refusing to resync"); + + return { + IsSuccess: false, + ErrorMessage: "Safe mode is on and not overridden", + }; + } 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`); + AppLogger.LogInfo("Functions/CardMetadataFunction", `Loaded ${CoreClient.Cards.flatMap(x => x.cards).length} cards to database`); return { IsSuccess: true, @@ -38,6 +45,7 @@ export default class CardMetadataFunction { } await Config.SetValue("safemode", "true"); + AppLogger.LogError("Functions/CardMetadataFunction", `Safe Mode activated due to error: ${cardResult.Error!.Message}`); return { IsSuccess: false, @@ -52,13 +60,13 @@ export default class CardMetadataFunction { for (const jsonPath of seriesJSONs) { try { - console.log(`Reading file ${jsonPath}`); + AppLogger.LogVerbose("Functions/CardMetadataFunction", `Reading file ${jsonPath}`); const jsonFile = readFileSync(jsonPath); const parsedJson: SeriesMetadata[] = JSON.parse(jsonFile.toString()); res.push(...parsedJson); } catch (e) { - console.error(e); + AppLogger.LogError("Functions/CardMetadataFunction", `Error reading file ${jsonPath}: ${e}`); return { IsSuccess: false, diff --git a/src/buttonEvents/Claim.ts b/src/buttonEvents/Claim.ts index a9f8c86..53538f4 100644 --- a/src/buttonEvents/Claim.ts +++ b/src/buttonEvents/Claim.ts @@ -3,6 +3,7 @@ import { ButtonEvent } from "../type/buttonEvent"; import Inventory from "../database/entities/app/Inventory"; import { CoreClient } from "../client/client"; import { default as eClaim } from "../database/entities/app/Claim"; +import AppLogger from "../client/appLogger"; export default class Claim extends ButtonEvent { public override async execute(interaction: ButtonInteraction) { @@ -13,6 +14,8 @@ export default class Claim extends ButtonEvent { const droppedBy = interaction.customId.split(" ")[3]; const userId = interaction.user.id; + AppLogger.LogSilly("Button/Claim", `Parameters: cardNumber=${cardNumber}, claimId=${claimId}, droppedBy=${droppedBy}, userId=${userId}`); + await interaction.deferReply(); const claimed = await eClaim.FetchOneByClaimId(claimId); diff --git a/src/buttonEvents/Inventory.ts b/src/buttonEvents/Inventory.ts index 4bfffc1..7dfb305 100644 --- a/src/buttonEvents/Inventory.ts +++ b/src/buttonEvents/Inventory.ts @@ -1,6 +1,7 @@ import { ButtonInteraction } from "discord.js"; import { ButtonEvent } from "../type/buttonEvent"; import InventoryHelper from "../helpers/InventoryHelper"; +import AppLogger from "../client/appLogger"; export default class Inventory extends ButtonEvent { public override async execute(interaction: ButtonInteraction) { @@ -9,6 +10,8 @@ export default class Inventory extends ButtonEvent { const userid = interaction.customId.split(" ")[1]; const page = interaction.customId.split(" ")[2]; + AppLogger.LogSilly("Button/Inventory", `Parameters: userid=${userid}, page=${page}`); + const member = interaction.guild.members.cache.find(x => x.id == userid) || await interaction.guild.members.fetch(userid); if (!member) { @@ -17,6 +20,8 @@ export default class Inventory extends ButtonEvent { } try { + AppLogger.LogVerbose("Button/Inventory", `Generating inventory page ${page} for ${member.user.username} with id ${member.user.id}`); + const embed = await InventoryHelper.GenerateInventoryPage(member.user.username, member.user.id, Number(page)); await interaction.update({ @@ -24,7 +29,8 @@ export default class Inventory extends ButtonEvent { components: [ embed.row ], }); } catch (e) { - console.error(e); + AppLogger.LogError("Button/Inventory", `Error generating inventory page for ${member.user.username} with id ${member.user.id}: ${e}`); + await interaction.reply("No page for user found."); } } diff --git a/src/buttonEvents/Reroll.ts b/src/buttonEvents/Reroll.ts index a265bcb..c271a3a 100644 --- a/src/buttonEvents/Reroll.ts +++ b/src/buttonEvents/Reroll.ts @@ -7,6 +7,7 @@ import Inventory from "../database/entities/app/Inventory"; import Config from "../database/entities/app/Config"; import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata"; import path from "path"; +import AppLogger from "../client/appLogger"; export default class Reroll extends ButtonEvent { public override async execute(interaction: ButtonInteraction) { @@ -16,6 +17,8 @@ export default class Reroll extends ButtonEvent { } if (await Config.GetValue("safemode") == "true") { + AppLogger.LogWarn("Button/Reroll", "Safe Mode is active, refusing to send next drop."); + await interaction.reply("Safe Mode has been activated, please resync to continue."); return; } @@ -30,6 +33,8 @@ export default class Reroll extends ButtonEvent { await interaction.deferReply(); try { + AppLogger.LogVerbose("Button/Reroll", `Sending next drop: ${randomCard.card.id} (${randomCard.card.name})`); + const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path)); const imageFileName = randomCard.card.path.split("/").pop()!; @@ -51,9 +56,8 @@ export default class Reroll extends ButtonEvent { }); CoreClient.ClaimId = claimId; - } catch (e) { - console.error(e); + AppLogger.LogError("Button/Reroll", `Error sending next drop for card ${randomCard.card.id}: ${e}`); await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. (${randomCard.card.id})`); } diff --git a/src/buttonEvents/Trade.ts b/src/buttonEvents/Trade.ts index d272d9f..9ce4e56 100644 --- a/src/buttonEvents/Trade.ts +++ b/src/buttonEvents/Trade.ts @@ -3,11 +3,14 @@ import { ButtonEvent } from "../type/buttonEvent"; import { CoreClient } from "../client/client"; import Inventory from "../database/entities/app/Inventory"; import EmbedColours from "../constants/EmbedColours"; +import AppLogger from "../client/appLogger"; export default class Trade extends ButtonEvent { public override async execute(interaction: ButtonInteraction) { const action = interaction.customId.split(" ")[1]; + AppLogger.LogSilly("Button/Trade", `Parameters: action=${action}`); + switch (action) { case "accept": await this.AcceptTrade(interaction); @@ -26,6 +29,8 @@ export default class Trade extends ButtonEvent { const expiry = interaction.customId.split(" ")[6]; const timeoutId = interaction.customId.split(" ")[7]; + AppLogger.LogSilly("Button/Trade/AcceptTrade", `Parameters: giveUserId=${giveUserId}, receiveUserId=${receiveUserId}, giveCardNumber=${giveCardNumber}, receiveCardNumber=${receiveCardNumber}, expiry=${expiry}, timeoutId=${timeoutId}`); + const expiryDate = new Date(expiry); if (expiryDate < new Date()) { @@ -140,6 +145,8 @@ export default class Trade extends ButtonEvent { // No need to get expiry date const timeoutId = interaction.customId.split(" ")[7]; + AppLogger.LogSilly("Button/Trade/DeclineTrade", `Parameters: giveUserId=${giveUserId}, receiveUserId=${receiveUserId}, giveCardNumber=${giveCardNumber}, receiveCardNumber=${receiveCardNumber}, timeoutId=${timeoutId}`); + if (interaction.user.id != receiveUserId && interaction.user.id !==giveUserId) { await interaction.reply("You are not the user who the trade is intended for"); return; diff --git a/src/client/appLogger.ts b/src/client/appLogger.ts new file mode 100644 index 0000000..c5d022b --- /dev/null +++ b/src/client/appLogger.ts @@ -0,0 +1,65 @@ +import { Logger, createLogger, format, transports } from "winston"; + +export default class AppLogger { + public static Logger: Logger; + + public static InitialiseLogger(logLevel: string, outputToConsole: boolean) { + const customFormat = format.printf(({ level, message, timestamp, label }) => { + return `${timestamp} [${label}] ${level}: ${message}`; + }); + + const logger = createLogger({ + level: logLevel, + format: format.combine( + format.timestamp({ + format: "YYYY-MM-DD HH:mm:ss" + }), + format.errors({ stack: true }), + format.splat(), + customFormat, + ), + defaultMeta: { service: "bot" }, + transports: [ + new transports.File({ filename: "error.log", level: "error" }), + new transports.File({ filename: "combined.log" }), + ], + }); + + if (outputToConsole) { + logger.add(new transports.Console({ + format: format.combine( + format.colorize(), + format.timestamp(), + customFormat, + )})); + } + + AppLogger.Logger = logger; + + AppLogger.LogInfo("AppLogger", `Log Level: ${logLevel}`); + } + + public static LogError(label: string, message: string) { + AppLogger.Logger.error({ label, message }); + } + + public static LogWarn(label: string, message: string) { + AppLogger.Logger.warn({ label, message }); + } + + public static LogInfo(label: string, message: string) { + AppLogger.Logger.info({ label, message }); + } + + public static LogVerbose(label: string, message: string) { + AppLogger.Logger.verbose({ label, message }); + } + + public static LogDebug(label: string, message: string) { + AppLogger.Logger.debug({ label, message }); + } + + public static LogSilly(label: string, message: string) { + AppLogger.Logger.silly({ label, message }); + } +} \ No newline at end of file diff --git a/src/client/client.ts b/src/client/client.ts index ca2fba3..c694950 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -13,6 +13,7 @@ import { Environment } from "../constants/Environment"; import Webhooks from "../webhooks"; import CardMetadataFunction from "../Functions/CardMetadataFunction"; import { SeriesMetadata } from "../contracts/SeriesMetadata"; +import AppLogger from "./appLogger"; export class CoreClient extends Client { private static _commandItems: ICommandItem[]; @@ -44,6 +45,14 @@ export class CoreClient extends Client { super({ intents: intents }); dotenv.config(); + CoreClient.Environment = Number(process.env.BOT_ENV); + + const loglevel = process.env.BOT_LOGLEVEL ?? "info"; + + AppLogger.InitialiseLogger(loglevel, CoreClient.Environment == Environment.Local); + + AppLogger.LogInfo("Client", "Initialising Client"); + CoreClient._commandItems = []; CoreClient._buttonEvents = []; @@ -51,21 +60,24 @@ export class CoreClient extends Client { this._util = new Util(); this._webhooks = new Webhooks(); - CoreClient.Environment = Number(process.env.BOT_ENV); - console.log(`Bot Environment: ${CoreClient.Environment}`); + AppLogger.LogInfo("Client", `Environment: ${CoreClient.Environment}`); CoreClient.AllowDrops = true; } public async start() { if (!process.env.BOT_TOKEN) { - console.error("BOT_TOKEN is not defined in .env"); + AppLogger.LogError("Client", "BOT_TOKEN is not defined in .env"); return; } await AppDataSource.initialize() - .then(() => console.log("App Data Source Initialised")) - .catch(err => console.error("Error initialising App Data Source", err)); + .then(() => AppLogger.LogInfo("Client", "App Data Source Initialised")) + .catch(err => { + AppLogger.LogError("Client", "App Data Source Initialisation Failed"); + AppLogger.LogError("Client", err); + throw err; + }); super.on("interactionCreate", this._events.onInteractionCreate); super.on("ready", this._events.onReady); @@ -90,6 +102,8 @@ export class CoreClient extends Client { if ((environment & CoreClient.Environment) == CoreClient.Environment) { CoreClient._commandItems.push(item); + + AppLogger.LogVerbose("Client", `Registered Command: ${name}`); } } @@ -112,6 +126,8 @@ export class CoreClient extends Client { MessageUpdate: [], }; } + + AppLogger.LogVerbose("Client", "Registered Channel Create Event"); } public static RegisterChannelDeleteEvent(fn: (channel: DMChannel | NonThreadGuildBasedChannel) => void) { @@ -133,6 +149,8 @@ export class CoreClient extends Client { MessageUpdate: [], }; } + + AppLogger.LogVerbose("Client", "Registered Channel Delete Event"); } public static RegisterChannelUpdateEvent(fn: (channel: DMChannel | NonThreadGuildBasedChannel) => void) { @@ -154,6 +172,8 @@ export class CoreClient extends Client { MessageUpdate: [], }; } + + AppLogger.LogVerbose("Client", "Registered Channel Update Event"); } public static RegisterGuildBanAddEvent(fn: (ban: GuildBan) => void) { @@ -175,6 +195,8 @@ export class CoreClient extends Client { MessageUpdate: [], }; } + + AppLogger.LogVerbose("Client", "Registered Guild Ban Add Event"); } public static RegisterGuildBanRemoveEvent(fn: (channel: GuildBan) => void) { @@ -196,6 +218,8 @@ export class CoreClient extends Client { MessageUpdate: [], }; } + + AppLogger.LogVerbose("Client", "Registered Guild Ban Remove Event"); } public static RegisterGuildCreateEvent(fn: (guild: Guild) => void) { @@ -217,6 +241,8 @@ export class CoreClient extends Client { MessageUpdate: [], }; } + + AppLogger.LogVerbose("Client", "Registered Guild Create Event"); } public static RegisterGuildMemberAddEvent(fn: (member: GuildMember) => void) { @@ -238,6 +264,8 @@ export class CoreClient extends Client { MessageUpdate: [], }; } + + AppLogger.LogVerbose("Client", "Registered Guild Member Add Event"); } public static RegisterGuildMemberRemoveEvent(fn: (member: GuildMember | PartialGuildMember) => void) { @@ -259,6 +287,8 @@ export class CoreClient extends Client { MessageUpdate: [], }; } + + AppLogger.LogVerbose("Client", "Registered Guild Member Remove Event"); } public static GuildMemebrUpdate(fn: (oldMember: GuildMember | PartialGuildMember, newMember: GuildMember) => void) { @@ -280,6 +310,8 @@ export class CoreClient extends Client { MessageUpdate: [], }; } + + AppLogger.LogVerbose("Client", "Registered Guild Member Update Event"); } public static RegisterMessageCreateEvent(fn: (message: Message) => void) { @@ -301,6 +333,8 @@ export class CoreClient extends Client { MessageUpdate: [], }; } + + AppLogger.LogVerbose("Client", "Registered Message Create Event"); } public static RegisterMessageDeleteEvent(fn: (message: Message | PartialMessage) => void) { @@ -322,6 +356,8 @@ export class CoreClient extends Client { MessageUpdate: [], }; } + + AppLogger.LogVerbose("Client", "Registered Message Delete Event"); } public static RegisterMessageUpdateEvent(fn: (oldMessage: Message | PartialMessage, newMessage: Message | PartialMessage) => void) { @@ -343,6 +379,8 @@ export class CoreClient extends Client { MessageUpdate: [ fn ], }; } + + AppLogger.LogVerbose("Client", "Registered Message Update Event"); } public static RegisterButtonEvent(buttonId: string, event: ButtonEvent, environment: Environment = Environment.All) { @@ -354,6 +392,8 @@ export class CoreClient extends Client { if ((environment & CoreClient.Environment) == CoreClient.Environment) { CoreClient._buttonEvents.push(item); + + AppLogger.LogVerbose("Client", `Registered Button Event: ${buttonId}`); } } } diff --git a/src/client/events.ts b/src/client/events.ts index db6cfc4..0b82cee 100644 --- a/src/client/events.ts +++ b/src/client/events.ts @@ -1,22 +1,25 @@ import { Interaction } from "discord.js"; import ChatInputCommand from "./interactionCreate/ChatInputCommand"; import Button from "./interactionCreate/Button"; +import AppLogger from "./appLogger"; export class Events { public async onInteractionCreate(interaction: Interaction) { if (!interaction.guildId) return; if (interaction.isChatInputCommand()) { + AppLogger.LogVerbose("Client", `ChatInputCommand: ${interaction.commandName}`); ChatInputCommand.onChatInput(interaction); } if (interaction.isButton()) { + AppLogger.LogVerbose("Client", `Button: ${interaction.customId}`); Button.onButtonClicked(interaction); } } // Emit when bot is logged in and ready to use public onReady() { - console.log("Ready"); + AppLogger.LogInfo("Client", "Ready"); } } diff --git a/src/client/interactionCreate/Button.ts b/src/client/interactionCreate/Button.ts index 6d6a926..b8abbfc 100644 --- a/src/client/interactionCreate/Button.ts +++ b/src/client/interactionCreate/Button.ts @@ -1,5 +1,6 @@ import { ButtonInteraction } from "discord.js"; import { CoreClient } from "../client"; +import AppLogger from "../appLogger"; export default class Button { public static async onButtonClicked(interaction: ButtonInteraction) { @@ -8,14 +9,19 @@ export default class Button { const item = CoreClient.buttonEvents.find(x => x.ButtonId == interaction.customId.split(" ")[0]); if (!item) { + AppLogger.LogVerbose("Button", `Event not found: ${interaction.customId}`); + await interaction.reply("Event not found"); return; } try { + AppLogger.LogDebug("Button", `Executing ${interaction.customId}`); + item.Event.execute(interaction); } catch (e) { - console.error(e); + AppLogger.LogError("Button", `Error occurred while executing event: ${interaction.customId}`); + AppLogger.LogError("Button", e as string); await interaction.reply("An error occurred while executing the event"); } diff --git a/src/client/interactionCreate/ChatInputCommand.ts b/src/client/interactionCreate/ChatInputCommand.ts index 784ce6e..47f7b37 100644 --- a/src/client/interactionCreate/ChatInputCommand.ts +++ b/src/client/interactionCreate/ChatInputCommand.ts @@ -1,6 +1,7 @@ import { Interaction } from "discord.js"; import { CoreClient } from "../client"; import ICommandItem from "../../contracts/ICommandItem"; +import AppLogger from "../appLogger"; export default class ChatInputCommand { public static async onChatInput(interaction: Interaction) { @@ -13,6 +14,8 @@ export default class ChatInputCommand { if (!itemForServer) { if (!item) { + AppLogger.LogVerbose("ChatInputCommand", `Command not found: ${interaction.commandName}`); + await interaction.reply("Command not found"); return; } @@ -23,9 +26,12 @@ export default class ChatInputCommand { } try { + AppLogger.LogDebug("Command", `Executing ${interaction.commandName}`); + itemToUse.Command.execute(interaction); } catch (e) { - console.error(e); + AppLogger.LogError("ChatInputCommand", `Error occurred while executing command: ${interaction.commandName}`); + AppLogger.LogError("ChatInputCommand", e as string); await interaction.reply("An error occurred while executing the command"); } diff --git a/src/client/util.ts b/src/client/util.ts index ddd84fc..47daa3d 100644 --- a/src/client/util.ts +++ b/src/client/util.ts @@ -1,6 +1,7 @@ import { Client, REST, Routes, SlashCommandBuilder } from "discord.js"; import EventExecutors from "../contracts/EventExecutors"; import { CoreClient } from "./client"; +import AppLogger from "./appLogger"; export class Util { public loadSlashCommands(client: Client) { @@ -29,6 +30,8 @@ export class Util { const rest = new REST({ version: "10" }).setToken(process.env.BOT_TOKEN!); + AppLogger.LogVerbose("Util", `REST PUT: ${globalCommandData.flatMap(x => x.name).join(", ")}`); + rest.put( Routes.applicationCommands(process.env.BOT_CLIENTID!), { @@ -49,6 +52,8 @@ export class Util { if (!client.guilds.cache.has(guild)) continue; + AppLogger.LogVerbose("Util", `REST PUT: ${guild} - ${guildCommandData.flatMap(x => x.name).join(", ")}`); + rest.put( Routes.applicationGuildCommands(process.env.BOT_CLIENTID!, guild), { diff --git a/src/commands/drop.ts b/src/commands/drop.ts index e671e76..7a91042 100644 --- a/src/commands/drop.ts +++ b/src/commands/drop.ts @@ -7,6 +7,7 @@ import Inventory from "../database/entities/app/Inventory"; import Config from "../database/entities/app/Config"; import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata"; import path from "path"; +import AppLogger from "../client/appLogger"; export default class Drop extends Command { constructor() { @@ -24,6 +25,8 @@ export default class Drop extends Command { } if (await Config.GetValue("safemode") == "true") { + AppLogger.LogWarn("Commands/Drop", "Safe Mode is active, refusing to send next drop."); + await interaction.reply("Safe Mode has been activated, please resync to continue."); return; } @@ -31,6 +34,8 @@ export default class Drop extends Command { const randomCard = CardDropHelperMetadata.GetRandomCard(); if (!randomCard) { + AppLogger.LogWarn("Commands/Drop", "Unable to fetch card, please try again. (randomCard is null)"); + await interaction.reply("Unable to fetch card, please try again."); return; } @@ -61,7 +66,7 @@ export default class Drop extends Command { CoreClient.ClaimId = claimId; } catch (e) { - console.error(e); + AppLogger.LogError("Commands/Drop", `Error sending next drop for card ${randomCard.card.id}: ${e}`); await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. (${randomCard.card.id})`); } diff --git a/src/commands/gdrivesync.ts b/src/commands/gdrivesync.ts index c8a393c..b02c873 100644 --- a/src/commands/gdrivesync.ts +++ b/src/commands/gdrivesync.ts @@ -4,6 +4,7 @@ import { ExecException, exec } from "child_process"; import { CoreClient } from "../client/client"; import Config from "../database/entities/app/Config"; import CardMetadataFunction from "../Functions/CardMetadataFunction"; +import AppLogger from "../client/appLogger"; export default class Gdrivesync extends Command { constructor() { @@ -32,19 +33,28 @@ export default class Gdrivesync extends Command { CoreClient.AllowDrops = false; + AppLogger.LogInfo("Commands/GDriveSync", "Syncing google drive to the bot"); + exec(`rclone sync card-drop-gdrive: ${process.env.DATA_DIR}/cards`, async (error: ExecException | null) => { if (error) { + AppLogger.LogError("Commands/GDriveSync", `Error while running sync command: ${error.code}, ${error.message}`); + AppLogger.LogWarn("Commands/GDriveSync", "Safe mode activated"); + 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(true); if (result.IsSuccess) { + AppLogger.LogInfo("Commands/GDriveSync", "Synced successfully"); + await interaction.editReply("Synced successfully."); CoreClient.AllowDrops = true; await Config.SetValue("safemode", "false"); } else { + AppLogger.LogError("Commands/GDriveSync", `Error while running sync command: ${result.ErrorMessage}`); + await interaction.editReply(`Sync failed \`\`\`${result.ErrorMessage}\`\`\``); } } diff --git a/src/commands/give.ts b/src/commands/give.ts index 7bc24be..5121dda 100644 --- a/src/commands/give.ts +++ b/src/commands/give.ts @@ -4,6 +4,7 @@ import { CoreClient } from "../client/client"; import Config from "../database/entities/app/Config"; import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata"; import Inventory from "../database/entities/app/Inventory"; +import AppLogger from "../client/appLogger"; export default class Give extends Command { constructor() { @@ -46,6 +47,8 @@ export default class Give extends Command { const cardNumber = interaction.options.get("cardnumber", true); const user = interaction.options.getUser("user", true); + AppLogger.LogSilly("Commands/Give", `Parameters: cardNumber=${cardNumber.value}, user=${user.id}`); + const card = CardDropHelperMetadata.GetCardByCardNumber(cardNumber.value!.toString()); if (!card) { diff --git a/src/commands/inventory.ts b/src/commands/inventory.ts index 868b14d..7d77764 100644 --- a/src/commands/inventory.ts +++ b/src/commands/inventory.ts @@ -1,6 +1,7 @@ import { CommandInteraction, SlashCommandBuilder } from "discord.js"; import { Command } from "../type/command"; import InventoryHelper from "../helpers/InventoryHelper"; +import AppLogger from "../client/appLogger"; export default class Inventory extends Command { constructor() { @@ -23,6 +24,8 @@ export default class Inventory extends Command { const page = interaction.options.get("page"); const user = interaction.options.getUser("user") || interaction.user; + AppLogger.LogSilly("Commands/Inventory", `Parameters: page=${page?.value}, user=${user.id}`); + try { let pageNumber = 0; @@ -36,7 +39,9 @@ export default class Inventory extends Command { embeds: [ embed.embed ], components: [ embed.row ], }); - } catch { + } catch (e) { + AppLogger.LogError("Commands/Inventory", e as string); + await interaction.reply("No page for user found."); } } diff --git a/src/commands/resync.ts b/src/commands/resync.ts index 7040d52..f90c96c 100644 --- a/src/commands/resync.ts +++ b/src/commands/resync.ts @@ -2,6 +2,7 @@ import { CacheType, CommandInteraction, PermissionsBitField, SlashCommandBuilder import { Command } from "../type/command"; import Config from "../database/entities/app/Config"; import CardMetadataFunction from "../Functions/CardMetadataFunction"; +import AppLogger from "../client/appLogger"; export default class Resync extends Command { constructor() { @@ -23,10 +24,14 @@ export default class Resync extends Command { return; } + AppLogger.LogInfo("Commands/Resync", "Resyncing database"); + const result = await CardMetadataFunction.Execute(true); if (result) { if (await Config.GetValue("safemode") == "true") { + AppLogger.LogInfo("Commands/Resync", "Resync successful, safe mode disabled"); + await Config.SetValue("safemode", "false"); await interaction.reply("Resynced database and disabled safe mode."); @@ -34,6 +39,8 @@ export default class Resync extends Command { } await interaction.reply("Resynced database."); } else { + AppLogger.LogWarn("Commands/Resync", "Resync failed, safe mode activated"); + await interaction.reply("Resync failed, safe mode has been activated until successful resync."); } } diff --git a/src/commands/trade.ts b/src/commands/trade.ts index 8414ae9..60f9033 100644 --- a/src/commands/trade.ts +++ b/src/commands/trade.ts @@ -3,6 +3,7 @@ import { Command } from "../type/command"; import Inventory from "../database/entities/app/Inventory"; import { CoreClient } from "../client/client"; import EmbedColours from "../constants/EmbedColours"; +import AppLogger from "../client/appLogger"; export default class Trade extends Command { constructor() { @@ -33,6 +34,8 @@ export default class Trade extends Command { const give = interaction.options.get("give")!; const receive = interaction.options.get("receive")!; + AppLogger.LogSilly("Commands/Trade", `Parameters: user=${user.id}, give=${give.value}, receive=${receive.value}`); + const giveItemEntity = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, give.value!.toString()); const receiveItemEntity = await Inventory.FetchOneByCardNumberAndUserId(user.id, receive.value!.toString()); @@ -102,6 +105,8 @@ export default class Trade extends Command { } private async autoDecline(interaction: CommandInteraction, giveUsername: string, receiveUsername: string, giveCardNumber: string, receiveCardNumber: string, giveCardName: string, receiveCardName: string) { + AppLogger.LogSilly("Commands/Trade/AutoDecline", `Auto declining trade between ${giveUsername} and ${receiveUsername}`); + const tradeEmbed = new EmbedBuilder() .setTitle("Trade Expired") .setDescription(`Trade initiated between ${receiveUsername} and ${giveUsername}`) diff --git a/src/commands/view.ts b/src/commands/view.ts index 8f89eb4..ce6f9cb 100644 --- a/src/commands/view.ts +++ b/src/commands/view.ts @@ -5,6 +5,7 @@ import { readFileSync } from "fs"; import path from "path"; import Inventory from "../database/entities/app/Inventory"; import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata"; +import AppLogger from "../client/appLogger"; export default class View extends Command { constructor() { @@ -23,6 +24,8 @@ export default class View extends Command { public override async execute(interaction: CommandInteraction) { const cardNumber = interaction.options.get("cardnumber"); + AppLogger.LogSilly("Commands/View", `Parameters: cardNumber=${cardNumber?.value}`); + if (!cardNumber || !cardNumber.value) { await interaction.reply("Card number is required."); return; @@ -46,6 +49,8 @@ export default class View extends Command { try { image = readFileSync(path.join(process.env.DATA_DIR!, "cards", card.path)); } catch { + AppLogger.LogError("Commands/View", `Unable to fetch image for card ${card.id}.`); + await interaction.reply(`Unable to fetch image for card ${card.id}.`); return; } @@ -65,7 +70,7 @@ export default class View extends Command { files: [ attachment ], }); } catch (e) { - console.error(e); + AppLogger.LogError("Commands/View", `Error sending view for card ${card.id}: ${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}.`); diff --git a/src/helpers/CardDropHelperMetadata.ts b/src/helpers/CardDropHelperMetadata.ts index 762648d..27a0d04 100644 --- a/src/helpers/CardDropHelperMetadata.ts +++ b/src/helpers/CardDropHelperMetadata.ts @@ -3,6 +3,7 @@ import { CardRarity, CardRarityToColour, CardRarityToString } from "../constants import CardRarityChances from "../constants/CardRarityChances"; import { CardMetadata, DropResult } from "../contracts/SeriesMetadata"; import { CoreClient } from "../client/client"; +import AppLogger from "../client/appLogger"; export default class CardDropHelperMetadata { public static GetRandomCard(): DropResult | undefined { @@ -23,10 +24,14 @@ export default class CardDropHelperMetadata { const randomCard = this.GetRandomCardByRarity(cardRarity); + AppLogger.LogSilly("CardDropHelperMetadata/GetRandomCard", `Random card: ${randomCard?.card.id} ${randomCard?.card.name}`); + return randomCard; } public static GetRandomCardByRarity(rarity: CardRarity): DropResult | undefined { + AppLogger.LogSilly("CardDropHelperMetadata/GetRandomCardByRarity", `Parameters: rarity=${rarity}`); + const allCards = CoreClient.Cards .flatMap(x => x.cards) .filter(x => x.type == rarity); @@ -38,9 +43,13 @@ export default class CardDropHelperMetadata { .find(x => x.cards.includes(card)); if (!series) { + AppLogger.LogWarn("CardDropHelperMetadata/GetRandomCardByRarity", `Series not found for card ${card.id}`); + return undefined; } + AppLogger.LogSilly("CardDropHelperMetadata/GetRandomCardByRarity", `Random card: ${card.id} ${card.name}`); + return { series: series, card: card, @@ -48,14 +57,20 @@ export default class CardDropHelperMetadata { } public static GetCardByCardNumber(cardNumber: string): CardMetadata | undefined { + AppLogger.LogSilly("CardDropHelperMetadata/GetCardByCardNumber", `Parameters: cardNumber=${cardNumber}`); + const card = CoreClient.Cards .flatMap(x => x.cards) .find(x => x.id == cardNumber); + AppLogger.LogSilly("CardDropHelperMetadata/GetCardByCardNumber", `Card: ${card?.id} ${card?.name}`); + return card; } public static GenerateDropEmbed(drop: DropResult, quantityClaimed: number, imageFileName: string): EmbedBuilder { + AppLogger.LogSilly("CardDropHelperMetadata/GenerateDropEmbed", `Parameters: drop=${drop.card.id}, quantityClaimed=${quantityClaimed}, imageFileName=${imageFileName}`); + let description = ""; description += `Series: ${drop.series.name}\n`; description += `Claimed: ${quantityClaimed}\n`; @@ -69,6 +84,8 @@ export default class CardDropHelperMetadata { } public static GenerateDropButtons(drop: DropResult, claimId: string, userId: string): ActionRowBuilder { + AppLogger.LogSilly("CardDropHelperMetadata/GenerateDropButtons", `Parameters: drop=${drop.card.id}, claimId=${claimId}, userId=${userId}`); + return new ActionRowBuilder() .addComponents( new ButtonBuilder() diff --git a/src/helpers/InventoryHelper.ts b/src/helpers/InventoryHelper.ts index 1103694..3b0c40a 100644 --- a/src/helpers/InventoryHelper.ts +++ b/src/helpers/InventoryHelper.ts @@ -4,6 +4,7 @@ import { CoreClient } from "../client/client"; import EmbedColours from "../constants/EmbedColours"; import { CardRarity, CardRarityToString } from "../constants/CardRarity"; import cloneDeep from "clone-deep"; +import AppLogger from "../client/appLogger"; interface InventoryPage { id: number, @@ -21,6 +22,8 @@ interface InventoryPageCards { export default class InventoryHelper { public static async GenerateInventoryPage(username: string, userid: string, page: number): Promise<{ embed: EmbedBuilder, row: ActionRowBuilder }> { + AppLogger.LogSilly("Helpers/InventoryHelper", `Parameters: username=${username}, userid=${userid}, page=${page}`); + const cardsPerPage = 15; const inventory = await Inventory.FetchAllByUserId(userid); @@ -73,7 +76,7 @@ export default class InventoryHelper { const currentPage = pages[page]; if (!currentPage) { - console.error("Unable to find page"); + AppLogger.LogError("Helpers/InventoryHelper", "Unable to find page"); return Promise.reject("Unable to find page"); } diff --git a/src/hooks/ReloadDB.ts b/src/hooks/ReloadDB.ts index 0f1c026..9d99df7 100644 --- a/src/hooks/ReloadDB.ts +++ b/src/hooks/ReloadDB.ts @@ -1,8 +1,9 @@ import { Request, Response } from "express"; import CardMetadataFunction from "../Functions/CardMetadataFunction"; +import AppLogger from "../client/appLogger"; export default async function ReloadDB(req: Request, res: Response) { - console.log("Reloading Card DB..."); + AppLogger.LogInfo("Hooks/ReloadDB", "Reloading Card DB..."); await CardMetadataFunction.Execute(); diff --git a/src/webhooks.ts b/src/webhooks.ts index cccb598..0b99816 100644 --- a/src/webhooks.ts +++ b/src/webhooks.ts @@ -1,6 +1,7 @@ import bodyParser from "body-parser"; import express, { Application } from "express"; import ReloadDB from "./hooks/ReloadDB"; +import AppLogger from "./client/appLogger"; export default class Webhooks { private app: Application; @@ -24,7 +25,7 @@ export default class Webhooks { private setupListen() { this.app.listen(this.port, () => { - console.log(`API listening on port ${this.port}`); + AppLogger.LogInfo("Webhooks", `API listening on port ${this.port}`); }); } } \ No newline at end of file From 76f1dbaba5248a58a25eede5e9a31ee5b2b8106e Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 21 Mar 2024 17:51:49 +0000 Subject: [PATCH 14/32] Update dependency @types/node to v20.11.28 (#185) 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.25` -> `20.11.28`](https://renovatebot.com/diffs/npm/@types%2fnode/20.11.25/20.11.28) | --- ### 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/185 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 d222db8..67204c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1900,9 +1900,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.11.25", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.25.tgz", - "integrity": "sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==", + "version": "20.11.28", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.28.tgz", + "integrity": "sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA==", "dependencies": { "undici-types": "~5.26.4" } From dead9545baada968f6291bcedca6a915daf0288f Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 21 Mar 2024 17:55:09 +0000 Subject: [PATCH 15/32] Update dependency eslint to v8.57.0 (#186) 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 | |---|---|---|---| | [eslint](https://eslint.org) ([source](https://github.com/eslint/eslint)) | devDependencies | minor | [`8.56.0` -> `8.57.0`](https://renovatebot.com/diffs/npm/eslint/8.56.0/8.57.0) | --- ### Release Notes
eslint/eslint (eslint) ### [`v8.57.0`](https://github.com/eslint/eslint/releases/tag/v8.57.0) [Compare Source](https://github.com/eslint/eslint/compare/v8.56.0...v8.57.0) #### Features - [`1120b9b`](https://github.com/eslint/eslint/commit/1120b9b7b97f10f059d8b7ede19de2572f892366) feat: Add loadESLint() API method for v8 ([#​18098](https://github.com/eslint/eslint/issues/18098)) (Nicholas C. Zakas) - [`dca7d0f`](https://github.com/eslint/eslint/commit/dca7d0f1c262bc72310147bcefe1d04ecf60acbc) feat: Enable `eslint.config.mjs` and `eslint.config.cjs` ([#​18066](https://github.com/eslint/eslint/issues/18066)) (Nitin Kumar) #### Bug Fixes - [`2196d97`](https://github.com/eslint/eslint/commit/2196d97094ba94d6d750828879a29538d1600de5) fix: handle absolute file paths in `FlatRuleTester` ([#​18064](https://github.com/eslint/eslint/issues/18064)) (Nitin Kumar) - [`69dd1d1`](https://github.com/eslint/eslint/commit/69dd1d1387b7b53617548d1f9f2c149f179e6e17) fix: Ensure config keys are printed for config errors ([#​18067](https://github.com/eslint/eslint/issues/18067)) (Nitin Kumar) - [`9852a31`](https://github.com/eslint/eslint/commit/9852a31edcf054bd5d15753ef18e2ad3216b1b71) fix: deep merge behavior in flat config ([#​18065](https://github.com/eslint/eslint/issues/18065)) (Nitin Kumar) - [`4c7e9b0`](https://github.com/eslint/eslint/commit/4c7e9b0b539ba879ac1799e81f3b6add2eed4b2f) fix: allow circular references in config ([#​18056](https://github.com/eslint/eslint/issues/18056)) (Milos Djermanovic) #### Documentation - [`84922d0`](https://github.com/eslint/eslint/commit/84922d0bfa10689a34a447ab8e55975ff1c1c708) docs: Show prerelease version in dropdown ([#​18139](https://github.com/eslint/eslint/issues/18139)) (Nicholas C. Zakas) - [`5b8c363`](https://github.com/eslint/eslint/commit/5b8c3636a3d7536535a6878eca0e5b773e4829d4) docs: Switch to Ethical Ads ([#​18117](https://github.com/eslint/eslint/issues/18117)) (Milos Djermanovic) - [`77dbfd9`](https://github.com/eslint/eslint/commit/77dbfd9887b201a46fc68631cbde50c08e1a8dbf) docs: show NEXT in version selectors ([#​18052](https://github.com/eslint/eslint/issues/18052)) (Milos Djermanovic) #### Chores - [`1813aec`](https://github.com/eslint/eslint/commit/1813aecc4660582b0678cf32ba466eb9674266c4) chore: upgrade [@​eslint/js](https://github.com/eslint/js)[@​8](https://github.com/8).57.0 ([#​18143](https://github.com/eslint/eslint/issues/18143)) (Milos Djermanovic) - [`5c356bb`](https://github.com/eslint/eslint/commit/5c356bb0c6f53c570224f8e9f02c4baca8fc6d2f) chore: package.json update for [@​eslint/js](https://github.com/eslint/js) release (Jenkins) - [`f4a1fe2`](https://github.com/eslint/eslint/commit/f4a1fe2e45aa1089fe775290bf530de82f34bf16) test: add more tests for ignoring files and directories ([#​18068](https://github.com/eslint/eslint/issues/18068)) (Nitin Kumar) - [`42c0aef`](https://github.com/eslint/eslint/commit/42c0aefaf6ea8b998b1c6db61906a79c046d301a) ci: Enable CI for `v8.x` branch ([#​18047](https://github.com/eslint/eslint/issues/18047)) (Milos Djermanovic)
--- ### 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/186 Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index 67204c9..df0e103 100644 --- a/package-lock.json +++ b/package-lock.json @@ -933,9 +933,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", - "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", + "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -956,13 +956,13 @@ "peer": true }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.13", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", - "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^2.0.1", - "debug": "^4.1.1", + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", "minimatch": "^3.0.5" }, "engines": { @@ -1028,9 +1028,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", - "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", + "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", "dev": true }, "node_modules/@isaacs/cliui": { @@ -4377,16 +4377,16 @@ } }, "node_modules/eslint": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", - "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", + "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.56.0", - "@humanwhocodes/config-array": "^0.11.13", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "@ungap/structured-clone": "^1.2.0", From 48f4bf095b03ab3a52aa12d9d4236697a495979e Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 25 Mar 2024 18:40:52 +0000 Subject: [PATCH 16/32] Update dependency @types/node to v20.11.30 (#188) 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.28` -> `20.11.30`](https://renovatebot.com/diffs/npm/@types%2fnode/20.11.28/20.11.30) | --- ### 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/188 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 df0e103..86e4241 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1900,9 +1900,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.11.28", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.28.tgz", - "integrity": "sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA==", + "version": "20.11.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.30.tgz", + "integrity": "sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==", "dependencies": { "undici-types": "~5.26.4" } From 94f285541b3d38e88f52d55a8abe244774db90b9 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 25 Mar 2024 18:42:21 +0000 Subject: [PATCH 17/32] Update dependency express to v4.19.1 (#189) 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 | |---|---|---|---| | [express](http://expressjs.com/) ([source](https://github.com/expressjs/express)) | dependencies | minor | [`4.18.3` -> `4.19.1`](https://renovatebot.com/diffs/npm/express/4.18.3/4.19.1) | --- ### Release Notes
expressjs/express (express) ### [`v4.19.1`](https://github.com/expressjs/express/blob/HEAD/History.md#4191--2024-03-20) [Compare Source](https://github.com/expressjs/express/compare/4.19.0...4.19.1) \========== - Allow passing non-strings to res.location with new encoding handling checks ### [`v4.19.0`](https://github.com/expressjs/express/blob/HEAD/History.md#4190--2024-03-20) [Compare Source](https://github.com/expressjs/express/compare/4.18.3...4.19.0) \========== - Prevent open redirect allow list bypass due to encodeurl - deps: cookie@0.6.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/189 Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 86e4241..a07c848 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3766,8 +3766,9 @@ "license": "MIT" }, "node_modules/cookie": { - "version": "0.5.0", - "license": "MIT", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", "engines": { "node": ">= 0.6" } @@ -4744,16 +4745,16 @@ } }, "node_modules/express": { - "version": "4.18.3", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.3.tgz", - "integrity": "sha512-6VyCijWQ+9O7WuVMTRBTl+cjNNIzD5cY5mQ1WM8r/LEkI2u8EYpOotESNwzNlyCn3g+dmjKYI6BmNneSr/FSRw==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.1.tgz", + "integrity": "sha512-K4w1/Bp7y8iSiVObmCrtq8Cs79XjJc/RU2YYkZQ7wpUu5ZyZ7MtPHkqoMz4pf+mgXfNvo2qft8D9OnrH2ABk9w==", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", From 16857ef14d9b82954cab8ff5326dc0498152fc01 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sun, 31 Mar 2024 15:49:30 +0100 Subject: [PATCH 18/32] Create series command (#190) # 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. - Create series list command to let users view all series in the bot - Create series view command to let users view cards in a specific series - Both commands have a paginated event so the embeds don't get too big #99 ## 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/190 Reviewed-by: VylpesTester Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- src/buttonEvents/Series.ts | 45 +++++++++++++++++ src/commands/series.ts | 71 ++++++++++++++++++++++++++ src/helpers/SeriesHelper.ts | 99 +++++++++++++++++++++++++++++++++++++ src/registry.ts | 4 ++ 4 files changed, 219 insertions(+) create mode 100644 src/buttonEvents/Series.ts create mode 100644 src/commands/series.ts create mode 100644 src/helpers/SeriesHelper.ts diff --git a/src/buttonEvents/Series.ts b/src/buttonEvents/Series.ts new file mode 100644 index 0000000..0d98bfb --- /dev/null +++ b/src/buttonEvents/Series.ts @@ -0,0 +1,45 @@ +import { ButtonInteraction } from "discord.js"; +import { ButtonEvent } from "../type/buttonEvent"; +import AppLogger from "../client/appLogger"; +import SeriesHelper from "../helpers/SeriesHelper"; + +export default class Series extends ButtonEvent { + public override async execute(interaction: ButtonInteraction) { + const subaction = interaction.customId.split(" ")[1]; + + switch(subaction) { + case "view": + await this.ViewSeries(interaction); + break; + case "list": + await this.ListSeries(interaction); + break; + default: + AppLogger.LogWarn("Commands/Series", `Subaction doesn't exist: ${subaction}`); + interaction.reply("Subaction doesn't exist."); + } + } + + private async ViewSeries(interaction: ButtonInteraction) { + const seriesid = interaction.customId.split(" ")[2]; + const page = interaction.customId.split(" ")[3]; + + const embed = SeriesHelper.GenerateSeriesViewPage(Number(seriesid), Number(page)); + + await interaction.update({ + embeds: [ embed!.embed ], + components: [ embed!.row ], + }); + } + + private async ListSeries(interaction: ButtonInteraction) { + const page = interaction.customId.split(" ")[2]; + + const embed = SeriesHelper.GenerateSeriesListPage(Number(page)); + + await interaction.update({ + embeds: [ embed!.embed ], + components: [ embed!.row ], + }); + } +} \ No newline at end of file diff --git a/src/commands/series.ts b/src/commands/series.ts new file mode 100644 index 0000000..2122355 --- /dev/null +++ b/src/commands/series.ts @@ -0,0 +1,71 @@ +import { CommandInteraction, SlashCommandBuilder } from "discord.js"; +import { Command } from "../type/command"; +import { CoreClient } from "../client/client"; +import AppLogger from "../client/appLogger"; +import SeriesHelper from "../helpers/SeriesHelper"; + +export default class Series extends Command { + constructor() { + super(); + + this.CommandBuilder = new SlashCommandBuilder() + .setName("series") + .setDescription("View details on a series") + .addSubcommand(x => + x + .setName("view") + .setDescription("View a specifiic series by id") + .addStringOption(y => + y + .setName("id") + .setDescription("The series id") + .setRequired(true))) + .addSubcommand(x => + x + .setName("list") + .setDescription("List all series")) as SlashCommandBuilder; + } + + public override async execute(interaction: CommandInteraction) { + if (!interaction.isChatInputCommand()) return; + + switch (interaction.options.getSubcommand()) { + case "view": + await this.ViewSeries(interaction); + break; + case "list": + await this.ListSeries(interaction); + break; + default: + AppLogger.LogWarn("Commands/Series", `Subcommand doesn't exist: ${interaction.options.getSubcommand()}`); + await interaction.reply("Subcommand doesn't exist."); + } + } + + private async ViewSeries(interaction: CommandInteraction) { + const id = interaction.options.get("id"); + + AppLogger.LogSilly("Commands/Series/View", `Parameters: id=${id?.value}`); + + if (!id) return; + + const series = CoreClient.Cards.find(x => x.id == id.value); + + if (!series) { + AppLogger.LogVerbose("Commands/Series/View", "Series not found."); + + await interaction.reply("Series not found."); + return; + } + + const embed = SeriesHelper.GenerateSeriesViewPage(series.id, 0); + + await interaction.reply({ embeds: [ embed!.embed ], components: [ embed!.row ]}); + } + + private async ListSeries(interaction: CommandInteraction) { + const embed = SeriesHelper.GenerateSeriesListPage(0); + + await interaction.reply({ embeds: [ embed!.embed ], components: [ embed!.row ]}); + } +} \ No newline at end of file diff --git a/src/helpers/SeriesHelper.ts b/src/helpers/SeriesHelper.ts new file mode 100644 index 0000000..32b1405 --- /dev/null +++ b/src/helpers/SeriesHelper.ts @@ -0,0 +1,99 @@ +import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js"; +import AppLogger from "../client/appLogger"; +import cloneDeep from "clone-deep"; +import { CoreClient } from "../client/client"; +import EmbedColours from "../constants/EmbedColours"; +import { CardRarityToString } from "../constants/CardRarity"; + +export default class SeriesHelper { + public static GenerateSeriesViewPage(seriesId: number, page: number): { embed: EmbedBuilder, row: ActionRowBuilder } | null { + AppLogger.LogSilly("Helpers/SeriesHelper", `Parameters: seriesId=${seriesId}, page=${page}`); + + const itemsPerPage = 15; + + const series = cloneDeep(CoreClient.Cards) + .find(x => x.id == seriesId); + + if (!series) { + AppLogger.LogVerbose("Helpers/SeriesHelper", `Unable to find series: ${seriesId}`); + return null; + } + + const totalPages = Math.ceil(series.cards.length / itemsPerPage); + + if (page > totalPages) { + AppLogger.LogVerbose("Helpers/SeriesHelper", `Trying to find page greater than what exists for this series. Page: ${page} but there are only ${totalPages} pages`); + return null; + } + + const cardsOnPage = series.cards.splice(page * itemsPerPage, itemsPerPage); + + const description = cardsOnPage + .map(x => `[${x.id}] ${x.name} ${CardRarityToString(x.type).toUpperCase()}`) + .join("\n"); + + const embed = new EmbedBuilder() + .setTitle(series.name) + .setColor(EmbedColours.Ok) + .setDescription(description) + .setFooter({ text: `${series.id} · ${series.cards.length} cards · Page ${page + 1} of ${totalPages}` }); + + const row = new ActionRowBuilder() + .addComponents( + new ButtonBuilder() + .setCustomId(`series view ${seriesId} ${page - 1}`) + .setLabel("Previous") + .setStyle(ButtonStyle.Primary) + .setDisabled(page == 0), + new ButtonBuilder() + .setCustomId(`series view ${seriesId} ${page + 1}`) + .setLabel("Next") + .setStyle(ButtonStyle.Primary) + .setDisabled(page + 1 > totalPages)); + + return { embed, row }; + } + + public static GenerateSeriesListPage(page: number): { embed: EmbedBuilder, row: ActionRowBuilder } | null { + AppLogger.LogSilly("Helpers/InventoryHelper", `Parameters: page=${page}`); + + const itemsPerPage = 15; + + const series = cloneDeep(CoreClient.Cards) + .sort((a, b) => a.id - b.id); + + const totalPages = Math.ceil(series.length / itemsPerPage); + + if (page > totalPages) { + AppLogger.LogVerbose("Helpers/SeriesHelper", `Trying to find page greater than what exists for this series. Page: ${page} but there are only ${totalPages} pages`); + return null; + } + + const seriesOnPage = series.splice(page * itemsPerPage, itemsPerPage); + + const description = seriesOnPage + .map(x => `[${x.id}] ${x.name}`) + .join("\n"); + + const embed = new EmbedBuilder() + .setTitle("Series") + .setColor(EmbedColours.Ok) + .setDescription(description) + .setFooter({ text: `${CoreClient.Cards.length} series · Page ${page + 1} of ${totalPages}` }); + + const row = new ActionRowBuilder() + .addComponents( + new ButtonBuilder() + .setCustomId(`series list ${page - 1}`) + .setLabel("Previous") + .setStyle(ButtonStyle.Primary) + .setDisabled(page == 0), + new ButtonBuilder() + .setCustomId(`series list ${page + 1}`) + .setLabel("Next") + .setStyle(ButtonStyle.Primary) + .setDisabled(page + 1 > totalPages)); + + return { embed, row }; + } +} \ No newline at end of file diff --git a/src/registry.ts b/src/registry.ts index 1087cda..bb68685 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 Series from "./commands/series"; import Trade from "./commands/trade"; import View from "./commands/view"; @@ -19,6 +20,7 @@ import Droprarity from "./commands/stage/droprarity"; import Claim from "./buttonEvents/Claim"; import InventoryButtonEvent from "./buttonEvents/Inventory"; import Reroll from "./buttonEvents/Reroll"; +import SeriesEvent from "./buttonEvents/Series"; import TradeButtonEvent from "./buttonEvents/Trade"; export default class Registry { @@ -30,6 +32,7 @@ export default class Registry { CoreClient.RegisterCommand("give", new Give()); CoreClient.RegisterCommand("inventory", new Inventory()); CoreClient.RegisterCommand("resync", new Resync()); + CoreClient.RegisterCommand("series", new Series()); CoreClient.RegisterCommand("trade", new Trade()); CoreClient.RegisterCommand("view", new View()); @@ -46,6 +49,7 @@ export default class Registry { CoreClient.RegisterButtonEvent("claim", new Claim()); CoreClient.RegisterButtonEvent("inventory", new InventoryButtonEvent()); CoreClient.RegisterButtonEvent("reroll", new Reroll()); + CoreClient.RegisterButtonEvent("series", new SeriesEvent()); CoreClient.RegisterButtonEvent("trade", new TradeButtonEvent()); } } \ No newline at end of file From c7b01c932e71f6101155f851377888128d7f5d22 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sun, 31 Mar 2024 15:51:10 +0100 Subject: [PATCH 19/32] Update claim event to increment the claimed number when the user claims a drop (#191) # 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 claim event to increment the claim number when the user claims a drop - Due to discord api limitations I can't reply to an interaction and edit the embed, so I've had to change it so the claimed by is displayed in the same embed - This also has the nice side effect of letting me disable the claim button as well #89 ## 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/191 Reviewed-by: VylpesTester Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- src/buttonEvents/Claim.ts | 31 +++++++++++++++++++++------ src/commands/give.ts | 6 +++--- src/helpers/CardDropHelperMetadata.ts | 30 ++++++++++++++++++++------ 3 files changed, 51 insertions(+), 16 deletions(-) diff --git a/src/buttonEvents/Claim.ts b/src/buttonEvents/Claim.ts index 53538f4..6c45900 100644 --- a/src/buttonEvents/Claim.ts +++ b/src/buttonEvents/Claim.ts @@ -1,9 +1,12 @@ -import { ButtonInteraction } from "discord.js"; +import { AttachmentBuilder, ButtonInteraction } from "discord.js"; import { ButtonEvent } from "../type/buttonEvent"; import Inventory from "../database/entities/app/Inventory"; import { CoreClient } from "../client/client"; import { default as eClaim } from "../database/entities/app/Claim"; import AppLogger from "../client/appLogger"; +import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata"; +import { readFileSync } from "fs"; +import path from "path"; export default class Claim extends ButtonEvent { public override async execute(interaction: ButtonInteraction) { @@ -16,17 +19,15 @@ export default class Claim extends ButtonEvent { AppLogger.LogSilly("Button/Claim", `Parameters: cardNumber=${cardNumber}, claimId=${claimId}, droppedBy=${droppedBy}, userId=${userId}`); - await interaction.deferReply(); - const claimed = await eClaim.FetchOneByClaimId(claimId); if (claimed) { - await interaction.editReply("This card has already been claimed"); + await interaction.reply("This card has already been claimed"); return; } if (claimId == CoreClient.ClaimId && userId != droppedBy) { - await interaction.editReply("The latest dropped card can only be claimed by the user who dropped it"); + await interaction.reply("The latest dropped card can only be claimed by the user who dropped it"); return; } @@ -45,6 +46,24 @@ export default class Claim extends ButtonEvent { await claim.Save(eClaim, claim); - await interaction.editReply(`Card claimed by ${interaction.user}`); + const card = CardDropHelperMetadata.GetCardByCardNumber(cardNumber); + + if (!card) { + return; + } + + const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", card.card.path)); + const imageFileName = card.card.path.split("/").pop()!; + + const attachment = new AttachmentBuilder(image, { name: imageFileName }); + + const embed = CardDropHelperMetadata.GenerateDropEmbed(card, inventory.Quantity, imageFileName, interaction.user.username); + const row = CardDropHelperMetadata.GenerateDropButtons(card, claimId, interaction.user.id, true); + + await interaction.update({ + embeds: [ embed ], + files: [ attachment ], + components: [ row ], + }); } } \ No newline at end of file diff --git a/src/commands/give.ts b/src/commands/give.ts index 5121dda..3656dc5 100644 --- a/src/commands/give.ts +++ b/src/commands/give.ts @@ -56,16 +56,16 @@ export default class Give extends Command { return; } - let inventory = await Inventory.FetchOneByCardNumberAndUserId(user.id, card.id); + let inventory = await Inventory.FetchOneByCardNumberAndUserId(user.id, card.card.id); if (!inventory) { - inventory = new Inventory(user.id, card.id, 1); + inventory = new Inventory(user.id, card.card.id, 1); } else { inventory.SetQuantity(inventory.Quantity + 1); } await inventory.Save(Inventory, inventory); - await interaction.reply(`${card.name} given to ${user.username}, they now have ${inventory.Quantity}`); + await interaction.reply(`${card.card.name} given to ${user.username}, they now have ${inventory.Quantity}`); } } \ No newline at end of file diff --git a/src/helpers/CardDropHelperMetadata.ts b/src/helpers/CardDropHelperMetadata.ts index 27a0d04..26a7731 100644 --- a/src/helpers/CardDropHelperMetadata.ts +++ b/src/helpers/CardDropHelperMetadata.ts @@ -1,7 +1,7 @@ import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js"; import { CardRarity, CardRarityToColour, CardRarityToString } from "../constants/CardRarity"; import CardRarityChances from "../constants/CardRarityChances"; -import { CardMetadata, DropResult } from "../contracts/SeriesMetadata"; +import { DropResult } from "../contracts/SeriesMetadata"; import { CoreClient } from "../client/client"; import AppLogger from "../client/appLogger"; @@ -56,25 +56,40 @@ export default class CardDropHelperMetadata { }; } - public static GetCardByCardNumber(cardNumber: string): CardMetadata | undefined { + public static GetCardByCardNumber(cardNumber: string): DropResult | undefined { AppLogger.LogSilly("CardDropHelperMetadata/GetCardByCardNumber", `Parameters: cardNumber=${cardNumber}`); const card = CoreClient.Cards .flatMap(x => x.cards) .find(x => x.id == cardNumber); - AppLogger.LogSilly("CardDropHelperMetadata/GetCardByCardNumber", `Card: ${card?.id} ${card?.name}`); + const series = CoreClient.Cards + .find(x => x.cards.find(y => y.id == card?.id)); - return card; + AppLogger.LogSilly("CardDropHelperMetadata/GetCardByCardNumber", `Card: ${card?.id} ${card?.name}`); + AppLogger.LogSilly("CardDropHelperMetadata/GetCardByCardNumber", `Series: ${series?.id} ${series?.name}`); + + if (!card || !series) { + AppLogger.LogVerbose("CardDropHelperMetadata/GetCardByCardNumber", `Unable to find card metadata: ${cardNumber}`); + return undefined; + } + + return { card, series }; } - public static GenerateDropEmbed(drop: DropResult, quantityClaimed: number, imageFileName: string): EmbedBuilder { + public static GenerateDropEmbed(drop: DropResult, quantityClaimed: number, imageFileName: string, claimedBy?: string): EmbedBuilder { AppLogger.LogSilly("CardDropHelperMetadata/GenerateDropEmbed", `Parameters: drop=${drop.card.id}, quantityClaimed=${quantityClaimed}, imageFileName=${imageFileName}`); let description = ""; description += `Series: ${drop.series.name}\n`; description += `Claimed: ${quantityClaimed}\n`; + if (claimedBy != null) { + description += `Claimed by: ${claimedBy}\n`; + } else { + description += "Claimed by: (UNCLAIMED)\n"; + } + return new EmbedBuilder() .setTitle(drop.card.name) .setDescription(description) @@ -83,7 +98,7 @@ export default class CardDropHelperMetadata { .setImage(`attachment://${imageFileName}`); } - public static GenerateDropButtons(drop: DropResult, claimId: string, userId: string): ActionRowBuilder { + public static GenerateDropButtons(drop: DropResult, claimId: string, userId: string, disabled: boolean = false): ActionRowBuilder { AppLogger.LogSilly("CardDropHelperMetadata/GenerateDropButtons", `Parameters: drop=${drop.card.id}, claimId=${claimId}, userId=${userId}`); return new ActionRowBuilder() @@ -91,7 +106,8 @@ export default class CardDropHelperMetadata { new ButtonBuilder() .setCustomId(`claim ${drop.card.id} ${claimId} ${userId}`) .setLabel("Claim") - .setStyle(ButtonStyle.Primary), + .setStyle(ButtonStyle.Primary) + .setDisabled(disabled), new ButtonBuilder() .setCustomId("reroll") .setLabel("Reroll") From b1d2daa8712f28ff1194136c87ef63789430cd2b Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 1 Apr 2024 18:03:49 +0100 Subject: [PATCH 20/32] Update dependency express to v4.19.2 (#192) 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 | |---|---|---|---| | [express](http://expressjs.com/) ([source](https://github.com/expressjs/express)) | dependencies | patch | [`4.19.1` -> `4.19.2`](https://renovatebot.com/diffs/npm/express/4.19.1/4.19.2) | --- ### Release Notes
expressjs/express (express) ### [`v4.19.2`](https://github.com/expressjs/express/blob/HEAD/History.md#4192--2024-03-25) [Compare Source](https://github.com/expressjs/express/compare/4.19.1...4.19.2) \========== - Improved fix for open redirect allow list bypass
--- ### 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/192 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 a07c848..9f3c7f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4745,9 +4745,9 @@ } }, "node_modules/express": { - "version": "4.19.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.19.1.tgz", - "integrity": "sha512-K4w1/Bp7y8iSiVObmCrtq8Cs79XjJc/RU2YYkZQ7wpUu5ZyZ7MtPHkqoMz4pf+mgXfNvo2qft8D9OnrH2ABk9w==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", From 5c905e3a8724e3ab42dc7d764bc5b480d986c36e Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 1 Apr 2024 18:04:59 +0100 Subject: [PATCH 21/32] Update dependency glob to v10.3.12 (#193) 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 | |---|---|---|---| | [glob](https://github.com/isaacs/node-glob) | dependencies | patch | [`10.3.10` -> `10.3.12`](https://renovatebot.com/diffs/npm/glob/10.3.10/10.3.12) | --- ### Release Notes
isaacs/node-glob (glob) ### [`v10.3.12`](https://github.com/isaacs/node-glob/compare/v10.3.11...v10.3.12) [Compare Source](https://github.com/isaacs/node-glob/compare/v10.3.11...v10.3.12) ### [`v10.3.11`](https://github.com/isaacs/node-glob/compare/v10.3.10...v10.3.11) [Compare Source](https://github.com/isaacs/node-glob/compare/v10.3.10...v10.3.11)
--- ### 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/193 Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9f3c7f5..77c59dc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5139,15 +5139,15 @@ "license": "MIT" }, "node_modules/glob": { - "version": "10.3.10", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", - "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "version": "10.3.12", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.12.tgz", + "integrity": "sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg==", "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^2.3.5", + "jackspeak": "^2.3.6", "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" + "minipass": "^7.0.4", + "path-scurry": "^1.10.2" }, "bin": { "glob": "dist/esm/bin.mjs" @@ -9318,11 +9318,11 @@ "license": "MIT" }, "node_modules/path-scurry": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", - "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.2.tgz", + "integrity": "sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA==", "dependencies": { - "lru-cache": "^9.1.1 || ^10.0.0", + "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { @@ -9333,9 +9333,9 @@ } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.1.0.tgz", - "integrity": "sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz", + "integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==", "engines": { "node": "14 || >=16.14" } From b14fac2c582a9b73d93e5d81404aaba2adc2b22d Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 8 Apr 2024 15:10:40 +0100 Subject: [PATCH 22/32] Update dependency minimatch to v9.0.4 (#195) 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 | |---|---|---|---| | [minimatch](https://github.com/isaacs/minimatch) | dependencies | patch | [`9.0.3` -> `9.0.4`](https://renovatebot.com/diffs/npm/minimatch/9.0.3/9.0.4) | --- ### Release Notes
isaacs/minimatch (minimatch) ### [`v9.0.4`](https://github.com/isaacs/minimatch/compare/v9.0.3...v9.0.4) [Compare Source](https://github.com/isaacs/minimatch/compare/v9.0.3...v9.0.4)
--- ### 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/195 Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 22 +++++++++++++++++++--- package.json | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 77c59dc..04015e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "glob": "^10.3.10", "jest": "^29.0.0", "jest-mock-extended": "^3.0.0", - "minimatch": "9.0.3", + "minimatch": "9.0.4", "mysql": "^2.18.1", "ts-jest": "^29.0.0", "typeorm": "0.3.20", @@ -2241,6 +2241,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/typescript-estree/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -7868,8 +7883,9 @@ } }, "node_modules/minimatch": { - "version": "9.0.3", - "license": "ISC", + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", "dependencies": { "brace-expansion": "^2.0.1" }, diff --git a/package.json b/package.json index 3f77778..178f288 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "glob": "^10.3.10", "jest": "^29.0.0", "jest-mock-extended": "^3.0.0", - "minimatch": "9.0.3", + "minimatch": "9.0.4", "mysql": "^2.18.1", "ts-jest": "^29.0.0", "typeorm": "0.3.20", From cda41d87c37374567cbb639cafaa800c10e4069e Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 8 Apr 2024 15:12:50 +0100 Subject: [PATCH 23/32] Update dependency @types/node to v20.12.5 (#196) 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.11.30` -> `20.12.5`](https://renovatebot.com/diffs/npm/@types%2fnode/20.11.30/20.12.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/196 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 04015e1..17b3964 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1900,9 +1900,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.11.30", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.30.tgz", - "integrity": "sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==", + "version": "20.12.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.5.tgz", + "integrity": "sha512-BD+BjQ9LS/D8ST9p5uqBxghlN+S42iuNxjsUGjeZobe/ciXzk2qb1B6IXc6AnRLS+yFJRpN2IPEHMzwspfDJNw==", "dependencies": { "undici-types": "~5.26.4" } From 22cd98f229f58770703d65451b40f14c659c3614 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 16 Apr 2024 18:16:09 +0100 Subject: [PATCH 24/32] Update dependency @types/node to v20.12.7 (#207) 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.12.5` -> `20.12.7`](https://renovatebot.com/diffs/npm/@types%2fnode/20.12.5/20.12.7) | --- ### 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/207 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 17b3964..5aa7c90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1900,9 +1900,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.12.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.5.tgz", - "integrity": "sha512-BD+BjQ9LS/D8ST9p5uqBxghlN+S42iuNxjsUGjeZobe/ciXzk2qb1B6IXc6AnRLS+yFJRpN2IPEHMzwspfDJNw==", + "version": "20.12.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.7.tgz", + "integrity": "sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==", "dependencies": { "undici-types": "~5.26.4" } From bcbd0855b8e80dcb07851f531d01a812dc8503fb Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 16 Apr 2024 18:17:26 +0100 Subject: [PATCH 25/32] Update dependency jest-mock-extended to v3.0.6 (#208) 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 | |---|---|---|---| | [jest-mock-extended](https://github.com/marchaos/jest-mock-extended) | dependencies | patch | [`3.0.5` -> `3.0.6`](https://renovatebot.com/diffs/npm/jest-mock-extended/3.0.5/3.0.6) | --- ### Release Notes
marchaos/jest-mock-extended (jest-mock-extended) ### [`v3.0.6`](https://github.com/marchaos/jest-mock-extended/compare/3.0.5...77a64ae8328904bcc614ead4ba8d0d9e8a658136) [Compare Source](https://github.com/marchaos/jest-mock-extended/compare/3.0.5...77a64ae8328904bcc614ead4ba8d0d9e8a658136)
--- ### 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/208 Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5aa7c90..3dcf1a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6816,10 +6816,11 @@ } }, "node_modules/jest-mock-extended": { - "version": "3.0.5", - "license": "MIT", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/jest-mock-extended/-/jest-mock-extended-3.0.6.tgz", + "integrity": "sha512-DJuEoFzio0loqdX8NIwkbE9dgIXNzaj//pefOQxGkoivohpxbSQeNHCAiXkDNA/fmM4EIJDoZnSibP4w3dUJ9g==", "dependencies": { - "ts-essentials": "^7.0.3" + "ts-essentials": "^9.4.2" }, "peerDependencies": { "jest": "^24.0.0 || ^25.0.0 || ^26.0.0 || ^27.0.0 || ^28.0.0 || ^29.0.0", @@ -10846,10 +10847,16 @@ } }, "node_modules/ts-essentials": { - "version": "7.0.3", - "license": "MIT", + "version": "9.4.2", + "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-9.4.2.tgz", + "integrity": "sha512-mB/cDhOvD7pg3YCLk2rOtejHjjdSi9in/IBYE13S+8WA5FBSraYf4V/ws55uvs0IvQ/l0wBOlXy5yBNZ9Bl8ZQ==", "peerDependencies": { - "typescript": ">=3.7.0" + "typescript": ">=4.1.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/ts-jest": { From 14929b1aed6ee74cb599cea2b16ad11002b4b9ac Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 23 Apr 2024 19:36:46 +0100 Subject: [PATCH 26/32] Update dependency typescript to v5.4.5 (#211) 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](https://www.typescriptlang.org/) ([source](https://github.com/Microsoft/TypeScript)) | devDependencies | minor | [`5.3.3` -> `5.4.5`](https://renovatebot.com/diffs/npm/typescript/5.3.3/5.4.5) | --- ### Release Notes
Microsoft/TypeScript (typescript) ### [`v5.4.5`](https://github.com/microsoft/TypeScript/releases/tag/v5.4.5): TypeScript 5.4.5 [Compare Source](https://github.com/Microsoft/TypeScript/compare/v5.4.4...v5.4.5) For release notes, check out the [release announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-4/). For the complete list of fixed issues, check out the - [fixed issues query for Typescript 5.4.0 (Beta)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.0%22+is%3Aclosed+). - [fixed issues query for Typescript 5.4.1 (RC)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.1%22+is%3Aclosed+). - [fixed issues query for Typescript 5.4.2 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.2%22+is%3Aclosed+). - [fixed issues query for Typescript 5.4.3 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.3%22+is%3Aclosed+). - [fixed issues query for Typescript 5.4.4 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.4%22+is%3Aclosed+). - [fixed issues query for Typescript 5.4.5 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.5%22+is%3Aclosed+). Downloads are available on: - [NuGet package](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild) ### [`v5.4.4`](https://github.com/microsoft/TypeScript/releases/tag/v5.4.4): TypeScript 5.4.4 [Compare Source](https://github.com/Microsoft/TypeScript/compare/v5.4.3...v5.4.4) For release notes, check out the [release announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-4/). For the complete list of fixed issues, check out the - [fixed issues query for Typescript 5.4.0 (Beta)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.0%22+is%3Aclosed+). - [fixed issues query for Typescript 5.4.1 (RC)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.1%22+is%3Aclosed+). - [fixed issues query for Typescript 5.4.2 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.2%22+is%3Aclosed+). - [fixed issues query for Typescript 5.4.3 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.3%22+is%3Aclosed+). - [fixed issues query for Typescript 5.4.4 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.4%22+is%3Aclosed+). Downloads are available on: - [NuGet package](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild) ### [`v5.4.3`](https://github.com/microsoft/TypeScript/releases/tag/v5.4.3): TypeScript 5.4.3 [Compare Source](https://github.com/Microsoft/TypeScript/compare/v5.4.2...v5.4.3) For release notes, check out the [release announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-4/). For the complete list of fixed issues, check out the - [fixed issues query for Typescript 5.4.0 (Beta)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.0%22+is%3Aclosed+). - [fixed issues query for Typescript 5.4.1 (RC)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.1%22+is%3Aclosed+). - [fixed issues query for Typescript 5.4.2 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.2%22+is%3Aclosed+). - [fixed issues query for Typescript 5.4.3 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.3%22+is%3Aclosed+). Downloads are available on: - [NuGet package](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild) ### [`v5.4.2`](https://github.com/microsoft/TypeScript/releases/tag/v5.4.2): TypeScript 5.4 [Compare Source](https://github.com/Microsoft/TypeScript/compare/v5.3.3...v5.4.2) For release notes, check out the [release announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-4/). For the complete list of fixed issues, check out the - [fixed issues query for Typescript 5.4.0 (Beta)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.0%22+is%3Aclosed+). - [fixed issues query for Typescript 5.4.1 (RC)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.1%22+is%3Aclosed+). - [fixed issues query for Typescript 5.4.2 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.4.2%22+is%3Aclosed+). Downloads are available on: - [NuGet package](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild)
--- ### 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/211 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 3dcf1a8..d4416f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11107,9 +11107,9 @@ } }, "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" From ea9c8c5247b7926a8c7e8161b7a97b1df99151a5 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Tue, 23 Apr 2024 19:42:33 +0100 Subject: [PATCH 27/32] Update woodpecker config to use new ip --- .woodpecker.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 30ac056..f42ba60 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -28,8 +28,8 @@ steps: - 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 + - rsync -e "ssh -o StrictHostKeyChecking=no" -r ./* vylpes@192.168.1.115:/home/vylpes/apps/card-drop/card-drop_stage + - ssh vylpes@192.168.1.115 BOT_TOKEN='$${stage_bot_token}' 'bash -s' < ./scripts/deploy_stage.sh when: event: push branch: [ develop ] @@ -40,8 +40,8 @@ steps: - 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 + - rsync -e "ssh -o StrictHostKeyChecking=no" -r ./* vylpes@192.168.1.115:/home/vylpes/apps/card-drop/card-drop_prod + - ssh vylpes@192.168.1.115 BOT_TOKEN='$${prod_bot_token}' 'bash -s' < ./scripts/deploy_prod.sh when: event: push branch: [ main ] \ No newline at end of file From 8aa4fc340af178b8e76123591252977a41488327 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 23 Apr 2024 19:47:13 +0100 Subject: [PATCH 28/32] Update dependency winston to v3.13.0 (#212) 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 | |---|---|---|---| | [winston](https://github.com/winstonjs/winston) | dependencies | minor | [`3.11.0` -> `3.13.0`](https://renovatebot.com/diffs/npm/winston/3.11.0/3.13.0) | --- ### Release Notes
winstonjs/winston (winston) ### [`v3.13.0`](https://github.com/winstonjs/winston/releases/tag/v3.13.0) [Compare Source](https://github.com/winstonjs/winston/compare/v3.12.1...v3.13.0) - fix(http): allow passing maximumDepth to prevent big object being stringified ([#​2425](https://github.com/winstonjs/winston/issues/2425)) [`a237865`](https://github.com/winstonjs/winston/commit/a237865) ### [`v3.12.1`](https://github.com/winstonjs/winston/releases/tag/v3.12.1) [Compare Source](https://github.com/winstonjs/winston/compare/v3.12.0...v3.12.1) - Bump [@​types/node](https://github.com/types/node) from 20.11.24 to 20.11.29 ([#​2431](https://github.com/winstonjs/winston/issues/2431)) [`b10b98f`](https://github.com/winstonjs/winston/commit/b10b98f) - Revert "Remove nonexistent Logger methods from types" ([#​2434](https://github.com/winstonjs/winston/issues/2434)) [`0277035`](https://github.com/winstonjs/winston/commit/0277035) - fixed flaky test case ([#​2412](https://github.com/winstonjs/winston/issues/2412)) [`d95c948`](https://github.com/winstonjs/winston/commit/d95c948) ### [`v3.12.0`](https://github.com/winstonjs/winston/releases/tag/v3.12.0) [Compare Source](https://github.com/winstonjs/winston/compare/v3.11.0...v3.12.0) - missing timestamp format in ready-to-use-pattern example ([#​2421](https://github.com/winstonjs/winston/issues/2421)) [`9e5b407`](https://github.com/winstonjs/winston/commit/9e5b407) - bump deps ([#​2422](https://github.com/winstonjs/winston/issues/2422)) [`4a85e6b`](https://github.com/winstonjs/winston/commit/4a85e6b) - \[chore] Run coveralls CI check on Node 20 not 16 ([#​2418](https://github.com/winstonjs/winston/issues/2418)) [`e153c68`](https://github.com/winstonjs/winston/commit/e153c68) - Bump [@​types/node](https://github.com/types/node) from 20.8.6 to 20.11.19 ([#​2413](https://github.com/winstonjs/winston/issues/2413)) [`587f40f`](https://github.com/winstonjs/winston/commit/587f40f) - Update README.md ([#​2417](https://github.com/winstonjs/winston/issues/2417)) [`8e99a00`](https://github.com/winstonjs/winston/commit/8e99a00) - docs: fix anchor in transports docs ([#​2416](https://github.com/winstonjs/winston/issues/2416)) [`0bde36b`](https://github.com/winstonjs/winston/commit/0bde36b) - add winston-transport-vscode to transports docs ([#​2411](https://github.com/winstonjs/winston/issues/2411)) [`8fb5b41`](https://github.com/winstonjs/winston/commit/8fb5b41) - Bump [@​babel/cli](https://github.com/babel/cli) from 7.23.0 to 7.23.9 ([#​2406](https://github.com/winstonjs/winston/issues/2406)) [`a326743`](https://github.com/winstonjs/winston/commit/a326743) - Add winston-newrelic-agent-transport to transport documentation ([#​2382](https://github.com/winstonjs/winston/issues/2382)) [`cc731ef`](https://github.com/winstonjs/winston/commit/cc731ef) - Remove newrelic-winston transport entry. ([#​2405](https://github.com/winstonjs/winston/issues/2405)) [`f077f30`](https://github.com/winstonjs/winston/commit/f077f30) - Bump eslint from 8.55.0 to 8.56.0 ([#​2397](https://github.com/winstonjs/winston/issues/2397)) [`3943c41`](https://github.com/winstonjs/winston/commit/3943c41) - Bump the npm_and_yarn group group with 1 update ([#​2391](https://github.com/winstonjs/winston/issues/2391)) [`8260866`](https://github.com/winstonjs/winston/commit/8260866) - Fix unhandled rejection handling ([#​2390](https://github.com/winstonjs/winston/issues/2390)) [`333b763`](https://github.com/winstonjs/winston/commit/333b763) - Fix all rimraf usages to the best of my ability; glob is not true by default in rimraf; file archive test only passed every other time using async rimraf, could use further investigation [`c3f3b5b`](https://github.com/winstonjs/winston/commit/c3f3b5b) - Fix rimraf usage in new test [`8f3c653`](https://github.com/winstonjs/winston/commit/8f3c653) - Fix rimraf import in test (why didn't this break in PR CI?) [`f3836aa`](https://github.com/winstonjs/winston/commit/f3836aa) - Added functionality to long broken zippedArchive option ([#​2337](https://github.com/winstonjs/winston/issues/2337)) [`02d4267`](https://github.com/winstonjs/winston/commit/02d4267) - Bump async from 3.2.4 to 3.2.5 ([#​2378](https://github.com/winstonjs/winston/issues/2378)) [`069a40d`](https://github.com/winstonjs/winston/commit/069a40d) - Bump [@​babel/preset-env](https://github.com/babel/preset-env) from 7.23.2 to 7.23.7 ([#​2384](https://github.com/winstonjs/winston/issues/2384)) [`79282e1`](https://github.com/winstonjs/winston/commit/79282e1) - Bump winston-transport; fix test issue ([#​2386](https://github.com/winstonjs/winston/issues/2386)) [`05788b9`](https://github.com/winstonjs/winston/commit/05788b9) - Bump eslint from 8.51.0 to 8.55.0 ([#​2375](https://github.com/winstonjs/winston/issues/2375)) [`a7c2eec`](https://github.com/winstonjs/winston/commit/a7c2eec) - Bump std-mocks from 1.0.1 to 2.0.0 ([#​2361](https://github.com/winstonjs/winston/issues/2361)) [`85c336e`](https://github.com/winstonjs/winston/commit/85c336e) - Bump actions/setup-node from 3 to 4 ([#​2362](https://github.com/winstonjs/winston/issues/2362)) [`448d11c`](https://github.com/winstonjs/winston/commit/448d11c) - chore(README.md): adds documentation around coloring json formatted logs [`91ec069`](https://github.com/winstonjs/winston/commit/91ec069) - Remove nonexistent Logger methods from types [`c3c3911`](https://github.com/winstonjs/winston/commit/c3c3911) - Update dependencies [`caf2df6`](https://github.com/winstonjs/winston/commit/caf2df6)
--- ### 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/212 Reviewed-by: Vylpes Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index d4416f1..e93e59f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11429,9 +11429,9 @@ } }, "node_modules/winston": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/winston/-/winston-3.11.0.tgz", - "integrity": "sha512-L3yR6/MzZAOl0DsysUXHVjOwv8mKZ71TrA/41EIduGpOOV5LQVodqN+QdQ6BS6PJ/RdIshZhq84P/fStEZkk7g==", + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.13.0.tgz", + "integrity": "sha512-rwidmA1w3SE4j0E5MuIufFhyJPBDG7Nu71RkZor1p2+qHvJSZ9GYDA81AyleQcZbh/+V6HjeBdfnTZJm9rSeQQ==", "dependencies": { "@colors/colors": "^1.6.0", "@dabh/diagnostics": "^2.0.2", @@ -11443,7 +11443,7 @@ "safe-stable-stringify": "^2.3.1", "stack-trace": "0.0.x", "triple-beam": "^1.3.0", - "winston-transport": "^4.5.0" + "winston-transport": "^4.7.0" }, "engines": { "node": ">= 12.0.0" From 2bce901d63de491f42e3aa75b1a3617e12c22394 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Fri, 26 Apr 2024 18:35:03 +0100 Subject: [PATCH 29/32] Create concept of currency in the database (#209) # 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. - Create the concept of currency in the database #200 ## 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/209 Reviewed-by: VylpesTester Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- .../1713289062969-user/Up/01-table/User.sql | 7 +++++++ src/database/entities/app/User.ts | 19 +++++++++++++++++++ .../migrations/app/0.6/1713289062969-user.ts | 15 +++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 database/0.6/1713289062969-user/Up/01-table/User.sql create mode 100644 src/database/entities/app/User.ts create mode 100644 src/database/migrations/app/0.6/1713289062969-user.ts diff --git a/database/0.6/1713289062969-user/Up/01-table/User.sql b/database/0.6/1713289062969-user/Up/01-table/User.sql new file mode 100644 index 0000000..86a5d36 --- /dev/null +++ b/database/0.6/1713289062969-user/Up/01-table/User.sql @@ -0,0 +1,7 @@ +CREATE TABLE `user` ( + `Id` varchar(255) NOT NULL, + `WhenCreated` datetime NOT NULL, + `WhenUpdated` datetime NOT NULL, + `Currency` int NOT NULL, + PRIMARY KEY (`Id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; \ No newline at end of file diff --git a/src/database/entities/app/User.ts b/src/database/entities/app/User.ts new file mode 100644 index 0000000..c954aea --- /dev/null +++ b/src/database/entities/app/User.ts @@ -0,0 +1,19 @@ +import { Column, Entity } from "typeorm"; +import AppBaseEntity from "../../../contracts/AppBaseEntity"; + +@Entity() +export default class User extends AppBaseEntity { + constructor(userId: string, currency: number) { + super(); + + this.Id = userId; + this.Currency = currency; + } + + @Column() + Currency: number; + + public UpdateCurrency(currency: number) { + this.Currency = currency; + } +} \ No newline at end of file diff --git a/src/database/migrations/app/0.6/1713289062969-user.ts b/src/database/migrations/app/0.6/1713289062969-user.ts new file mode 100644 index 0000000..151db88 --- /dev/null +++ b/src/database/migrations/app/0.6/1713289062969-user.ts @@ -0,0 +1,15 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; +import MigrationHelper from "../../../../helpers/MigrationHelper"; + +export class User1713289062969 implements MigrationInterface { + + public async up(queryRunner: QueryRunner): Promise { + MigrationHelper.Up("1713289062969-user", "0.6", [ + "01-table/User", + ], queryRunner); + } + + public async down(): Promise { + } + +} From ed42ceaca40378a9b3580c06299f08085f9f7530 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sun, 28 Apr 2024 17:34:42 +0100 Subject: [PATCH 30/32] Migrate to forgejo runner --- .dev.env => .env.example | 20 ++++----- .forgejo/workflows/production.yml | 70 +++++++++++++++++++++++++++++++ .forgejo/workflows/stage.yml | 70 +++++++++++++++++++++++++++++++ .forgejo/workflows/test.yml | 24 +++++++++++ .prod.env | 35 ---------------- .stage.env | 35 ---------------- docker-compose.prod.yml | 31 -------------- docker-compose.stage.yml | 31 -------------- docker-compose.yml | 28 ++++--------- 9 files changed, 181 insertions(+), 163 deletions(-) rename .dev.env => .env.example (76%) create mode 100644 .forgejo/workflows/production.yml create mode 100644 .forgejo/workflows/stage.yml create mode 100644 .forgejo/workflows/test.yml delete mode 100644 .prod.env delete mode 100644 .stage.env delete mode 100644 docker-compose.prod.yml delete mode 100644 docker-compose.stage.yml diff --git a/.dev.env b/.env.example similarity index 76% rename from .dev.env rename to .env.example index aa54d10..3ff53e9 100644 --- a/.dev.env +++ b/.env.example @@ -7,12 +7,11 @@ # any secret values. BOT_TOKEN= -BOT_VER=0.5.1 +BOT_VER=0.5.0 BOT_AUTHOR=Vylpes BOT_OWNERID=147392775707426816 BOT_CLIENTID=682942374040961060 BOT_ENV=4 -BOT_LOGLEVEL=info BOT_ADMINS=147392775707426816,887272961504071690 ABOUT_FUNDING= @@ -20,16 +19,17 @@ ABOUT_REPO= DATA_DIR= -DB_HOST=127.0.0.1 -DB_PORT=3301 -DB_NAME=carddrop -DB_AUTH_USER=dev -DB_AUTH_PASS=dev -DB_SYNC=true -DB_LOGGING=true +DB_HOST= +DB_PORT= +DB_NAME= +DB_AUTH_USER= +DB_AUTH_PASS= +DB_SYNC= +DB_LOGGING= +DB_DATA_LOCATION=~/.docker DB_CARD_FILE=:memory: EXPRESS_PORT=3303 -GDRIVESYNC_AUTO=true +GDRIVESYNC_AUTO=true \ No newline at end of file diff --git a/.forgejo/workflows/production.yml b/.forgejo/workflows/production.yml new file mode 100644 index 0000000..8291098 --- /dev/null +++ b/.forgejo/workflows/production.yml @@ -0,0 +1,70 @@ +name: Deploy To Production + +on: + push: + branches: + - main + +jobs: + build: + environment: prod + + runs-on: docker + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: 18.x + - run: npm ci + - run: npm run build + - run: npm test + + - name: "Copy files over to location" + run: cp -r . ${{ secrets.PROD_REPO_PATH }} + + deploy: + environment: prod + needs: build + runs-on: docker + steps: + - uses: https://github.com/appleboy/ssh-action@v1.0.0 + env: + DB_NAME: ${{ secrets.PROD_DB_NAME }} + DB_AUTH_USER: ${{ secrets.PROD_DB_AUTH_USER }} + DB_AUTH_PASS: ${{ secrets.PROD_DB_AUTH_PASS }} + DB_HOST: ${{ secrets.PROD_DB_HOST }} + DB_PORT: ${{ secrets.PROD_DB_PORT }} + DB_ROOT_HOST: ${{ secrets.PROD_DB_ROOT_HOST }} + DB_SYNC: ${{ secrets.PROD_DB_SYNC }} + DB_LOGGING: ${{ secrets.PROD_DB_LOGGING }} + DB_DATA_LOCATION: ${{ secrets.PROD_DB_DATA_LOCATION }} + SERVER_PATH: ${{ secrets.PROD_SSH_SERVER_PATH }} + BOT_TOKEN: ${{ secrets.PROD_BOT_TOKEN }} + BOT_VER: ${{ vars.PROD_BOT_VER }} + BOT_AUTHOR: ${{ vars.PROD_BOT_AUTHOR }} + BOT_OWNERID: ${{ vars.PROD_BOT_OWNERID }} + BOT_CLIENTID: ${{ vars.PROD_BOT_CLIENTID }} + BOT_ENV: ${{ vars.PROD_BOT_ENV }} + BOT_ADMINS: ${{ vars.PROD_BOT_ADMINS }} + ABOUT_FUNDING: ${{ vars.PROD_ABOUT_FUNDING }} + ABOUT_REPO: ${{ vars.PROD_ABOUT_REPO }} + DATA_DIR: ${{ secrets.PROD_DATA_DIR }} + GDRIVESYNC_AUTO: ${{ vars.PROD_GDRIVESYNC_AUTO }} + EXPRESS_PORT: ${{ secrets.PROD_EXPRESS_PORT }} + with: + host: ${{ secrets.PROD_SSH_HOST }} + username: ${{ secrets.PROD_SSH_USER }} + key: ${{ secrets.PROD_SSH_KEY }} + port: ${{ secrets.PROD_SSH_PORT }} + envs: DB_NAME,DB_AUTH_USER,DB_AUTH_PASS,DB_HOST,DB_PORT,DB_ROOT_HOST,DB_SYNC,DB_LOGGING,DB_DATA_LOCATION,BOT_TOKEN,BOT_VER,BOT_AUTHOR,BOT_OWNERID,BOT_CLIENTID,ABOUT_FUNDING,ABOUT_REPO,BOT_ENV,BOT_ADMINS,DATA_DIR,GDRIVESYNC_AUTO,SERVER_PATH,EXPRESS_PORT + script: | + cd /home/vylpes/apps/card-drop/card-drop_prod \ + && docker compose down \ + && (pm2 stop card-drop_prod || true) \ + && (pm2 delete card-drop_prod || true) \ + && docker compose up -d \ + && sleep 10 \ + && yarn run db:up \ + && pm2 start --name card-drop_prod dist/bot.js \ No newline at end of file diff --git a/.forgejo/workflows/stage.yml b/.forgejo/workflows/stage.yml new file mode 100644 index 0000000..8e222be --- /dev/null +++ b/.forgejo/workflows/stage.yml @@ -0,0 +1,70 @@ +name: Deploy To Stage + +on: + push: + branches: + - develop + +jobs: + build: + environment: stage + + runs-on: docker + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: 18.x + - run: npm ci + - run: npm run build + - run: npm test + + - name: "Copy files over to location" + run: cp -r . ${{ secrets.STAGE_REPO_PATH }} + + deploy: + environment: prod + needs: build + runs-on: docker + steps: + - uses: https://github.com/appleboy/ssh-action@v1.0.0 + env: + DB_NAME: ${{ secrets.STAGE_DB_NAME }} + DB_AUTH_USER: ${{ secrets.STAGE_DB_AUTH_USER }} + DB_AUTH_PASS: ${{ secrets.STAGE_DB_AUTH_PASS }} + DB_HOST: ${{ secrets.STAGE_DB_HOST }} + DB_PORT: ${{ secrets.STAGE_DB_PORT }} + DB_ROOT_HOST: ${{ secrets.STAGE_DB_ROOT_HOST }} + DB_SYNC: ${{ secrets.STAGE_DB_SYNC }} + DB_LOGGING: ${{ secrets.STAGE_DB_LOGGING }} + DB_DATA_LOCATION: ${{ secrets.STAGE_DB_DATA_LOCATION }} + SERVER_PATH: ${{ secrets.STAGE_SSH_SERVER_PATH }} + BOT_TOKEN: ${{ secrets.STAGE_BOT_TOKEN }} + BOT_VER: ${{ vars.STAGE_BOT_VER }} + BOT_AUTHOR: ${{ vars.STAGE_BOT_AUTHOR }} + BOT_OWNERID: ${{ vars.STAGE_BOT_OWNERID }} + BOT_CLIENTID: ${{ vars.STAGE_BOT_CLIENTID }} + BOT_ENV: ${{ vars.STAGE_BOT_ENV }} + BOT_ADMINS: ${{ vars.STAGE_BOT_ADMINS }} + ABOUT_FUNDING: ${{ vars.STAGE_ABOUT_FUNDING }} + ABOUT_REPO: ${{ vars.STAGE_ABOUT_REPO }} + DATA_DIR: ${{ secrets.STAGE_DATA_DIR }} + GDRIVESYNC_AUTO: ${{ vars.STAGE_GDRIVESYNC_AUTO }} + EXPRESS_PORT: ${{ secrets.STAGE_EXPRESS_PORT }} + with: + host: ${{ secrets.STAGE_SSH_HOST }} + username: ${{ secrets.STAGE_SSH_USER }} + key: ${{ secrets.STAGE_SSH_KEY }} + port: ${{ secrets.STAGE_SSH_PORT }} + envs: DB_NAME,DB_AUTH_USER,DB_AUTH_PASS,DB_HOST,DB_PORT,DB_ROOT_HOST,DB_SYNC,DB_LOGGING,DB_DATA_LOCATION,BOT_TOKEN,BOT_VER,BOT_AUTHOR,BOT_OWNERID,BOT_CLIENTID,ABOUT_FUNDING,ABOUT_REPO,BOT_ENV,BOT_ADMINS,DATA_DIR,GDRIVESYNC_AUTO,SERVER_PATH,EXPRESS_PORT + script: | + cd /home/vylpes/apps/card-drop/card-drop_stage \ + && docker compose down \ + && (pm2 stop card-drop_stage || true) \ + && (pm2 delete card-drop_stage || true) \ + && docker compose up -d \ + && sleep 10 \ + && yarn run db:up \ + && pm2 start --name card-drop_stage dist/bot.js \ No newline at end of file diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml new file mode 100644 index 0000000..989ac4f --- /dev/null +++ b/.forgejo/workflows/test.yml @@ -0,0 +1,24 @@ +name: Test + +on: + push: + branches: + - feature/* + - hotfix/* + - renovate/* + +jobs: + build: + environment: stage + + runs-on: node + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: 18.x + - run: npm ci + - run: npm run build + - run: npm test \ No newline at end of file diff --git a/.prod.env b/.prod.env deleted file mode 100644 index 80de62d..0000000 --- a/.prod.env +++ /dev/null @@ -1,35 +0,0 @@ -# Security Warning! Do not commit this file to any VCS! -# This is a local file to speed up development process, -# so you don't have to change your environment variables. -# -# This is not applied to `.env.template`! -# Template files must be committed to the VCS, but must not contain -# any secret values. - -BOT_TOKEN= -BOT_VER=0.5.1 -BOT_AUTHOR=Vylpes -BOT_OWNERID=147392775707426816 -BOT_CLIENTID=1093810443589529631 -BOT_ENV=1 -BOT_LOGLEVEL=info -BOT_ADMINS=147392775707426816,887272961504071690 - -ABOUT_FUNDING= -ABOUT_REPO= - -DATA_DIR=/home/vylpes/appdata/card-drop/card-drop_prod - -DB_HOST=127.0.0.1 -DB_PORT=3321 -DB_NAME=carddrop -DB_AUTH_USER=prod -DB_AUTH_PASS=prod -DB_SYNC=false -DB_LOGGING=false - -DB_CARD_FILE=:memory: - -EXPRESS_PORT=3323 - -GDRIVESYNC_AUTO=false diff --git a/.stage.env b/.stage.env deleted file mode 100644 index 09120c1..0000000 --- a/.stage.env +++ /dev/null @@ -1,35 +0,0 @@ -# Security Warning! Do not commit this file to any VCS! -# This is a local file to speed up development process, -# so you don't have to change your environment variables. -# -# This is not applied to `.env.template`! -# Template files must be committed to the VCS, but must not contain -# any secret values. - -BOT_TOKEN= -BOT_VER=0.5.1 -BOT_AUTHOR=Vylpes -BOT_OWNERID=147392775707426816 -BOT_CLIENTID=1147976642942214235 -BOT_ENV=2 -BOT_LOGLEVEL=info -BOT_ADMINS=147392775707426816,887272961504071690 - -ABOUT_FUNDING= -ABOUT_REPO= - -DATA_DIR=/home/vylpes/appdata/card-drop/card-drop_stage - -DB_HOST=127.0.0.1 -DB_PORT=3311 -DB_NAME=carddrop -DB_AUTH_USER=stage -DB_AUTH_PASS=stage -DB_SYNC=false -DB_LOGGING=false - -DB_CARD_FILE=:memory: - -EXPRESS_PORT=3313 - -GDRIVESYNC_AUTO=false diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml deleted file mode 100644 index faac7fb..0000000 --- a/docker-compose.prod.yml +++ /dev/null @@ -1,31 +0,0 @@ -version: "3.9" - -volumes: - prod_database_data: - -services: - # discord: - # build: . - - database: - image: mysql/mysql-server - command: --default-authentication-plugin=mysql_native_password - restart: always - environment: - - MYSQL_DATABASE=carddrop - - MYSQL_USER=prod - - MYSQL_PASSWORD=prod - - MYSQL_ROOT_PASSWORD=root - - MYSQL_ROOT_HOST=0.0.0.0 - ports: - - "3321:3306" - volumes: - - prod_database_data:/var/lib/mysql - - phpmyadmin: - image: phpmyadmin - restart: always - ports: - - "3322:80" - environment: - - PMA_ARBITRARY=1 \ No newline at end of file diff --git a/docker-compose.stage.yml b/docker-compose.stage.yml deleted file mode 100644 index a6666a4..0000000 --- a/docker-compose.stage.yml +++ /dev/null @@ -1,31 +0,0 @@ -version: "3.9" - -volumes: - stage_database_data: - -services: - # discord: - # build: . - - database: - image: mysql/mysql-server - command: --default-authentication-plugin=mysql_native_password - restart: always - environment: - - MYSQL_DATABASE=carddrop - - MYSQL_USER=stage - - MYSQL_PASSWORD=stage - - MYSQL_ROOT_PASSWORD=root - - MYSQL_ROOT_HOST=0.0.0.0 - ports: - - "3311:3306" - volumes: - - stage_database_data:/var/lib/mysql - - phpmyadmin: - image: phpmyadmin - restart: always - ports: - - "3312:80" - environment: - - PMA_ARBITRARY=1 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index c0b5077..025a674 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,31 +1,17 @@ version: "3.9" -volumes: - dev_database_data: - services: - # discord: - # build: . - database: image: mysql/mysql-server command: --default-authentication-plugin=mysql_native_password restart: always environment: - - MYSQL_DATABASE=carddrop - - MYSQL_USER=dev - - MYSQL_PASSWORD=dev - - MYSQL_ROOT_PASSWORD=root - - MYSQL_ROOT_HOST=0.0.0.0 + - MYSQL_DATABASE=$DB_NAME + - MYSQL_USER=$DB_AUTH_USER + - MYSQL_PASSWORD=$DB_AUTH_PASS + - MYSQL_ROOT_PASSWORD=$DB_AUTH_PASS + - MYSQL_ROOT_HOST=$DB_ROOT_HOST ports: - - "3301:3306" + - "$DB_PORT:3306" volumes: - - dev_database_data:/var/lib/mysql - - phpmyadmin: - image: phpmyadmin - restart: always - ports: - - "3302:80" - environment: - - PMA_ARBITRARY=1 \ No newline at end of file + - $DB_DATA_LOCATION:/var/lib/mysql \ No newline at end of file From 33a8b85580003b043b1378bde00b8f3543d0f8ae Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sun, 28 Apr 2024 17:36:36 +0100 Subject: [PATCH 31/32] Runs on node --- .forgejo/workflows/production.yml | 4 ++-- .forgejo/workflows/stage.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/production.yml b/.forgejo/workflows/production.yml index 8291098..ee4281f 100644 --- a/.forgejo/workflows/production.yml +++ b/.forgejo/workflows/production.yml @@ -9,7 +9,7 @@ jobs: build: environment: prod - runs-on: docker + runs-on: node steps: - uses: actions/checkout@v2 @@ -27,7 +27,7 @@ jobs: deploy: environment: prod needs: build - runs-on: docker + runs-on: node steps: - uses: https://github.com/appleboy/ssh-action@v1.0.0 env: diff --git a/.forgejo/workflows/stage.yml b/.forgejo/workflows/stage.yml index 8e222be..e6bb999 100644 --- a/.forgejo/workflows/stage.yml +++ b/.forgejo/workflows/stage.yml @@ -9,7 +9,7 @@ jobs: build: environment: stage - runs-on: docker + runs-on: node steps: - uses: actions/checkout@v2 @@ -27,7 +27,7 @@ jobs: deploy: environment: prod needs: build - runs-on: docker + runs-on: node steps: - uses: https://github.com/appleboy/ssh-action@v1.0.0 env: From c6d78cc37055498736d020fcf3cce69f36b0833a Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sun, 28 Apr 2024 17:40:00 +0100 Subject: [PATCH 32/32] Source .sshrc --- .forgejo/workflows/production.yml | 3 ++- .forgejo/workflows/stage.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/production.yml b/.forgejo/workflows/production.yml index ee4281f..4b53d02 100644 --- a/.forgejo/workflows/production.yml +++ b/.forgejo/workflows/production.yml @@ -60,7 +60,8 @@ jobs: port: ${{ secrets.PROD_SSH_PORT }} envs: DB_NAME,DB_AUTH_USER,DB_AUTH_PASS,DB_HOST,DB_PORT,DB_ROOT_HOST,DB_SYNC,DB_LOGGING,DB_DATA_LOCATION,BOT_TOKEN,BOT_VER,BOT_AUTHOR,BOT_OWNERID,BOT_CLIENTID,ABOUT_FUNDING,ABOUT_REPO,BOT_ENV,BOT_ADMINS,DATA_DIR,GDRIVESYNC_AUTO,SERVER_PATH,EXPRESS_PORT script: | - cd /home/vylpes/apps/card-drop/card-drop_prod \ + source .sshrc \ + && cd /home/vylpes/apps/card-drop/card-drop_prod \ && docker compose down \ && (pm2 stop card-drop_prod || true) \ && (pm2 delete card-drop_prod || true) \ diff --git a/.forgejo/workflows/stage.yml b/.forgejo/workflows/stage.yml index e6bb999..2bb68c0 100644 --- a/.forgejo/workflows/stage.yml +++ b/.forgejo/workflows/stage.yml @@ -60,7 +60,8 @@ jobs: port: ${{ secrets.STAGE_SSH_PORT }} envs: DB_NAME,DB_AUTH_USER,DB_AUTH_PASS,DB_HOST,DB_PORT,DB_ROOT_HOST,DB_SYNC,DB_LOGGING,DB_DATA_LOCATION,BOT_TOKEN,BOT_VER,BOT_AUTHOR,BOT_OWNERID,BOT_CLIENTID,ABOUT_FUNDING,ABOUT_REPO,BOT_ENV,BOT_ADMINS,DATA_DIR,GDRIVESYNC_AUTO,SERVER_PATH,EXPRESS_PORT script: | - cd /home/vylpes/apps/card-drop/card-drop_stage \ + source .sshrc \ + && cd /home/vylpes/apps/card-drop/card-drop_stage \ && docker compose down \ && (pm2 stop card-drop_stage || true) \ && (pm2 delete card-drop_stage || true) \