Compare commits

..

19 commits

Author SHA1 Message Date
Ethan Lane 70d1589584 0.5.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-02-17 17:52:34 +00:00
Ethan Lane 6ee8db6232 Add ability to view another's inventory (#155)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

- Add ability to view another user's inventory
- Fix bug where the inventory generation logic was overriding the main array

#131, #138

## Type of change

Please delete options that are not relevant.

- [x] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)

# How Has This Been Tested?

Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration.

# Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that provde my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/155
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-02-16 17:21:50 +00:00
RenovateBot 4c97d41495 Update dependency typeorm to v0.3.20 (#162)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [typeorm](https://typeorm.io) ([source](https://github.com/typeorm/typeorm)) | dependencies | patch | [`0.3.19` -> `0.3.20`](https://renovatebot.com/diffs/npm/typeorm/0.3.19/0.3.20) |

---

### Release Notes

<details>
<summary>typeorm/typeorm (typeorm)</summary>

### [`v0.3.20`](https://github.com/typeorm/typeorm/blob/HEAD/CHANGELOG.md#0320-2024-01-26)

[Compare Source](https://github.com/typeorm/typeorm/compare/0.3.19...0.3.20)

##### Bug Fixes

-   added missing parentheses in where conditions ([#&#8203;10650](https://github.com/typeorm/typeorm/issues/10650)) ([4624930](46249303be)), closes [#&#8203;10534](https://github.com/typeorm/typeorm/issues/10534)
-   don't escape indexPredicate ([#&#8203;10618](https://github.com/typeorm/typeorm/issues/10618)) ([dd49a25](dd49a254dc))
-   fallback runMigrations transaction to DataSourceOptions ([#&#8203;10601](https://github.com/typeorm/typeorm/issues/10601)) ([0cab0dd](0cab0dd730))
-   hangup when load relations with relationLoadStrategy: query ([#&#8203;10630](https://github.com/typeorm/typeorm/issues/10630)) ([54d8d9e](54d8d9efe9)), closes [#&#8203;10481](https://github.com/typeorm/typeorm/issues/10481)
-   include asExpression columns in returning clause ([#&#8203;10632](https://github.com/typeorm/typeorm/issues/10632)) ([f232ba7](f232ba7808)), closes [#&#8203;8450](https://github.com/typeorm/typeorm/issues/8450) [#&#8203;8450](https://github.com/typeorm/typeorm/issues/8450)
-   multiple insert in SAP Hana ([#&#8203;10597](https://github.com/typeorm/typeorm/issues/10597)) ([1b34c9a](1b34c9a49e))
-   resolve issue CREATE/DROP Index concurrently ([#&#8203;10634](https://github.com/typeorm/typeorm/issues/10634)) ([8aa8690](8aa8690f94)), closes [#&#8203;10626](https://github.com/typeorm/typeorm/issues/10626)
-   type inferencing of EntityManager#create ([#&#8203;10569](https://github.com/typeorm/typeorm/issues/10569)) ([99d8249](99d8249e45))

##### Features

-   add json type support for Oracle ([#&#8203;10611](https://github.com/typeorm/typeorm/issues/10611)) ([7e85460](7e85460f10))
-   add postgres multirange column types ([#&#8203;10627](https://github.com/typeorm/typeorm/issues/10627)) ([d0b7670](d0b76703cc)), closes [#&#8203;10556](https://github.com/typeorm/typeorm/issues/10556)
-   add table comment for postgres ([#&#8203;10613](https://github.com/typeorm/typeorm/issues/10613)) ([4493db4](4493db4d1b))

##### Reverts

-   Revert "fix: prevent using absolute table path in migrations unless required ([#&#8203;10123](https://github.com/typeorm/typeorm/issues/10123))" ([#&#8203;10624](https://github.com/typeorm/typeorm/issues/10624)) ([8f371f2](8f371f2397)), closes [#&#8203;10123](https://github.com/typeorm/typeorm/issues/10123) [#&#8203;10624](https://github.com/typeorm/typeorm/issues/10624)
-   revert "feat: nullable embedded entities ([#&#8203;10289](https://github.com/typeorm/typeorm/issues/10289))" ([#&#8203;10614](https://github.com/typeorm/typeorm/issues/10614)) ([15de46f](15de46fd5d)), closes [#&#8203;10289](https://github.com/typeorm/typeorm/issues/10289) [#&#8203;10614](https://github.com/typeorm/typeorm/issues/10614)

</details>

---

### 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.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/162
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-02-12 18:00:03 +00:00
RenovateBot 96b97b30e6 Update dependency ts-jest to v29.1.2 (#161)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [ts-jest](https://kulshekhar.github.io/ts-jest) ([source](https://github.com/kulshekhar/ts-jest)) | dependencies | patch | [`29.1.1` -> `29.1.2`](https://renovatebot.com/diffs/npm/ts-jest/29.1.1/29.1.2) |

---

### Release Notes

<details>
<summary>kulshekhar/ts-jest (ts-jest)</summary>

### [`v29.1.2`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2912-2024-01-22)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v29.1.1...v29.1.2)

##### Bug Fixes

-   calculated cache key based on `supportsStaticESM` ([a5d6f2d](a5d6f2d4f4))
-   correct error handling in `processAsync` ([e7be4bf](e7be4bf6a8)), closes [#&#8203;4207](https://github.com/kulshekhar/ts-jest/issues/4207)
-   use `Config.ProjectConfig` ([918312b](918312bee2)), closes [#&#8203;4028](https://github.com/kulshekhar/ts-jest/issues/4028)

</details>

---

### 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.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/161
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-02-12 17:59:01 +00:00
RenovateBot bc4a870305 Update dependency @types/node to v20.11.17 (#158)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | devDependencies | patch | [`20.11.10` -> `20.11.17`](https://renovatebot.com/diffs/npm/@types%2fnode/20.11.10/20.11.17) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/158
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-02-12 17:58:11 +00:00
RenovateBot 935629d831 Update dependency @types/jest to v29.5.12 (#157)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | dependencies | patch | [`29.5.11` -> `29.5.12`](https://renovatebot.com/diffs/npm/@types%2fjest/29.5.11/29.5.12) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/157
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-02-12 17:56:35 +00:00
Ethan Lane a0ba8d7994 Update footer text in CardDropHelperMetadata to include card number (#159)
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

- Update the footer text in CardDropHelperMetadata to include card number

#127

## Type of change

Please delete options that are not relevant.

- [x] New feature (non-breaking change which adds functionality)

# How Has This Been Tested?

Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration.

- This has been tested by running the `/drop`, `/dropnumber` commands, and `Reroll` button event. All display the card number on the footer now

# Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that provde my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/159
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-02-12 17:49:51 +00:00
Ethan Lane f181c5dbfe Add view command (#153)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

- Add view command to let users see specific cards but not claim them

#80

## Type of change

Please delete options that are not relevant.

- [x] New feature (non-breaking change which adds functionality)

# How Has This Been Tested?

Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration.

# Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that provde my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/153
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-02-02 21:53:42 +00:00
RenovateBot 36ec25113e Update dependency @types/uuid to v9.0.8 (#152)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@types/uuid](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/uuid) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | dependencies | patch | [`9.0.7` -> `9.0.8`](https://renovatebot.com/diffs/npm/@types%2fuuid/9.0.7/9.0.8) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/152
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-29 18:10:25 +00:00
RenovateBot f47882c039 Update dependency @types/node to v20.11.10 (#151)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | devDependencies | patch | [`20.11.5` -> `20.11.10`](https://renovatebot.com/diffs/npm/@types%2fnode/20.11.5/20.11.10) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/151
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-29 18:09:02 +00:00
Ethan Lane 93d11c02a6 Migrate to woodpecker (#150)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

- Migrate to Woodpecker CI

> **NOTE:** This will require the Drone project to be disabled before merge!

#122

## Type of change

Please delete options that are not relevant.

- [x] New feature (non-breaking change which adds functionality)

# How Has This Been Tested?

Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration.

# Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that provde my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/150
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-01-26 21:02:17 +00:00
RenovateBot b21483c13e Update dependency dotenv to v16.3.2 (#149)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [dotenv](https://github.com/motdotla/dotenv) | dependencies | patch | [`16.3.1` -> `16.3.2`](https://renovatebot.com/diffs/npm/dotenv/16.3.1/16.3.2) |

---

### Release Notes

<details>
<summary>motdotla/dotenv (dotenv)</summary>

### [`v16.3.2`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1632-2024-01-18)

[Compare Source](https://github.com/motdotla/dotenv/compare/v16.3.1...v16.3.2)

##### Added

-   Add debug message when no encoding set [#&#8203;735](https://github.com/motdotla/dotenv/pull/735)

##### Changed

-   Fix output typing for `populate` [#&#8203;792](https://github.com/motdotla/dotenv/pull/792)
-   Use subarray instead of slice [#&#8203;793](https://github.com/motdotla/dotenv/pull/793)

</details>

---

### 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.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/149
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-22 17:28:32 +00:00
RenovateBot d6b56664ad Update dependency @types/node to v20.11.5 (#148)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | devDependencies | patch | [`20.11.0` -> `20.11.5`](https://renovatebot.com/diffs/npm/@types%2fnode/20.11.0/20.11.5) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/148
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-22 17:27:17 +00:00
Ethan Lane 38ac26b793 Merge branch 'main' into develop
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-21 15:02:00 +00:00
Ethan Lane 7febc06f1e Merge branch 'main' into develop
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-20 15:50:03 +00:00
Ethan Lane de08fa26d7 Update gdrivesync to show an error message of what failed (#144)
All checks were successful
continuous-integration/drone/push Build is passing
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

# How Has This Been Tested?

Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration.

# Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that provde my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/144
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-01-20 14:31:07 +00:00
Ethan Lane 275a804e28 Update gdrivesync command to error if JSON parsing fails (#143)
All checks were successful
continuous-integration/drone/push Build is passing
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

- Update the gdrivesync command so if the JSON parse function fails, it returns an error message

#134

## Type of change

Please delete options that are not relevant.

- [x] New feature (non-breaking change which adds functionality)

# How Has This Been Tested?

Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration.

# Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that provde my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/143
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-01-19 18:05:46 +00:00
RenovateBot cfff3be143 Update dependency @typescript-eslint/eslint-plugin to v6.18.1 (#140)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | minor | [`6.16.0` -> `6.18.1`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/6.16.0/6.18.1) |

---

### Release Notes

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>

### [`v6.18.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6181-2024-01-08)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.18.0...v6.18.1)

##### 🩹 Fixes

-   **eslint-plugin:** \[no-non-null-assertion] provide valid fix when member access is on next line

-   **eslint-plugin:** \[no-unnecessary-condition] improve checking optional callee

-   **eslint-plugin:** \[prefer-readonly] support modifiers of unions and intersections

-   **eslint-plugin:** \[switch-exhaustiveness-check] fix new allowDefaultCaseForExhaustiveSwitch option

##### ❤️  Thank You

-   auvred
-   James
-   Josh Goldberg 
-   YeonJuan

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

### [`v6.18.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6180-2024-01-06)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.17.0...v6.18.0)

##### 🚀 Features

-   **typescript-estree:** throw on invalid update expressions

-   **eslint-plugin:** \[no-var-requires, no-require-imports] allow option

##### ❤️  Thank You

-   auvred
-   Joshua Chen

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

### [`v6.17.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6170-2024-01-01)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0)

##### Bug Fixes

-   **eslint-plugin:** \[no-restricted-imports] prevent crash when `patterns` or `paths` in options are empty ([#&#8203;8108](https://github.com/typescript-eslint/typescript-eslint/issues/8108)) ([675e987](675e987ca1))

##### Features

-   **eslint-plugin:** \[no-floating-promises] flag result of .map(async) ([#&#8203;7897](https://github.com/typescript-eslint/typescript-eslint/issues/7897)) ([5857356](5857356962))
-   **eslint-plugin:** \[switch-exhaustiveness-check] add an option to warn against a `default` case on an already exhaustive `switch` ([#&#8203;7539](https://github.com/typescript-eslint/typescript-eslint/issues/7539)) ([6a219bd](6a219bdfe6))

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.

</details>

---

### 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.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/140
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-16 19:18:42 +00:00
RenovateBot 2eb7d698fe Update dependency @types/node to v20.11.0 (#139)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | devDependencies | minor | [`20.10.7` -> `20.11.0`](https://renovatebot.com/diffs/npm/@types%2fnode/20.10.7/20.11.0) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/139
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-16 19:17:45 +00:00
17 changed files with 578 additions and 123 deletions

View file

@ -7,7 +7,7 @@
# any secret values. # any secret values.
BOT_TOKEN= BOT_TOKEN=
BOT_VER=0.4.2 BOT_VER=0.5.0
BOT_AUTHOR=Vylpes BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816 BOT_OWNERID=147392775707426816
BOT_CLIENTID=682942374040961060 BOT_CLIENTID=682942374040961060

View file

@ -7,7 +7,7 @@
# any secret values. # any secret values.
BOT_TOKEN= BOT_TOKEN=
BOT_VER=0.4.2 BOT_VER=0.5.0
BOT_AUTHOR=Vylpes BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816 BOT_OWNERID=147392775707426816
BOT_CLIENTID=1093810443589529631 BOT_CLIENTID=1093810443589529631

View file

@ -7,7 +7,7 @@
# any secret values. # any secret values.
BOT_TOKEN= BOT_TOKEN=
BOT_VER=0.4.2 BOT_VER=0.5.0
BOT_AUTHOR=Vylpes BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816 BOT_OWNERID=147392775707426816
BOT_CLIENTID=1147976642942214235 BOT_CLIENTID=1147976642942214235

47
.woodpecker.yml Normal file
View file

@ -0,0 +1,47 @@
steps:
build:
image: node
commands:
- npm ci
- npm run build
when:
event: push
branch: [ hotfix/*, feature/*, renovate/*, develop, main ]
lint:
image: node
commands:
- npm run lint
when:
event: push
branch: [ hotfix/*, feature/*, renovate/*, develop, main ]
test:
image: node
commands:
- npm test
when:
event: push
branch: [ hotfix/*, feature/*, renovate/*, develop, main ]
stage:
image: alpine
secrets: [ ssh_key, stage_bot_token ]
commands:
- apk add rsync openssh-client
- eval `ssh-agent -s`
- echo "$SSH_KEY" | tr -d '\r' | ssh-add -
- rsync -e "ssh -o StrictHostKeyChecking=no" -r ./* vylpes@192.168.68.120:/home/vylpes/apps/card-drop/card-drop_stage
- ssh vylpes@192.168.68.120 BOT_TOKEN='$${stage_bot_token}' 'bash -s' < ./scripts/deploy_stage.sh
when:
event: push
branch: [ develop ]
deploy:
image: alpine
secrets: [ ssh_key, prod_bot_token ]
commands:
- apk add rsync openssh-client
- eval `ssh-agent -s`
- echo "$SSH_KEY" | tr -d '\r' | ssh-add -
- rsync -e "ssh -o StrictHostKeyChecking=no" -r ./* vylpes@192.168.68.120:/home/vylpes/apps/card-drop/card-drop_prod
- ssh vylpes@192.168.68.120 BOT_TOKEN='$${prod_bot_token}' 'bash -s' < ./scripts/deploy_prod.sh
when:
event: push
branch: [ main ]

402
package-lock.json generated
View file

@ -1,19 +1,21 @@
{ {
"name": "card-drop", "name": "card-drop",
"version": "0.4.2", "version": "0.5.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "card-drop", "name": "card-drop",
"version": "0.4.2", "version": "0.5.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@discordjs/rest": "^2.0.0", "@discordjs/rest": "^2.0.0",
"@types/clone-deep": "^4.0.4",
"@types/express": "^4.17.20", "@types/express": "^4.17.20",
"@types/jest": "^29.0.0", "@types/jest": "^29.0.0",
"@types/uuid": "^9.0.0", "@types/uuid": "^9.0.0",
"body-parser": "^1.20.2", "body-parser": "^1.20.2",
"clone-deep": "^4.0.1",
"discord.js": "^14.3.0", "discord.js": "^14.3.0",
"dotenv": "^16.0.0", "dotenv": "^16.0.0",
"express": "^4.18.2", "express": "^4.18.2",
@ -23,7 +25,7 @@
"minimatch": "9.0.3", "minimatch": "9.0.3",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"ts-jest": "^29.0.0", "ts-jest": "^29.0.0",
"typeorm": "0.3.19" "typeorm": "0.3.20"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.0.0", "@types/node": "^20.0.0",
@ -1785,6 +1787,11 @@
"@types/responselike": "^1.0.0" "@types/responselike": "^1.0.0"
} }
}, },
"node_modules/@types/clone-deep": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/@types/clone-deep/-/clone-deep-4.0.4.tgz",
"integrity": "sha512-vXh6JuuaAha6sqEbJueYdh5zNBPPgG1OYumuz2UvLvriN6ABHDSW8ludREGWJb1MLIzbwZn4q4zUbUCerJTJfA=="
},
"node_modules/@types/connect": { "node_modules/@types/connect": {
"version": "3.4.38", "version": "3.4.38",
"license": "MIT", "license": "MIT",
@ -1847,9 +1854,9 @@
} }
}, },
"node_modules/@types/jest": { "node_modules/@types/jest": {
"version": "29.5.11", "version": "29.5.12",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.11.tgz", "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.12.tgz",
"integrity": "sha512-S2mHmYIVe13vrm6q4kN6fLYYAka15ALQki/vgDC3mIukEOx8WJlv0kQPM+d4w8Gp6u0uSdKND04IlTXBv0rwnQ==", "integrity": "sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==",
"dependencies": { "dependencies": {
"expect": "^29.0.0", "expect": "^29.0.0",
"pretty-format": "^29.0.0" "pretty-format": "^29.0.0"
@ -1874,9 +1881,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "20.10.7", "version": "20.11.17",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.7.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.17.tgz",
"integrity": "sha512-fRbIKb8C/Y2lXxB5eVMj4IU7xpdox0Lh8bUPEdtLysaylsml1hOOx1+STloRs/B9nf7C6kPRmmg/V7aQW7usNg==", "integrity": "sha512-QmgQZGWu1Yw9TDyAP9ZzpFJKynYNeOvwMJmaxABfieQoVoiVOS6MN1WSpqpRcbeA5+RW82kraAVxCCJg+780Qw==",
"dependencies": { "dependencies": {
"undici-types": "~5.26.4" "undici-types": "~5.26.4"
} }
@ -1934,8 +1941,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/uuid": { "node_modules/@types/uuid": {
"version": "9.0.7", "version": "9.0.8",
"license": "MIT" "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz",
"integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA=="
}, },
"node_modules/@types/ws": { "node_modules/@types/ws": {
"version": "8.5.9", "version": "8.5.9",
@ -1956,16 +1964,16 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@typescript-eslint/eslint-plugin": { "node_modules/@typescript-eslint/eslint-plugin": {
"version": "6.16.0", "version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.16.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.18.1.tgz",
"integrity": "sha512-O5f7Kv5o4dLWQtPX4ywPPa+v9G+1q1x8mz0Kr0pXUtKsevo+gIJHLkGc8RxaZWtP8RrhwhSNIWThnW42K9/0rQ==", "integrity": "sha512-nISDRYnnIpk7VCFrGcu1rnZfM1Dh9LRHnfgdkjcbi/l7g16VYRri3TjXi9Ir4lOZSw5N/gnV/3H7jIPQ8Q4daA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@eslint-community/regexpp": "^4.5.1", "@eslint-community/regexpp": "^4.5.1",
"@typescript-eslint/scope-manager": "6.16.0", "@typescript-eslint/scope-manager": "6.18.1",
"@typescript-eslint/type-utils": "6.16.0", "@typescript-eslint/type-utils": "6.18.1",
"@typescript-eslint/utils": "6.16.0", "@typescript-eslint/utils": "6.18.1",
"@typescript-eslint/visitor-keys": "6.16.0", "@typescript-eslint/visitor-keys": "6.18.1",
"debug": "^4.3.4", "debug": "^4.3.4",
"graphemer": "^1.4.0", "graphemer": "^1.4.0",
"ignore": "^5.2.4", "ignore": "^5.2.4",
@ -1990,6 +1998,53 @@
} }
} }
}, },
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.18.1.tgz",
"integrity": "sha512-BgdBwXPFmZzaZUuw6wKiHKIovms97a7eTImjkXCZE04TGHysG+0hDQPmygyvgtkoB/aOQwSM/nWv3LzrOIQOBw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.18.1",
"@typescript-eslint/visitor-keys": "6.18.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.1.tgz",
"integrity": "sha512-4TuMAe+tc5oA7wwfqMtB0Y5OrREPF1GeJBAjqwgZh1lEMH5PJQgWgHGfYufVB51LtjD+peZylmeyxUXPfENLCw==",
"dev": true,
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.1.tgz",
"integrity": "sha512-/kvt0C5lRqGoCfsbmm7/CwMqoSkY3zzHLIjdhHZQW3VFrnz7ATecOHR7nb7V+xn4286MBxfnQfQhAmCI0u+bJA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.18.1",
"eslint-visitor-keys": "^3.4.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/debug": { "node_modules/@typescript-eslint/eslint-plugin/node_modules/debug": {
"version": "4.3.4", "version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@ -2082,13 +2137,13 @@
} }
}, },
"node_modules/@typescript-eslint/type-utils": { "node_modules/@typescript-eslint/type-utils": {
"version": "6.16.0", "version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.16.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.18.1.tgz",
"integrity": "sha512-ThmrEOcARmOnoyQfYkHw/DX2SEYBalVECmoldVuH6qagKROp/jMnfXpAU/pAIWub9c4YTxga+XwgAkoA0pxfmg==", "integrity": "sha512-wyOSKhuzHeU/5pcRDP2G2Ndci+4g653V43gXTpt4nbyoIOAASkGDA9JIAgbQCdCkcr1MvpSYWzxTz0olCn8+/Q==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/typescript-estree": "6.16.0", "@typescript-eslint/typescript-estree": "6.18.1",
"@typescript-eslint/utils": "6.16.0", "@typescript-eslint/utils": "6.18.1",
"debug": "^4.3.4", "debug": "^4.3.4",
"ts-api-utils": "^1.0.1" "ts-api-utils": "^1.0.1"
}, },
@ -2108,6 +2163,64 @@
} }
} }
}, },
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.1.tgz",
"integrity": "sha512-4TuMAe+tc5oA7wwfqMtB0Y5OrREPF1GeJBAjqwgZh1lEMH5PJQgWgHGfYufVB51LtjD+peZylmeyxUXPfENLCw==",
"dev": true,
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.18.1.tgz",
"integrity": "sha512-fv9B94UAhywPRhUeeV/v+3SBDvcPiLxRZJw/xZeeGgRLQZ6rLMG+8krrJUyIf6s1ecWTzlsbp0rlw7n9sjufHA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.18.1",
"@typescript-eslint/visitor-keys": "6.18.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"minimatch": "9.0.3",
"semver": "^7.5.4",
"ts-api-utils": "^1.0.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.1.tgz",
"integrity": "sha512-/kvt0C5lRqGoCfsbmm7/CwMqoSkY3zzHLIjdhHZQW3VFrnz7ATecOHR7nb7V+xn4286MBxfnQfQhAmCI0u+bJA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.18.1",
"eslint-visitor-keys": "^3.4.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/debug": { "node_modules/@typescript-eslint/type-utils/node_modules/debug": {
"version": "4.3.4", "version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@ -2125,6 +2238,26 @@
} }
} }
}, },
"node_modules/@typescript-eslint/type-utils/node_modules/globby": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
"integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
"dev": true,
"dependencies": {
"array-union": "^2.1.0",
"dir-glob": "^3.0.1",
"fast-glob": "^3.2.9",
"ignore": "^5.2.0",
"merge2": "^1.4.1",
"slash": "^3.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/ms": { "node_modules/@typescript-eslint/type-utils/node_modules/ms": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@ -2216,17 +2349,17 @@
"dev": true "dev": true
}, },
"node_modules/@typescript-eslint/utils": { "node_modules/@typescript-eslint/utils": {
"version": "6.16.0", "version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.16.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.18.1.tgz",
"integrity": "sha512-T83QPKrBm6n//q9mv7oiSvy/Xq/7Hyw9SzSEhMHJwznEmQayfBM87+oAlkNAMEO7/MjIwKyOHgBJbxB0s7gx2A==", "integrity": "sha512-zZmTuVZvD1wpoceHvoQpOiewmWu3uP9FuTWo8vqpy2ffsmfCE8mklRPi+vmnIYAIk9t/4kOThri2QCDgor+OpQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.4.0", "@eslint-community/eslint-utils": "^4.4.0",
"@types/json-schema": "^7.0.12", "@types/json-schema": "^7.0.12",
"@types/semver": "^7.5.0", "@types/semver": "^7.5.0",
"@typescript-eslint/scope-manager": "6.16.0", "@typescript-eslint/scope-manager": "6.18.1",
"@typescript-eslint/types": "6.16.0", "@typescript-eslint/types": "6.18.1",
"@typescript-eslint/typescript-estree": "6.16.0", "@typescript-eslint/typescript-estree": "6.18.1",
"semver": "^7.5.4" "semver": "^7.5.4"
}, },
"engines": { "engines": {
@ -2240,6 +2373,124 @@
"eslint": "^7.0.0 || ^8.0.0" "eslint": "^7.0.0 || ^8.0.0"
} }
}, },
"node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.18.1.tgz",
"integrity": "sha512-BgdBwXPFmZzaZUuw6wKiHKIovms97a7eTImjkXCZE04TGHysG+0hDQPmygyvgtkoB/aOQwSM/nWv3LzrOIQOBw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.18.1",
"@typescript-eslint/visitor-keys": "6.18.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.1.tgz",
"integrity": "sha512-4TuMAe+tc5oA7wwfqMtB0Y5OrREPF1GeJBAjqwgZh1lEMH5PJQgWgHGfYufVB51LtjD+peZylmeyxUXPfENLCw==",
"dev": true,
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.18.1.tgz",
"integrity": "sha512-fv9B94UAhywPRhUeeV/v+3SBDvcPiLxRZJw/xZeeGgRLQZ6rLMG+8krrJUyIf6s1ecWTzlsbp0rlw7n9sjufHA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.18.1",
"@typescript-eslint/visitor-keys": "6.18.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"minimatch": "9.0.3",
"semver": "^7.5.4",
"ts-api-utils": "^1.0.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.1.tgz",
"integrity": "sha512-/kvt0C5lRqGoCfsbmm7/CwMqoSkY3zzHLIjdhHZQW3VFrnz7ATecOHR7nb7V+xn4286MBxfnQfQhAmCI0u+bJA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.18.1",
"eslint-visitor-keys": "^3.4.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/utils/node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dev": true,
"dependencies": {
"ms": "2.1.2"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/utils/node_modules/globby": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
"integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
"dev": true,
"dependencies": {
"array-union": "^2.1.0",
"dir-glob": "^3.0.1",
"fast-glob": "^3.2.9",
"ignore": "^5.2.0",
"merge2": "^1.4.1",
"slash": "^3.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@typescript-eslint/utils/node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
"node_modules/@typescript-eslint/visitor-keys": { "node_modules/@typescript-eslint/visitor-keys": {
"version": "6.16.0", "version": "6.16.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.16.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.16.0.tgz",
@ -3544,6 +3795,19 @@
"node": ">=0.8" "node": ">=0.8"
} }
}, },
"node_modules/clone-deep": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz",
"integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==",
"dependencies": {
"is-plain-object": "^2.0.4",
"kind-of": "^6.0.2",
"shallow-clone": "^3.0.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/clone-response": { "node_modules/clone-response": {
"version": "1.0.3", "version": "1.0.3",
"dev": true, "dev": true,
@ -4168,8 +4432,9 @@
} }
}, },
"node_modules/dotenv": { "node_modules/dotenv": {
"version": "16.3.1", "version": "16.3.2",
"license": "BSD-2-Clause", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.2.tgz",
"integrity": "sha512-HTlk5nmhkm8F6JcdXvHIzaorzCoziNQT9mGxLPVXW8wJF1TiGSL60ZGB4gHWabHOaMmWmhvk2/lPHfnBiT78AQ==",
"engines": { "engines": {
"node": ">=12" "node": ">=12"
}, },
@ -6180,6 +6445,17 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/is-plain-object": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
"integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
"dependencies": {
"isobject": "^3.0.1"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-promise": { "node_modules/is-promise": {
"version": "2.2.2", "version": "2.2.2",
"dev": true, "dev": true,
@ -6255,6 +6531,14 @@
"version": "2.0.0", "version": "2.0.0",
"license": "ISC" "license": "ISC"
}, },
"node_modules/isobject": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
"integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/issue-regex": { "node_modules/issue-regex": {
"version": "4.1.0", "version": "4.1.0",
"dev": true, "dev": true,
@ -7055,6 +7339,14 @@
"json-buffer": "3.0.1" "json-buffer": "3.0.1"
} }
}, },
"node_modules/kind-of": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/kleur": { "node_modules/kleur": {
"version": "3.0.3", "version": "3.0.3",
"license": "MIT", "license": "MIT",
@ -9622,8 +9914,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/reflect-metadata": { "node_modules/reflect-metadata": {
"version": "0.1.13", "version": "0.2.1",
"license": "Apache-2.0" "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.1.tgz",
"integrity": "sha512-i5lLI6iw9AU3Uu4szRNPPEkomnkjRTaVt9hy/bn5g/oSzekBSMeLZblcjP74AW0vBabqERLLIrz+gR8QYR54Tw=="
}, },
"node_modules/registry-auth-token": { "node_modules/registry-auth-token": {
"version": "4.2.2", "version": "4.2.2",
@ -9996,6 +10289,17 @@
"sha.js": "bin.js" "sha.js": "bin.js"
} }
}, },
"node_modules/shallow-clone": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz",
"integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==",
"dependencies": {
"kind-of": "^6.0.2"
},
"engines": {
"node": ">=8"
}
},
"node_modules/shebang-command": { "node_modules/shebang-command": {
"version": "2.0.0", "version": "2.0.0",
"license": "MIT", "license": "MIT",
@ -10671,8 +10975,9 @@
} }
}, },
"node_modules/ts-jest": { "node_modules/ts-jest": {
"version": "29.1.1", "version": "29.1.2",
"license": "MIT", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz",
"integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==",
"dependencies": { "dependencies": {
"bs-logger": "0.x", "bs-logger": "0.x",
"fast-json-stable-stringify": "2.x", "fast-json-stable-stringify": "2.x",
@ -10687,7 +10992,7 @@
"ts-jest": "cli.js" "ts-jest": "cli.js"
}, },
"engines": { "engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0" "node": "^16.10.0 || ^18.0.0 || >=20.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": ">=7.0.0-beta.0 <8", "@babel/core": ">=7.0.0-beta.0 <8",
@ -10711,21 +11016,6 @@
} }
} }
}, },
"node_modules/ts-jest/node_modules/jest-util": {
"version": "29.6.2",
"license": "MIT",
"dependencies": {
"@jest/types": "^29.6.1",
"@types/node": "*",
"chalk": "^4.0.0",
"ci-info": "^3.2.0",
"graceful-fs": "^4.2.9",
"picomatch": "^2.2.3"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
}
},
"node_modules/ts-mixer": { "node_modules/ts-mixer": {
"version": "6.0.3", "version": "6.0.3",
"license": "MIT" "license": "MIT"
@ -10784,9 +11074,9 @@
} }
}, },
"node_modules/typeorm": { "node_modules/typeorm": {
"version": "0.3.19", "version": "0.3.20",
"resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.19.tgz", "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.20.tgz",
"integrity": "sha512-OGelrY5qEoAU80mR1iyvmUHiKCPUydL6xp6bebXzS7jyv/X70Gp/jBWRAfF4qGOfy2A7orMiGRfwsBUNbEL65g==", "integrity": "sha512-sJ0T08dV5eoZroaq9uPKBoNcGslHBR4E4y+EBHs//SiGbblGe7IeduP/IH4ddCcj0qp3PHwDwGnuvqEAnKlq/Q==",
"dependencies": { "dependencies": {
"@sqltools/formatter": "^1.2.5", "@sqltools/formatter": "^1.2.5",
"app-root-path": "^3.1.0", "app-root-path": "^3.1.0",
@ -10798,7 +11088,7 @@
"dotenv": "^16.0.3", "dotenv": "^16.0.3",
"glob": "^10.3.10", "glob": "^10.3.10",
"mkdirp": "^2.1.3", "mkdirp": "^2.1.3",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.2.1",
"sha.js": "^2.4.11", "sha.js": "^2.4.11",
"tslib": "^2.5.0", "tslib": "^2.5.0",
"uuid": "^9.0.0", "uuid": "^9.0.0",
@ -10810,7 +11100,7 @@
"typeorm-ts-node-esm": "cli-ts-node-esm.js" "typeorm-ts-node-esm": "cli-ts-node-esm.js"
}, },
"engines": { "engines": {
"node": ">= 12.9.0" "node": ">=16.13.0"
}, },
"funding": { "funding": {
"url": "https://opencollective.com/typeorm" "url": "https://opencollective.com/typeorm"

View file

@ -1,6 +1,6 @@
{ {
"name": "card-drop", "name": "card-drop",
"version": "0.4.2", "version": "0.5.0",
"main": "./dist/bot.js", "main": "./dist/bot.js",
"typings": "./dist", "typings": "./dist",
"scripts": { "scripts": {
@ -26,10 +26,12 @@
"funding": "https://ko-fi.com/vylpes", "funding": "https://ko-fi.com/vylpes",
"dependencies": { "dependencies": {
"@discordjs/rest": "^2.0.0", "@discordjs/rest": "^2.0.0",
"@types/clone-deep": "^4.0.4",
"@types/express": "^4.17.20", "@types/express": "^4.17.20",
"@types/jest": "^29.0.0", "@types/jest": "^29.0.0",
"@types/uuid": "^9.0.0", "@types/uuid": "^9.0.0",
"body-parser": "^1.20.2", "body-parser": "^1.20.2",
"clone-deep": "^4.0.1",
"discord.js": "^14.3.0", "discord.js": "^14.3.0",
"dotenv": "^16.0.0", "dotenv": "^16.0.0",
"express": "^4.18.2", "express": "^4.18.2",
@ -39,7 +41,7 @@
"minimatch": "9.0.3", "minimatch": "9.0.3",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"ts-jest": "^29.0.0", "ts-jest": "^29.0.0",
"typeorm": "0.3.19" "typeorm": "0.3.20"
}, },
"resolutions": {}, "resolutions": {},
"devDependencies": { "devDependencies": {

View file

@ -3,21 +3,8 @@
export PATH="$HOME/.yarn/bin:$PATH" export PATH="$HOME/.yarn/bin:$PATH"
export PATH="$HOME/.nodeuse/bin:$PATH" export PATH="$HOME/.nodeuse/bin:$PATH"
export BOT_TOKEN=$(cat $HOME/scripts/card-drop/prod_key.txt) cd ~/apps/card-drop/card-drop_prod
docker compose --file docker-compose.prod.yml up -d
cd ~/apps/card-drop/card-drop_prod \ sleep 10
&& git checkout main \ cp .prod.env .env
&& git fetch \ pm2 restart card-drop_prod || pm2 start --name card-drop_prod dist/bot.js
&& git pull \
&& docker compose --file docker-compose.prod.yml down \
&& (pm2 stop card-drop_prod || true) \
&& (pm2 delete card-drop_prod || true) \
&& cp .prod.env .env \
&& npm run clean \
&& npm ci \
&& npm run build \
&& docker compose --file docker-compose.prod.yml up -d \
&& echo "Sleeping for 10 seconds to let database load..." \
&& sleep 10 \
&& npm run db:up \
&& NODE_ENV=production pm2 start --name card-drop_prod dist/bot.js

View file

@ -3,21 +3,8 @@
export PATH="$HOME/.yarn/bin:$PATH" export PATH="$HOME/.yarn/bin:$PATH"
export PATH="$HOME/.nodeuse/bin:$PATH" export PATH="$HOME/.nodeuse/bin:$PATH"
export BOT_TOKEN=$(cat $HOME/scripts/card-drop/stage_key.txt) cd ~/apps/card-drop/card-drop_stage
docker compose --file docker-compose.stage.yml up -d
cd ~/apps/card-drop/card-drop_stage \ sleep 10
&& git checkout develop \ cp .stage.env .env
&& git fetch \ pm2 restart card-drop_stage || pm2 start --name card-drop_stage dist/bot.js
&& git pull \
&& docker compose --file docker-compose.stage.yml down \
&& (pm2 stop card-drop_stage || true) \
&& (pm2 delete card-drop_stage || true) \
&& cp .stage.env .env \
&& npm run clean \
&& npm ci \
&& npm run build \
&& docker compose --file docker-compose.stage.yml up -d \
&& echo "Sleeping for 10 seconds to let database load..." \
&& sleep 10 \
&& npm run db:up \
&& NODE_ENV=production pm2 start --name card-drop_stage dist/bot.js

View file

@ -5,37 +5,74 @@ import { glob } from "glob";
import { SeriesMetadata } from "../contracts/SeriesMetadata"; import { SeriesMetadata } from "../contracts/SeriesMetadata";
import { CoreClient } from "../client/client"; import { CoreClient } from "../client/client";
export interface CardMetadataResult {
IsSuccess: boolean;
ErrorMessage?: string;
}
export interface FindMetadataResult {
IsSuccess: boolean;
Result?: SeriesMetadata[];
Error?: {
File: string;
Message: string;
};
}
export default class CardMetadataFunction { export default class CardMetadataFunction {
public static async Execute(overrideSafeMode: boolean = false): Promise<boolean> { public static async Execute(overrideSafeMode: boolean = false): Promise<CardMetadataResult> {
if (!overrideSafeMode && await Config.GetValue("safemode") == "true") return false; if (!overrideSafeMode && await Config.GetValue("safemode") == "true") return {
IsSuccess: false,
ErrorMessage: "Safe mode is on and not overridden",
};
try { const cardResult = await this.FindMetadataJSONs();
CoreClient.Cards = await this.FindMetadataJSONs();
if (cardResult.IsSuccess) {
CoreClient.Cards = cardResult.Result!;
console.log(`Loaded ${CoreClient.Cards.flatMap(x => x.cards).length} cards to database`); console.log(`Loaded ${CoreClient.Cards.flatMap(x => x.cards).length} cards to database`);
} catch (e) {
console.error(e);
await Config.SetValue("safemode", "true"); return {
return false; IsSuccess: true,
};
} }
return true; await Config.SetValue("safemode", "true");
return {
IsSuccess: false,
ErrorMessage: `${cardResult.Error!.File}: ${cardResult.Error!.Message}`,
};
} }
private static async FindMetadataJSONs(): Promise<SeriesMetadata[]> { private static async FindMetadataJSONs(): Promise<FindMetadataResult> {
const res: SeriesMetadata[] = []; const res: SeriesMetadata[] = [];
const seriesJSONs = await glob(path.join(process.env.DATA_DIR!, "cards", "/**/*.json")); const seriesJSONs = await glob(path.join(process.env.DATA_DIR!, "cards", "/**/*.json"));
for (const jsonPath of seriesJSONs) { for (const jsonPath of seriesJSONs) {
console.log(`Reading file ${jsonPath}`); try {
const jsonFile = readFileSync(jsonPath); console.log(`Reading file ${jsonPath}`);
const parsedJson: SeriesMetadata[] = JSON.parse(jsonFile.toString()); const jsonFile = readFileSync(jsonPath);
const parsedJson: SeriesMetadata[] = JSON.parse(jsonFile.toString());
res.push(...parsedJson); res.push(...parsedJson);
} catch (e) {
console.error(e);
return {
IsSuccess: false,
Error: {
File: jsonPath,
Message: `${e}`,
}
};
}
} }
return res; return {
IsSuccess: true,
Result: res,
};
} }
} }

View file

@ -4,17 +4,27 @@ import InventoryHelper from "../helpers/InventoryHelper";
export default class Inventory extends ButtonEvent { export default class Inventory extends ButtonEvent {
public override async execute(interaction: ButtonInteraction) { public override async execute(interaction: ButtonInteraction) {
if (!interaction.guild) return;
const userid = interaction.customId.split(" ")[1]; const userid = interaction.customId.split(" ")[1];
const page = interaction.customId.split(" ")[2]; const page = interaction.customId.split(" ")[2];
const member = interaction.guild.members.cache.find(x => x.id == userid) || await interaction.guild.members.fetch(userid);
if (!member) {
await interaction.reply("Unable to find user.");
return;
}
try { try {
const embed = await InventoryHelper.GenerateInventoryPage(interaction.user.username, userid, Number(page)); const embed = await InventoryHelper.GenerateInventoryPage(member.user.username, member.user.id, Number(page));
await interaction.update({ await interaction.update({
embeds: [ embed.embed ], embeds: [ embed.embed ],
components: [ embed.row ], components: [ embed.row ],
}); });
} catch { } catch (e) {
console.error(e);
await interaction.reply("No page for user found."); await interaction.reply("No page for user found.");
} }
} }

View file

@ -25,7 +25,10 @@ export default class Gdrivesync extends Command {
return; return;
} }
await interaction.reply("Syncing, this might take a while..."); await interaction.reply({
content: "Syncing, this might take a while...",
ephemeral: true,
});
CoreClient.AllowDrops = false; CoreClient.AllowDrops = false;
@ -34,12 +37,16 @@ export default class Gdrivesync extends Command {
await interaction.editReply(`Error while running sync command. Safe Mode has been activated. Code: ${error.code}`); await interaction.editReply(`Error while running sync command. Safe Mode has been activated. Code: ${error.code}`);
await Config.SetValue("safemode", "true"); await Config.SetValue("safemode", "true");
} else { } else {
await CardMetadataFunction.Execute(); const result = await CardMetadataFunction.Execute(true);
await interaction.editReply("Synced successfully."); if (result.IsSuccess) {
await interaction.editReply("Synced successfully.");
CoreClient.AllowDrops = true; CoreClient.AllowDrops = true;
await Config.SetValue("safemode", "false"); await Config.SetValue("safemode", "false");
} else {
await interaction.editReply(`Sync failed \`\`\`${result.ErrorMessage}\`\`\``);
}
} }
}); });
} }

View file

@ -12,11 +12,16 @@ export default class Inventory extends Command {
.addNumberOption(x => .addNumberOption(x =>
x x
.setName("page") .setName("page")
.setDescription("The page to start with")); .setDescription("The page to start with"))
.addUserOption(x =>
x
.setName("user")
.setDescription("The user to view (Defaults to yourself)"));
} }
public override async execute(interaction: CommandInteraction) { public override async execute(interaction: CommandInteraction) {
const page = interaction.options.get("page"); const page = interaction.options.get("page");
const user = interaction.options.getUser("user") || interaction.user;
try { try {
let pageNumber = 0; let pageNumber = 0;
@ -25,7 +30,7 @@ export default class Inventory extends Command {
pageNumber = Number(page.value) - 1; pageNumber = Number(page.value) - 1;
} }
const embed = await InventoryHelper.GenerateInventoryPage(interaction.user.username, interaction.user.id, pageNumber); const embed = await InventoryHelper.GenerateInventoryPage(user.username, user.id, pageNumber);
await interaction.reply({ await interaction.reply({
embeds: [ embed.embed ], embeds: [ embed.embed ],

77
src/commands/view.ts Normal file
View file

@ -0,0 +1,77 @@
import { AttachmentBuilder, CommandInteraction, DiscordAPIError, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import { CoreClient } from "../client/client";
import { readFileSync } from "fs";
import path from "path";
import Inventory from "../database/entities/app/Inventory";
import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata";
export default class View extends Command {
constructor() {
super();
this.CommandBuilder = new SlashCommandBuilder()
.setName("view")
.setDescription("View a specific command")
.addStringOption(x =>
x
.setName("cardnumber")
.setDescription("The card number to view")
.setRequired(true));
}
public override async execute(interaction: CommandInteraction) {
const cardNumber = interaction.options.get("cardnumber");
if (!cardNumber || !cardNumber.value) {
await interaction.reply("Card number is required.");
return;
}
const card = CoreClient.Cards
.flatMap(x => x.cards)
.find(x => x.id == cardNumber.value);
if (!card) {
await interaction.reply("Card not found.");
return;
}
const series = CoreClient.Cards
.find(x => x.cards.includes(card))!;
let image: Buffer;
const imageFileName = card.path.split("/").pop()!;
try {
image = readFileSync(path.join(process.env.DATA_DIR!, "cards", card.path));
} catch {
await interaction.reply(`Unable to fetch image for card ${card.id}.`);
return;
}
await interaction.deferReply();
const attachment = new AttachmentBuilder(image, { name: imageFileName });
const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, card.id);
const quantityClaimed = inventory ? inventory.Quantity : 0;
const embed = CardDropHelperMetadata.GenerateDropEmbed({ card, series }, quantityClaimed, imageFileName);
try {
await interaction.editReply({
embeds: [ embed ],
files: [ attachment ],
});
} catch (e) {
console.error(e);
if (e instanceof DiscordAPIError) {
await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. Code: ${e.code}.`);
} else {
await interaction.editReply("Unable to send next drop. Please try again, and report this if it keeps happening. Code: UNKNOWN.");
}
}
}
}

View file

@ -1,5 +1,6 @@
export default class EmbedColours { export default class EmbedColours {
public static readonly Ok = 0x3050ba; public static readonly Ok = 0x3050ba;
public static readonly Error = 0xff0000;
public static readonly Grey = 0xd3d3d3; public static readonly Grey = 0xd3d3d3;
public static readonly BronzeCard = 0xcd7f32; public static readonly BronzeCard = 0xcd7f32;
public static readonly SilverCard = 0xc0c0c0; public static readonly SilverCard = 0xc0c0c0;

View file

@ -63,7 +63,7 @@ export default class CardDropHelperMetadata {
return new EmbedBuilder() return new EmbedBuilder()
.setTitle(drop.card.name) .setTitle(drop.card.name)
.setDescription(description) .setDescription(description)
.setFooter({ text: CardRarityToString(drop.card.type) }) .setFooter({ text: `${CardRarityToString(drop.card.type)} · ${drop.card.id}` })
.setColor(CardRarityToColour(drop.card.type)) .setColor(CardRarityToColour(drop.card.type))
.setImage(`attachment://${imageFileName}`); .setImage(`attachment://${imageFileName}`);
} }

View file

@ -3,6 +3,7 @@ import Inventory from "../database/entities/app/Inventory";
import { CoreClient } from "../client/client"; import { CoreClient } from "../client/client";
import EmbedColours from "../constants/EmbedColours"; import EmbedColours from "../constants/EmbedColours";
import { CardRarity, CardRarityToString } from "../constants/CardRarity"; import { CardRarity, CardRarityToString } from "../constants/CardRarity";
import cloneDeep from "clone-deep";
interface InventoryPage { interface InventoryPage {
id: number, id: number,
@ -24,7 +25,9 @@ export default class InventoryHelper {
const inventory = await Inventory.FetchAllByUserId(userid); const inventory = await Inventory.FetchAllByUserId(userid);
const allSeriesClaimed = CoreClient.Cards const clientCards = cloneDeep(CoreClient.Cards);
const allSeriesClaimed = clientCards
.sort((a, b) => a.id - b.id) .sort((a, b) => a.id - b.id)
.filter(x => { .filter(x => {
x.cards = x.cards x.cards = x.cards

View file

@ -8,6 +8,7 @@ import Gdrivesync from "./commands/gdrivesync";
import Give from "./commands/give"; import Give from "./commands/give";
import Inventory from "./commands/inventory"; import Inventory from "./commands/inventory";
import Resync from "./commands/resync"; import Resync from "./commands/resync";
import View from "./commands/view";
// Test Command Imports // Test Command Imports
import Dropnumber from "./commands/stage/dropnumber"; import Dropnumber from "./commands/stage/dropnumber";
@ -27,6 +28,7 @@ export default class Registry {
CoreClient.RegisterCommand("give", new Give()); CoreClient.RegisterCommand("give", new Give());
CoreClient.RegisterCommand("inventory", new Inventory()); CoreClient.RegisterCommand("inventory", new Inventory());
CoreClient.RegisterCommand("resync", new Resync()); CoreClient.RegisterCommand("resync", new Resync());
CoreClient.RegisterCommand("view", new View());
// Test Commands // Test Commands
CoreClient.RegisterCommand("dropnumber", new Dropnumber(), Environment.Test); CoreClient.RegisterCommand("dropnumber", new Dropnumber(), Environment.Test);