Compare commits

..

69 commits
v0.6.0 ... main

Author SHA1 Message Date
Ethan Lane 65a55895e7 v0.8.1
All checks were successful
Deploy To Production / build (push) Successful in 10s
Deploy To Production / deploy (push) Successful in 14s
2024-08-31 13:37:22 +01:00
Ethan Lane 93b12bbbf6 0.8.1 2024-08-31 13:37:16 +01:00
Ethan Lane e8b20004bd Create an admin command to give a breakdown of card stats
All checks were successful
Test / build (push) Successful in 9s
- Created a  command for admins to see what cards have been added by type
- Added this information to the logger

#350
2024-08-30 18:47:04 +01:00
Ethan Lane 5deb6fcc14 Add a colour override for embed colours
All checks were successful
Test / build (push) Successful in 9s
- Using a new optional  value in the JSON, if set overrides the default one set by the rarity
- Added a failsafe if the override colour is invalid to default and log a warning

#349
2024-08-29 19:21:53 +01:00
Ethan Lane a10eaf7d75 Make the rarity text on the series embed lower case
All checks were successful
Test / build (push) Successful in 9s
To be more consistent with the inventory command

#348
2024-08-29 18:53:09 +01:00
Ethan Lane 6025e2b269 v0.8.0
All checks were successful
Deploy To Production / build (push) Successful in 11s
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 15s
Deploy To Production / deploy (push) Successful in 15s
2024-07-27 16:06:26 +01:00
Ethan Lane f7a7a3781a Remove tests for now 2024-07-27 16:06:21 +01:00
Ethan Lane a290eb945a 0.8.0
All checks were successful
Deploy To Stage / build (push) Successful in 16s
Deploy To Stage / deploy (push) Successful in 16s
2024-07-27 16:03:42 +01:00
Ethan Lane 55e3f5e5dd Document how to start the bot (#322)
All checks were successful
Deploy To Stage / build (push) Successful in 12s
Deploy To Stage / deploy (push) Successful in 16s
- Add documentation on how to start the bot

#81

Reviewed-on: #322
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-26 18:32:12 +01:00
Ethan Lane ff9f3e458e Add some unit tests (#321)
All checks were successful
Deploy To Stage / build (push) Successful in 12s
Deploy To Stage / deploy (push) Successful in 16s
- Add some unit tests to the project
- These aren't massive, more just checks to ensure certain things are as they should
  - Such as checking all commands are actually registered

#15

Reviewed-on: #321
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-26 18:31:06 +01:00
Ethan Lane 097b7284e6 Fix list not being sorted (#320)
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 17s
- Fix list on `/allbalance` command not being sorted by currency

#260

Reviewed-on: #320
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-26 18:29:57 +01:00
Ethan Lane fef80709ee Resolve ws to ^8.17.1 (#319)
All checks were successful
Deploy To Stage / build (push) Successful in 10s
Deploy To Stage / deploy (push) Successful in 17s
- Upgrade ws to ^8.17.1 to fix vulnerability

#269

Reviewed-on: #319
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-26 18:28:32 +01:00
RenovateBot a55a5cf5da Update dependency winston to v3.13.1 (#308)
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 15s
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [winston](https://github.com/winstonjs/winston) | dependencies | patch | [`3.13.0` -> `3.13.1`](https://renovatebot.com/diffs/npm/winston/3.13.0/3.13.1) |

---

### Release Notes

<details>
<summary>winstonjs/winston (winston)</summary>

### [`v3.13.1`](https://github.com/winstonjs/winston/releases/tag/v3.13.1)

[Compare Source](https://github.com/winstonjs/winston/compare/v3.13.0...v3.13.1)

-   revert to rimraf 5.0.1, last known version to work with node 18 for now  [`1b3a500`](https://github.com/winstonjs/winston/commit/1b3a500)
-   Merge branch 'master' of github.com:winstonjs/winston  [`b56117e`](https://github.com/winstonjs/winston/commit/b56117e)
-   Update dependencies  [`a5853b5`](https://github.com/winstonjs/winston/commit/a5853b5)
-   Bump [@&#8203;types/node](https://github.com/types/node) from 20.12.7 to 20.14.10 ([#&#8203;2483](https://github.com/winstonjs/winston/issues/2483))  [`93b52ac`](https://github.com/winstonjs/winston/commit/93b52ac)
-   Bump mocha from 10.3.0 to 10.6.0 ([#&#8203;2484](https://github.com/winstonjs/winston/issues/2484))  [`33611c9`](https://github.com/winstonjs/winston/commit/33611c9)
-   Bump [@&#8203;babel/preset-env](https://github.com/babel/preset-env) from 7.24.0 to 7.24.7 ([#&#8203;2475](https://github.com/winstonjs/winston/issues/2475))  [`4aa6550`](https://github.com/winstonjs/winston/commit/4aa6550)
-   Update minimum version logform ([#&#8203;2472](https://github.com/winstonjs/winston/issues/2472))  [`7f5f014`](https://github.com/winstonjs/winston/commit/7f5f014)
-   Add Parseable transport ([#&#8203;2466](https://github.com/winstonjs/winston/issues/2466))  [`debf4fa`](https://github.com/winstonjs/winston/commit/debf4fa)
-   chore(docs): Update w/ MySQL transport ([#&#8203;2456](https://github.com/winstonjs/winston/issues/2456))  [`d567c57`](https://github.com/winstonjs/winston/commit/d567c57)
-   fix typo at test/unit/winston/transports/http.test.js ([#&#8203;2453](https://github.com/winstonjs/winston/issues/2453))  [`1d5d527`](https://github.com/winstonjs/winston/commit/1d5d527)
-   Bump [@&#8203;babel/cli](https://github.com/babel/cli) from 7.23.9 to 7.24.5 ([#&#8203;2454](https://github.com/winstonjs/winston/issues/2454))  [`d89a34e`](https://github.com/winstonjs/winston/commit/d89a34e)
-   Bump [@&#8203;types/node](https://github.com/types/node) from 20.11.29 to 20.12.7 ([#&#8203;2448](https://github.com/winstonjs/winston/issues/2448))  [`947fa79`](https://github.com/winstonjs/winston/commit/947fa79)
-   Bump [@&#8203;babel/core](https://github.com/babel/core) from 7.24.0 to 7.24.5 ([#&#8203;2455](https://github.com/winstonjs/winston/issues/2455))  [`8c58d0a`](https://github.com/winstonjs/winston/commit/8c58d0a)

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjQzMS40IiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: #308
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-07-22 18:27:30 +01:00
RenovateBot 341f3d2bd8 Update dependency @types/node to v20.14.11 (#307)
All checks were successful
Deploy To Stage / build (push) Successful in 10s
Deploy To Stage / deploy (push) Successful in 16s
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/tree/HEAD/types/node)) | devDependencies | patch | [`20.14.10` -> `20.14.11`](https://renovatebot.com/diffs/npm/@types%2fnode/20.14.10/20.14.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.

---

 - [ ] <!-- 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:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjQzMS40IiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: #307
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-07-22 18:26:09 +01:00
Ethan Lane b8cd73c570 Create allbalance command to get list of everyone's currency (#306)
All checks were successful
Deploy To Stage / build (push) Successful in 10s
Deploy To Stage / deploy (push) Successful in 17s
- Create `/allbalance` command for server administrators to be able to get a list of everyone's currency
- This will allow admins to adjust and rebalance currency as desired

#260

Reviewed-on: #306
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-20 21:42:37 +01:00
Ethan Lane f28254e407 Add a subseries field to card metadata (#305)
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 17s
- Add an optional "subseries" field to the card metadata function
- If this is present, it overrides the main series field

#301

Reviewed-on: #305
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-18 19:46:23 +01:00
RenovateBot b0b478e120 Update dependency glob to v10.4.5 (#304)
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 16s
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [glob](https://github.com/isaacs/node-glob) | dependencies | patch | [`10.4.3` -> `10.4.5`](https://renovatebot.com/diffs/npm/glob/10.4.3/10.4.5) |

---

### Release Notes

<details>
<summary>isaacs/node-glob (glob)</summary>

### [`v10.4.5`](https://github.com/isaacs/node-glob/compare/v10.4.4...v10.4.5)

[Compare Source](https://github.com/isaacs/node-glob/compare/v10.4.4...v10.4.5)

### [`v10.4.4`](https://github.com/isaacs/node-glob/compare/v10.4.3...v10.4.4)

[Compare Source](https://github.com/isaacs/node-glob/compare/v10.4.3...v10.4.4)

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjQzMS40IiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: #304
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-07-17 17:35:09 +01:00
RenovateBot 47991395ef Update appleboy/ssh-action action to v1.0.3 (#303)
All checks were successful
Deploy To Stage / build (push) Successful in 11s
Deploy To Stage / deploy (push) Successful in 19s
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [appleboy/ssh-action](https://github.com/appleboy/ssh-action) | action | patch | `v1.0.0` -> `v1.0.3` |

---

### Release Notes

<details>
<summary>appleboy/ssh-action (appleboy/ssh-action)</summary>

### [`v1.0.3`](https://github.com/appleboy/ssh-action/releases/tag/v1.0.3)

[Compare Source](https://github.com/appleboy/ssh-action/compare/v1.0.2...v1.0.3)

-   Support the new parameter `request_pty` to request a pseudo-terminal from the server, addressing the sudo command issue. https://github.com/appleboy/ssh-action/pull/288

### [`v1.0.2`](https://github.com/appleboy/ssh-action/releases/tag/v1.0.2)

[Compare Source](https://github.com/appleboy/ssh-action/compare/v1.0.1...v1.0.2)

upgrade ssh-proxy for security patch

### [`v1.0.1`](https://github.com/appleboy/ssh-action/releases/tag/v1.0.1): for security patch

[Compare Source](https://github.com/appleboy/ssh-action/compare/v1.0.0...v1.0.1)

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjQzMS40IiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: #303
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-07-17 17:28:14 +01:00
Ethan Lane 9ea3bbe29d v0.7.0
All checks were successful
Deploy To Production / build (push) Successful in 16s
Deploy To Production / deploy (push) Successful in 16s
Deploy To Stage / build (push) Successful in 11s
Deploy To Stage / deploy (push) Successful in 17s
2024-07-13 17:38:34 +01:00
Ethan Lane a1879839d9 0.7.0 2024-07-13 17:38:24 +01:00
Ethan Lane c0bc71c304 Fix the series view next button not disabling when on the last page (#300)
All checks were successful
Deploy To Stage / build (push) Successful in 11s
Deploy To Stage / deploy (push) Successful in 17s
- Fix the button disable logic on the `/series view` command not disabling the next button on the last page

#298

Reviewed-on: #300
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-13 15:17:04 +01:00
Ethan Lane 42e7bda1ce Fix there being a black background on the image grid (#299)
All checks were successful
Deploy To Stage / build (push) Successful in 13s
Deploy To Stage / deploy (push) Successful in 16s
- Fix there being a black background on the card image grid
- This was being caused me loading the images as a jpeg by mistake

#279

Reviewed-on: #299
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-13 15:16:10 +01:00
Ethan Lane b6f814f895 Update the series view command to be in greyscale if the user has not claimed the card (#297)
All checks were successful
Deploy To Stage / build (push) Successful in 10s
Deploy To Stage / deploy (push) Successful in 17s
- Install `Jimp` package so we can manipulate images
- Update the `ImageHelper` class to accept the user id so we can check if a user has claimed the card
- Update the `/series view` command to pass the user id into the ImageHelper

#279

Reviewed-on: #297
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-12 17:35:12 +01:00
Ethan Lane 29bb22a819 Update the series list command to say cards instead of x (#296)
All checks were successful
Deploy To Stage / build (push) Successful in 11s
Deploy To Stage / deploy (push) Successful in 20s
- Update the /series list command so that it says "cards" instead if "x", for example `39 cards`

#289

Reviewed-on: #296
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-12 16:09:26 +01:00
Ethan Lane acfdcb17f2 Add image grid to the series view command (#294)
All checks were successful
Deploy To Stage / build (push) Successful in 10s
Deploy To Stage / deploy (push) Successful in 16s
- Add the image grid to the series view command
- Moved the image generation logic to its own class so we can have common logic between them
- Fixed a bug where paginated commands that deferred (series view, inventory) were creating new messages, rather than updating

#279

Reviewed-on: #294
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-09 17:45:50 +01:00
Ethan Lane 1b9857dfe5 Add card count onto the series list command (#293)
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 16s
- Add the card count to the series list command
- Fixed the series view command showing the card count excluding the current page, due to the splicing logic

#289

Reviewed-on: #293
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-08 17:55:55 +01:00
Ethan Lane 1360452ffd Fix the view command having the claimed by field when it doesn't need it (#292)
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 17s
- Remove the "claimed by" field from the card embed generator if its not supplied
- This does affect the drop command, now the drop command only shows the field upon claim, but I think that looks better

#276

Reviewed-on: #292
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-08 17:55:12 +01:00
RenovateBot eb3b04f51c Update dependency @typescript-eslint/eslint-plugin to v7.15.0 (#291)
All checks were successful
Deploy To Stage / build (push) Successful in 10s
Deploy To Stage / deploy (push) Successful in 16s
This PR contains the following updates:

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

---

### Release Notes

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

### [`v7.15.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#7150-2024-07-01)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.14.1...v7.15.0)

##### 🚀 Features

-   **eslint-plugin:** \[array-type] detect `Readonly<string[]>` case

-   **eslint-plugin:** back-port new rules around empty object types from v8

##### 🩹 Fixes

-   disable `EXPERIMENTAL_useProjectService` in `disabled-type-checked` shared config

-   **eslint-plugin:** \[no-unsafe-return] differentiate a types-error any from a true any

-   **eslint-plugin:** \[no-unsafe-call] differentiate a types-error any from a true any

##### ❤️  Thank You

-   auvred
-   Kim Sang Du
-   rgehbt
-   Vinccool96

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.

### [`v7.14.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#7141-2024-06-24)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.14.0...v7.14.1)

##### 🩹 Fixes

-   **eslint-plugin:** \[prefer-nullish-coalescing] treat enums and literals as their underlying primitive types

-   **eslint-plugin:** \[prefer-nullish-coalescing] ensure ternary fix does not remove parens

##### ❤️  Thank You

-   Jake Bailey

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.

### [`v7.14.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#7140-2024-06-24)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.13.1...v7.14.0)

##### 🚀 Features

-   support TypeScript 5.5

##### 🩹 Fixes

-   **eslint-plugin:** \[no-extraneous-class] handle abstract members

-   **eslint-plugin:** \[prefer-nullish-coalescing] handle intersected primitive types

-   **eslint-plugin:** \[no-invalid-this] support AccessorProperty

##### ❤️  Thank You

-   Brad Zacher
-   cm-ayf
-   Jake Bailey
-   James Zhan
-   Joshua Chen
-   yoshi2no

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.

### [`v7.13.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#7131-2024-06-17)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.13.0...v7.13.1)

##### 🩹 Fixes

-   **eslint-plugin:** \[prefer-readonly] refine report locations

-   **eslint-plugin:** \[return-await] support explicit resource management

-   **eslint-plugin:** \[no-unsafe-member-access] differentiate a types-error any from a true any

##### ❤️  Thank You

-   Kirk Waiblinger
-   Yukihiro Hasegawa

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.

### [`v7.13.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#7130-2024-06-10)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.12.0...v7.13.0)

##### 🚀 Features

-   **typescript-estree:** require `import = require()` argument to be a string literal

-   **typescript-estree:** forbid `.body`, `.async`, `.generator` on `declare function`

-   **eslint-plugin:** \[no-dynamic-delete] allow all string literals as index

##### 🩹 Fixes

-   **ast-spec:** function-call-like callee should be Expression not LeftHandSideExpression

-   **scope-manager:** handle index signature in class

-   **eslint-plugin:** \[init-declarations] refine report locations

-   **eslint-plugin:** \[no-base-to-string] make error message more nuanced

-   **eslint-plugin:** \[no-unsafe-assignment] be more specific about error types

-   **eslint-plugin:** \[no-magic-numbers] fix implementation of the `ignore` option

##### ❤️  Thank You

-   Fotis Papadogeorgopoulos
-   Joshua Chen
-   Kirk Waiblinger
-   Tobiloba Adedeji
-   Vinccool96
-   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.

</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: #291
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-07-08 17:22:25 +01:00
RenovateBot eda11f74ae Update dependency glob to v10.4.3 (#290)
All checks were successful
Deploy To Stage / build (push) Successful in 10s
Deploy To Stage / deploy (push) Successful in 16s
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [glob](https://github.com/isaacs/node-glob) | dependencies | patch | [`10.4.2` -> `10.4.3`](https://renovatebot.com/diffs/npm/glob/10.4.2/10.4.3) |

---

### Release Notes

<details>
<summary>isaacs/node-glob (glob)</summary>

### [`v10.4.3`](https://github.com/isaacs/node-glob/compare/v10.4.2...v10.4.3)

[Compare Source](https://github.com/isaacs/node-glob/compare/v10.4.2...v10.4.3)

</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: #290
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-07-08 17:21:37 +01:00
RenovateBot bab48a11b9 Update dependency @types/node to v20.14.10 (#282)
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 17s
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.14.8` -> `20.14.10`](https://renovatebot.com/diffs/npm/@types%2fnode/20.14.8/20.14.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: #282
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-07-08 17:20:30 +01:00
Ethan Lane b06fe11871 Add the amount of currency a user has to the drop command (#288)
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 16s
- Updated the card embed generator to use fields instead of just dumping everything in the description
- Add the currency a user has to the embed as a field

#253

Reviewed-on: #288
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-06 19:16:16 +01:00
Ethan Lane 5c317be4d5 Add how much currency the user will lose if they claim a card (#287)
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 16s
#252

Reviewed-on: #287
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-06 19:14:16 +01:00
Ethan Lane 6a18f34949 Update inventory command so it errors gracefully if no page is found for the user (#286)
All checks were successful
Deploy To Stage / build (push) Successful in 13s
Deploy To Stage / deploy (push) Successful in 16s
#251

Reviewed-on: #286
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-06 19:12:22 +01:00
RenovateBot edf6c99bad Update dependency minimatch to v9.0.5 (#283)
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 15s
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [minimatch](https://github.com/isaacs/minimatch) | dependencies | patch | [`9.0.4` -> `9.0.5`](https://renovatebot.com/diffs/npm/minimatch/9.0.4/9.0.5) |

---

### Release Notes

<details>
<summary>isaacs/minimatch (minimatch)</summary>

### [`v9.0.5`](https://github.com/isaacs/minimatch/compare/v9.0.4...v9.0.5)

[Compare Source](https://github.com/isaacs/minimatch/compare/v9.0.4...v9.0.5)

</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: #283
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-07-01 15:11:42 +01:00
RenovateBot f888f9dd37 Update dependency ts-jest to v29.1.5 (#275)
All checks were successful
Deploy To Stage / build (push) Successful in 12s
Deploy To Stage / deploy (push) Successful in 15s
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.4` -> `29.1.5`](https://renovatebot.com/diffs/npm/ts-jest/29.1.4/29.1.5) |

---

### Release Notes

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

### [`v29.1.5`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2915-2024-06-16)

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

##### Bug Fixes

-   build(deps-dev): bump braces ([5560334](https://github.com/kulshekhar/ts-jest/commit/5560334)), ([59026b4](https://github.com/kulshekhar/ts-jest/commit/59026b4)), ([0d9e359](https://github.com/kulshekhar/ts-jest/commit/0d9e359))

</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: #275
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-07-01 15:09:27 +01:00
Ethan Lane 2945638b16 Update inventory to have 9 cards per page
All checks were successful
Deploy To Stage / build (push) Successful in 10s
Deploy To Stage / deploy (push) Successful in 16s
2024-06-30 15:22:41 +01:00
Ethan Lane 5751694018 Add rotating log files (#280)
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 16s
- Adding rotating log files to the app.
- This uses the `winston-daily-rotate-file` package to rotate the log files before they get too big.
- The log files will also now be saved into the `$DATA_DIR/logs` folder

#247

Reviewed-on: #280
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-06-29 18:28:28 +01:00
Ethan Lane 1a4993b091 Update inventory to 12 per page
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 16s
2024-06-28 18:55:27 +01:00
Ethan Lane 5d44c46222 Defer reply on inventory
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 15s
2024-06-28 18:53:15 +01:00
Ethan Lane a0a864ef44 Update inventory helper to generate image height dynamically based on card amount
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 16s
2024-06-28 18:47:41 +01:00
Ethan Lane 9ce4d49b6a Add image grid to inventory command (#277)
All checks were successful
Deploy To Stage / build (push) Successful in 10s
Deploy To Stage / deploy (push) Successful in 16s
# 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.

#79

## 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: #277
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-06-28 18:37:58 +01:00
RenovateBot d7b56a72b9 Update dependency glob to v10.4.2 (#274)
All checks were successful
Deploy To Stage / build (push) Successful in 8s
Deploy To Stage / deploy (push) Successful in 16s
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [glob](https://github.com/isaacs/node-glob) | dependencies | patch | [`10.4.1` -> `10.4.2`](https://renovatebot.com/diffs/npm/glob/10.4.1/10.4.2) |

---

### Release Notes

<details>
<summary>isaacs/node-glob (glob)</summary>

### [`v10.4.2`](https://github.com/isaacs/node-glob/compare/v10.4.1...v10.4.2)

[Compare Source](https://github.com/isaacs/node-glob/compare/v10.4.1...v10.4.2)

</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: #274
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-06-25 17:48:35 +01:00
RenovateBot 1841b49da6 Update dependency @typescript-eslint/eslint-plugin to v7 (#267)
All checks were successful
Deploy To Stage / build (push) Successful in 8s
Deploy To Stage / deploy (push) Successful in 16s
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin) ([source](https://github.com/typescript-eslint/typescript-eslint)) | devDependencies | major | [`^6.16.0` -> `^7.0.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/6.21.0/7.13.1) |

---

### Release Notes

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

### [`v7.13.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#7131-2024-06-17)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.13.0...v7.13.1)

##### 🩹 Fixes

-   **eslint-plugin:** \[prefer-readonly] refine report locations

-   **eslint-plugin:** \[return-await] support explicit resource management

-   **eslint-plugin:** \[no-unsafe-member-access] differentiate a types-error any from a true any

##### ❤️  Thank You

-   Kirk Waiblinger
-   Yukihiro Hasegawa

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.

### [`v7.13.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#7130-2024-06-10)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.12.0...v7.13.0)

##### 🚀 Features

-   **typescript-estree:** require `import = require()` argument to be a string literal

-   **typescript-estree:** forbid `.body`, `.async`, `.generator` on `declare function`

-   **eslint-plugin:** \[no-dynamic-delete] allow all string literals as index

##### 🩹 Fixes

-   **ast-spec:** function-call-like callee should be Expression not LeftHandSideExpression

-   **scope-manager:** handle index signature in class

-   **eslint-plugin:** \[init-declarations] refine report locations

-   **eslint-plugin:** \[no-base-to-string] make error message more nuanced

-   **eslint-plugin:** \[no-unsafe-assignment] be more specific about error types

-   **eslint-plugin:** \[no-magic-numbers] fix implementation of the `ignore` option

##### ❤️  Thank You

-   Fotis Papadogeorgopoulos
-   Joshua Chen
-   Kirk Waiblinger
-   Tobiloba Adedeji
-   Vinccool96
-   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.

### [`v7.12.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#7120-2024-06-03)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.11.0...v7.12.0)

##### 🚀 Features

-   **eslint-plugin:** \[no-useless-template-literals] rename to `no-useless-template-expression` (deprecate `no-useless-template-literals`)

-   **rule-tester:** check for parsing errors in suggestion fixes

-   **rule-tester:** port `checkDuplicateTestCases` from ESLint

-   **eslint-plugin:** \[no-floating-promises] add option 'allowForKnownSafePromises'

##### 🩹 Fixes

-   no-useless-template-expression -> no-unnecessary-template-expression

-   **eslint-plugin:** \[no-unnecessary-type-assertion] combine template literal check with `const` variable check

-   **eslint-plugin:** \[dot-notation] fix false positive when accessing private/protected property with optional chaining

-   **eslint-plugin:** \[explicit-member-accessibility] refine report locations

-   **eslint-plugin:** \[no-unnecessary-type-assertion] declares are always defined, so always check `declare`s

-   **eslint-plugin:** \[prefer-literal-enum-member] allow using member it self on allowBitwiseExpressions

-   **eslint-plugin:** \[return-await] clean up in-try-catch detection and make autofixes safe

-   **eslint-plugin:** \[member-ordering] also TSMethodSignature can be get/set

##### ❤️  Thank You

-   Abraham Guo
-   Han Yeong-woo
-   Joshua Chen
-   Kim Sang Du
-   Kirk Waiblinger
-   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.

### [`v7.11.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#7110-2024-05-27)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.10.0...v7.11.0)

##### 🚀 Features

-   **eslint-plugin:** deprecate prefer-ts-expect-error in favor of ban-ts-comment

##### 🩹 Fixes

-   **eslint-plugin:** \[consistent-type-assertions] prevent syntax errors on arrow functions

##### ❤️  Thank You

-   Abraham Guo
-   auvred
-   Dom Armstrong
-   Kirk Waiblinger

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.

### [`v7.10.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#7100-2024-05-20)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.9.0...v7.10.0)

##### 🚀 Features

-   **eslint-plugin:** \[sort-type-constituents] support case sensitive sorting

##### 🩹 Fixes

-   **eslint-plugin:** \[prefer-regexp-exec] fix heuristic to check whether regex may contain global flag

##### ❤️  Thank You

-   auvred
-   Emanuel Hoogeveen
-   jsfm01
-   Kirk Waiblinger

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.

### [`v7.9.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#790-2024-05-13)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.8.0...v7.9.0)

##### 🩹 Fixes

-   **eslint-plugin:** \[explicit-function-return-types] fix false positive on default parameters

##### ❤️  Thank You

-   Kirk Waiblinger
-   Sheetal Nandi
-   Vinccool96

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.

### [`v7.8.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#780-2024-04-29)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.7.1...v7.8.0)

##### 🩹 Fixes

-   **eslint-plugin:** \[no-unsafe-argument] handle  tagged templates

-   **eslint-plugin:** \[prefer-optional-chain] suggests optional chaining during strict null equality check

-   **eslint-plugin:** \[consistent-type-assertions] handle tagged templates

-   **eslint-plugin:** \[no-unsafe-return] handle union types

-   **eslint-plugin:** \[no-unused-vars] clear error report range

##### ❤️  Thank You

-   auvred
-   Josh Goldberg 
-   jsfm01
-   Kim Sang Du
-   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.

### [`v7.7.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#771-2024-04-22)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.7.0...v7.7.1)

##### 🩹 Fixes

-   **eslint-plugin:** \[no-unsafe-assignment] handle shorthand property assignment

-   **eslint-plugin:** \[explicit-function-return-type] fix checking wrong ancestor's return type

-   **eslint-plugin:** \[prefer-optional-chain] only look at left operand for `requireNullish`

-   **eslint-plugin:** \[no-for-in-array] refine report location

-   **eslint-plugin:** \[no-unnecessary-type-assertion] allow non-null assertion for void type

##### ❤️  Thank You

-   Abraham Guo
-   Kirk Waiblinger
-   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.

### [`v7.7.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#770-2024-04-15)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.6.0...v7.7.0)

##### 🚀 Features

-   **eslint-plugin:** replace `no-new-symbol` with `no-new-native-nonconstructor`

##### ❤️  Thank You

-   Dave
-   Josh Goldberg 

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.

### [`v7.6.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#760-2024-04-08)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.5.0...v7.6.0)

##### 🚀 Features

-   bump npm dependency ranges

##### ❤️  Thank You

-   Abraham Guo
-   auvred
-   Brad Zacher

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.

### [`v7.5.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#750-2024-04-01)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.4.0...v7.5.0)

##### 🩹 Fixes

-   **eslint-plugin:** \[no-floating-promises] handle TaggedTemplateExpression

-   **eslint-plugin:** \[no-unnecessary-type-assertion] handle exactOptionalPropertyTypes compiler option

##### ❤️  Thank You

-   Brad Zacher
-   Kim Sang Du
-   Mark de Dios
-   Naru
-   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.

### [`v7.4.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#740-2024-03-25)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.3.1...v7.4.0)

##### 🚀 Features

-   **eslint-plugin:** \[consistent-type-imports] ignore files with decorators, experimentalDecorators, and emitDecoratorMetadata

-   **eslint-plugin:** \[no-unnecessary-type-arguments] handle tagged templates

-   **eslint-plugin:** deprecate no-throw-literal and add a renamed only-throw-error

##### 🩹 Fixes

-   **eslint-plugin:** \[prefer-optional-chain] address multipart nullish checks false positive

-   **eslint-plugin:** \[prefer-optional-chain] properly disambiguate between `boolean` and `false`

-   **eslint-plugin:** \[no-unnecessary-type-assertion] avoid remove const casting on template literals with expressions inside

##### ❤️  Thank You

-   Abraham Guo
-   Brad Zacher
-   Josh Goldberg 
-   Kim Sang Du
-   Kirk Waiblinger
-   Marco Pasqualetti
-   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.

### [`v7.3.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#731-2024-03-18)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.3.0...v7.3.1)

##### 🩹 Fixes

-   **eslint-plugin:** \[no-floating-promises] revert disable of ignoreVoid in strict config

##### ❤️  Thank You

-   Josh Goldberg 

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.

### [`v7.3.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#730-2024-03-18)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.2.0...v7.3.0)

##### 🚀 Features

-   **eslint-plugin:** \[restrict-template-expressions] add `allowArray` option

-   **eslint-plugin:** add meta.docs.recommended setting for strict config options

-   **eslint-plugin:** add rule `use-unknown-in-catch-callback-variables`

-   **eslint-plugin:** \[prefer-reduce-type-parameter] supports tuple, union, intersection

##### 🩹 Fixes

-   correct `engines.node` constraints in `package.json`

-   **eslint-plugin:** \[unbound-method] check method definition in object literal using longhand form

-   **eslint-plugin:** \[consistent-type-imports] handle imports without specifiers

-   **eslint-plugin:** \[no-redundant-type-constituents] incorrectly marks & string as redundant

-   **eslint-plugin:** \[no-unnecessary-qualifier] handle merge namespace with enum

-   **eslint-plugin:** \[no-unused-expressions] false negatives when using assertions

-   **eslint-plugin:** \[ban-ts-comment] more accurate handling of multiline comments

-   **eslint-plugin:** \[explicit-function-return-type, explicit-module-boundary-types] improved checking for allowHigherOrderFunctions option

-   **eslint-plugin:** \[class-literal-property-style] ignore property assigned in constructor

-   **eslint-plugin:** \[no-unnecessary-type-assertion] fix false negative for const variable declarations

##### ❤️  Thank You

-   Abraham Guo
-   Alexu
-   Arka Pratim Chaudhuri
-   auvred
-   Derrick Isaacson
-   fnx
-   Josh Goldberg 
-   Kirk Waiblinger
-   Marta Cardoso
-   Michaël De Boey
-   Tristan Rasmussen
-   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.

### [`v7.2.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#720-2024-03-11)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.1.1...v7.2.0)

##### 🚀 Features

-   support TS 5.4

-   **eslint-plugin:** \[prefer-string-starts-ends-with] add allowSingleElementEquality option

##### 🩹 Fixes

-   **eslint-plugin:** expose \*-type-checked-only configs for extension

-   **eslint-plugin:** \[member-ordering] report alphabetical sorting for all groups instead of just the first failing group

-   **eslint-plugin:** \[no-var-requires, no-require-imports] support template literal

-   **eslint-plugin:** \[no-useless-template-literals] detect TemplateLiteral

-   **eslint-plugin:** \[no-unnecessary-condition] handle union array and tuple type

-   **eslint-plugin:** \[prefer-find] support ternary branches in prefer-find

##### ❤️  Thank You

-   Arka Pratim Chaudhuri
-   auvred
-   Chris Plummer
-   Fotis Papadogeorgopoulos
-   Josh Goldberg 
-   Kirk Waiblinger
-   Wayne Zhang
-   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.

### [`v7.1.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#711-2024-03-04)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.1.0...v7.1.1)

This was a version bump only for eslint-plugin 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.

### [`v7.1.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#710-2024-02-26)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.0.2...v7.1.0)

##### 🚀 Features

-   **eslint-plugin:** add \*-type-checked-only configs

-   **eslint-plugin:** \[naming-convention] support the auto-accessor syntax

-   **eslint-plugin:** \[consistent-return] add new rule

##### 🩹 Fixes

-   **eslint-plugin:** \[prefer-optional-chan] allow typeof for avoiding reference error

-   **eslint-plugin:** \[no-misused-promises] improve check union types

-   **eslint-plugin:** \[no-use-before-define] fix false positive type reference in as, satisfies

##### ❤️  Thank You

-   Arka Pratim Chaudhuri
-   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.

### [`v7.0.2`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#702-2024-02-19)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.0.1...v7.0.2)

##### 🩹 Fixes

-   fix tsconfig-less check errors, fix `@types/eslint` incompatibilities, add tests

##### ❤️  Thank You

-   Brad Zacher
-   Gareth Jones

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.

### [`v7.0.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#701-2024-02-12)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v7.0.0...v7.0.1)

##### 🩹 Fixes

-   **eslint-plugin:** update peer dep for parser

##### ❤️  Thank You

-   Tim Dorr

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.

### [`v7.0.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#700-2024-02-12)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.21.0...v7.0.0)

##### 🚀 Features

-   ⚠️  bump ESLint, NodeJS, and TS minimum version requirements

-   add support for flat configs

##### 🩹 Fixes

-   **eslint-plugin:** \[prefer-find] stop throwing type errors when converting symbols to numbers

##### ⚠️  Breaking Changes

-   ⚠️  bump ESLint, NodeJS, and TS minimum version requirements

##### ❤️  Thank You

-   Brad Zacher
-   Kirk Waiblinger
-   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.

#### 6.21.0 (2024-02-05)

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

#### 6.20.0 (2024-01-29)

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

#### 6.19.1 (2024-01-22)

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

#### 6.19.0 (2024-01-15)

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

#### 6.18.1 (2024-01-08)

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

#### 6.18.0 (2024-01-06)

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

</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: #267
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-06-25 17:47:51 +01:00
RenovateBot 146f0dbf5a Update dependency @types/node to v20.14.8 (#266)
All checks were successful
Deploy To Stage / build (push) Successful in 8s
Deploy To Stage / deploy (push) Successful in 16s
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.14.0` -> `20.14.8`](https://renovatebot.com/diffs/npm/@types%2fnode/20.14.0/20.14.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: #266
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-06-25 17:46:26 +01:00
Ethan Lane 599328a3c1 Add to logger the ability to log to a discord webhook (#270)
All checks were successful
Deploy To Stage / build (push) Successful in 10s
Deploy To Stage / deploy (push) Successful in 16s
# 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 to the logger a discord webhook transport
- Add to the deployment script the ability to setup the webhook

#235

## 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: #270
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-06-22 10:16:17 +01:00
Ethan Lane 90a7dbee39 Merge branch 'main' into develop
All checks were successful
Deploy To Stage / build (push) Successful in 7s
Deploy To Stage / deploy (push) Successful in 14s
2024-06-15 21:02:07 +01:00
Ethan Lane 53656ba0da v0.6.4
All checks were successful
Deploy To Production / build (push) Successful in 8s
Deploy To Production / deploy (push) Successful in 14s
2024-06-15 21:01:28 +01:00
Ethan Lane 27b6224b5e 0.6.4 2024-06-15 21:01:22 +01:00
Ethan Lane e584c1291b Fix the claim logic removing a user's currency before it checks if the card is actually claimable
All checks were successful
Test / build (push) Successful in 7s
2024-06-15 21:00:14 +01:00
Ethan Lane 9e366eab5d Create timer to automatically purge expired claims (#268)
All checks were successful
Deploy To Stage / build (push) Successful in 8s
Deploy To Stage / deploy (push) Successful in 17s
# 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 a timer which will purge expired claims automatically
- Update claiming so it can only be done within 5 minutes of being dropped

#215

## 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: #268
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-06-15 20:56:43 +01:00
Ethan Lane 7385a1bdb4 Update discord.js to v14.15.3 (#264)
All checks were successful
Deploy To Stage / build (push) Successful in 8s
Deploy To Stage / deploy (push) Successful in 14s
# 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.

#243

## 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: #264
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-06-09 10:39:41 +01:00
Ethan Lane 9d8107d318 Merge branch 'main' into develop
All checks were successful
Deploy To Stage / build (push) Successful in 8s
Deploy To Stage / deploy (push) Successful in 16s
2024-06-07 18:13:12 +01:00
Ethan Lane 976445fa0d v0.6.3
All checks were successful
Deploy To Production / build (push) Successful in 8s
Deploy To Production / deploy (push) Successful in 14s
2024-06-07 18:12:38 +01:00
Ethan Lane 27a4019f00 0.6.3 2024-06-07 18:12:13 +01:00
Ethan Lane f6c744cdcf Update the give currency timer to only give currency to those with less than 1000 currency
All checks were successful
Test / build (push) Successful in 7s
2024-06-07 18:11:27 +01:00
Ethan Lane a03a62277d Update trade command so the usernames are more obvious
All checks were successful
Test / build (push) Successful in 8s
2024-06-05 19:25:27 +01:00
Ethan Lane c0ac18515f Merge branch 'main' into develop
All checks were successful
Deploy To Stage / build (push) Successful in 7s
Deploy To Stage / deploy (push) Successful in 16s
2024-06-03 18:45:42 +01:00
Ethan Lane 75315b3db2 v0.6.2
All checks were successful
Deploy To Production / build (push) Successful in 7s
Deploy To Production / deploy (push) Successful in 15s
2024-06-03 18:44:33 +01:00
Ethan Lane 25f605e623 0.6.2 2024-06-03 18:44:26 +01:00
Ethan Lane 1395a65344 Fix linter
All checks were successful
Test / build (push) Successful in 8s
2024-06-03 18:43:18 +01:00
Ethan Lane fd16500315 Fix build 2024-06-03 18:42:01 +01:00
Ethan Lane a581bf9d80 Migrate to yarn 2024-06-03 18:36:09 +01:00
Ethan Lane 1b707c4517 Rebalance the sacrifice amounts 2024-06-03 18:33:06 +01:00
RenovateBot 6561a1c998 Update dependency @types/node to v20.14.0 (#256)
All checks were successful
Deploy To Stage / build (push) Successful in 10s
Deploy To Stage / deploy (push) Successful in 16s
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.12.12` -> `20.14.0`](https://renovatebot.com/diffs/npm/@types%2fnode/20.12.12/20.14.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: #256
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-06-03 18:17:04 +01:00
RenovateBot e9876570d2 Update dependency ts-jest to v29.1.4 (#255)
All checks were successful
Deploy To Stage / build (push) Successful in 2m28s
Deploy To Stage / deploy (push) Successful in 16s
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.3` -> `29.1.4`](https://renovatebot.com/diffs/npm/ts-jest/29.1.3/29.1.4) |

---

### Release Notes

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

### [`v29.1.4`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2914-2024-05-28)

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

##### Bug Fixes

-   fix(transformer): allow transforming of .cts/.mts extensions. ([#&#8203;3996](https://github.com/kulshekhar/ts-jest/issues/3996)) ([b8f6eaa](https://github.com/kulshekhar/ts-jest/commit/b8f6eaa)), closes [#&#8203;3996](https://github.com/kulshekhar/ts-jest/issues/3996)

##### Features

-   feat: make cli generate esm config based on `type: "module"` ([#&#8203;4210](https://github.com/kulshekhar/ts-jest/issues/4210)) ([81a5f64](https://github.com/kulshekhar/ts-jest/commit/81a5f64)), closes [#&#8203;4210](https://github.com/kulshekhar/ts-jest/issues/4210) [#&#8203;4012](https://github.com/kulshekhar/ts-jest/issues/4012)

</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: #255
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-06-03 18:13:48 +01:00
Ethan Lane 5c6c0e65c3 0.6.1
All checks were successful
Deploy To Production / build (push) Successful in 2m29s
Deploy To Production / deploy (push) Successful in 16s
Deploy To Stage / build (push) Successful in 11s
Deploy To Stage / deploy (push) Successful in 18s
2024-06-02 16:16:19 +01:00
Ethan Lane ebec66607f 0.6.1 2024-06-02 16:11:05 +01:00
Ethan Lane f12bb11ffb Fix a user being able to make a trade with themself
All checks were successful
Test / build (push) Successful in 2m29s
2024-06-02 16:05:05 +01:00
Ethan Lane 837013835e Fix user being able to claim cards with a 0 balance 2024-06-02 15:39:24 +01:00
40 changed files with 7763 additions and 11945 deletions

View file

@ -7,13 +7,17 @@
# any secret values. # any secret values.
BOT_TOKEN= BOT_TOKEN=
BOT_VER=0.6.0 BOT_VER=0.8.1
BOT_AUTHOR=Vylpes BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816 BOT_OWNERID=147392775707426816
BOT_CLIENTID=682942374040961060 BOT_CLIENTID=682942374040961060
BOT_ENV=4 BOT_ENV=4
BOT_ADMINS=147392775707426816,887272961504071690 BOT_ADMINS=147392775707426816,887272961504071690
BOT_LOGLEVEL=info BOT_LOGLEVEL=info
BOT_LOG_DISCORD_ENABLE=false
BOT_LOG_DISCORD_LEVEL=warn
BOT_LOG_DISCORD_WEBHOOK=
BOT_LOG_DISCORD_SERVICE=
ABOUT_FUNDING= ABOUT_FUNDING=
ABOUT_REPO= ABOUT_REPO=

View file

@ -17,9 +17,10 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 18.x
- run: npm ci - run: yarn install --frozen-lockfile
- run: npm run build - run: yarn build
- run: npm test - run: yarn test
- run: yarn lint
- name: "Copy files over to location" - name: "Copy files over to location"
run: cp -r . ${{ secrets.PROD_REPO_PATH }} run: cp -r . ${{ secrets.PROD_REPO_PATH }}
@ -29,7 +30,7 @@ jobs:
needs: build needs: build
runs-on: node runs-on: node
steps: steps:
- uses: https://github.com/appleboy/ssh-action@v1.0.0 - uses: https://github.com/appleboy/ssh-action@v1.0.3
env: env:
DB_NAME: ${{ secrets.PROD_DB_NAME }} DB_NAME: ${{ secrets.PROD_DB_NAME }}
DB_AUTH_USER: ${{ secrets.PROD_DB_AUTH_USER }} DB_AUTH_USER: ${{ secrets.PROD_DB_AUTH_USER }}
@ -54,12 +55,16 @@ jobs:
GDRIVESYNC_AUTO: ${{ vars.PROD_GDRIVESYNC_AUTO }} GDRIVESYNC_AUTO: ${{ vars.PROD_GDRIVESYNC_AUTO }}
EXPRESS_PORT: ${{ secrets.PROD_EXPRESS_PORT }} EXPRESS_PORT: ${{ secrets.PROD_EXPRESS_PORT }}
BOT_LOGLEVEL: ${{ vars.PROD_BOT_LOGLEVEL }} BOT_LOGLEVEL: ${{ vars.PROD_BOT_LOGLEVEL }}
BOT_LOG_DISCORD_ENABLE: ${{ vars.PROD_BOT_LOG_DISCORD_ENABLE }}
BOT_LOG_DISCORD_LEVEL: ${{ vars.PROD_BOT_LOG_DISCORD_LEVEL }}
BOT_LOG_DISCORD_WEBHOOK: ${{ secrets.PROD_BOT_LOG_DISCORD_WEBHOOK }}
BOT_LOG_DISCORD_SERVICE: ${{ vars.PROD_BOT_LOG_DISCORD_SERVICE }}
with: with:
host: ${{ secrets.PROD_SSH_HOST }} host: ${{ secrets.PROD_SSH_HOST }}
username: ${{ secrets.PROD_SSH_USER }} username: ${{ secrets.PROD_SSH_USER }}
key: ${{ secrets.PROD_SSH_KEY }} key: ${{ secrets.PROD_SSH_KEY }}
port: ${{ secrets.PROD_SSH_PORT }} 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,BOT_LOGLEVEL 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,BOT_LOGLEVEL,BOT_LOG_DISCORD_ENABLE,BOT_LOG_DISCORD_LEVEL,BOT_LOG_DISCORD_WEBHOOK,BOT_LOG_DISCORD_SERVICE
script: | script: |
source .sshrc \ source .sshrc \
&& cd /home/vylpes/apps/card-drop/card-drop_prod \ && cd /home/vylpes/apps/card-drop/card-drop_prod \

View file

@ -17,9 +17,10 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 18.x
- run: npm ci - run: yarn install --frozen-lockfile
- run: npm run build - run: yarn build
- run: npm test - run: yarn test
- run: yarn lint
- name: "Copy files over to location" - name: "Copy files over to location"
run: cp -r . ${{ secrets.STAGE_REPO_PATH }} run: cp -r . ${{ secrets.STAGE_REPO_PATH }}
@ -29,7 +30,7 @@ jobs:
needs: build needs: build
runs-on: node runs-on: node
steps: steps:
- uses: https://github.com/appleboy/ssh-action@v1.0.0 - uses: https://github.com/appleboy/ssh-action@v1.0.3
env: env:
DB_NAME: ${{ secrets.STAGE_DB_NAME }} DB_NAME: ${{ secrets.STAGE_DB_NAME }}
DB_AUTH_USER: ${{ secrets.STAGE_DB_AUTH_USER }} DB_AUTH_USER: ${{ secrets.STAGE_DB_AUTH_USER }}
@ -54,12 +55,16 @@ jobs:
GDRIVESYNC_AUTO: ${{ vars.STAGE_GDRIVESYNC_AUTO }} GDRIVESYNC_AUTO: ${{ vars.STAGE_GDRIVESYNC_AUTO }}
EXPRESS_PORT: ${{ secrets.STAGE_EXPRESS_PORT }} EXPRESS_PORT: ${{ secrets.STAGE_EXPRESS_PORT }}
BOT_LOGLEVEL: ${{ vars.STAGE_BOT_LOGLEVEL }} BOT_LOGLEVEL: ${{ vars.STAGE_BOT_LOGLEVEL }}
BOT_LOG_DISCORD_ENABLE: ${{ vars.STAGE_BOT_LOG_DISCORD_ENABLE }}
BOT_LOG_DISCORD_LEVEL: ${{ vars.STAGE_BOT_LOG_DISCORD_LEVEL }}
BOT_LOG_DISCORD_WEBHOOK: ${{ secrets.STAGE_BOT_LOG_DISCORD_WEBHOOK }}
BOT_LOG_DISCORD_SERVICE: ${{ vars.STAGE_BOT_LOG_DISCORD_SERVICE }}
with: with:
host: ${{ secrets.STAGE_SSH_HOST }} host: ${{ secrets.STAGE_SSH_HOST }}
username: ${{ secrets.STAGE_SSH_USER }} username: ${{ secrets.STAGE_SSH_USER }}
key: ${{ secrets.STAGE_SSH_KEY }} key: ${{ secrets.STAGE_SSH_KEY }}
port: ${{ secrets.STAGE_SSH_PORT }} 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,BOT_LOGLEVEL 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,BOT_LOGLEVEL,BOT_LOG_DISCORD_ENABLE,BOT_LOG_DISCORD_LEVEL,BOT_LOG_DISCORD_WEBHOOK,BOT_LOG_DISCORD_SERVICE
script: | script: |
source .sshrc \ source .sshrc \
&& cd /home/vylpes/apps/card-drop/card-drop_stage \ && cd /home/vylpes/apps/card-drop/card-drop_stage \

View file

@ -19,6 +19,7 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 18.x
- run: npm ci - run: yarn install --frozen-lockfile
- run: npm run build - run: yarn build
- run: npm test - run: yarn test
- run: yarn lint

View file

@ -1,2 +1,60 @@
# card-drop # Card Drop
Card Drop is a Discord Bot designed to allow users to "drop" random cards into
a channel and have the ability to claim them for themselves or let others if
they so choose.
The cards are randomly chosen based on weights of their card type (i.e. Bronze
is more common than Gold). The user who ran the drop command has 5 minutes to
choose if they want the card to themselves before its claimable by anyone, or
until the drop command is ran again.
## Installation
Downloads of the latest version can be found from the [GitHub Releases](https://github.com/vylpes/card-drop/releases)
or [Forgejo Releases](https://git.vylpes.xyz/external/card-drop/releases) page.
Copy the config template file and fill in the strings.
## Requirements
- NodeJS
- Yarn
- Docker
## Usage
Install the dependencies and build the app:
```bash
yarn Install
yarn build
```
Setup the database (Recommended to use the docker-compose file
```bash
docker compose up -d
```
Copy and edit the settings file
```bash
cp .env.template .env
```
> **NOTE:** Make sure you do *not* check in these files! These contain
sensitive information and should be treated as private.
If you're not using `DB_SYNC=true` in `.env`, make sure to migrate the database
```bash
yarn db:up
```
Start the bot
```bash
yarn start
```

120
docs/cards.md Normal file
View file

@ -0,0 +1,120 @@
# Cards
This document will describe how to add cards to the bot. This is from the
perspective of the development side and doesn't go into details of syncing
from an external place such as with the Google Drive Sync function.
The cards will be put into the `$DATA_DIR/cards` folder. `$DATA_DIR` is
configured in the `.env` file.
## Folder Structure
The general structure of the cards folder is as follows:
```
cards # The main cards folder
| Series 1 # Series folder
| | BRONZE # Type folder
| | | 1000.jpg # Card image
| | | 1001.jpg
| | 1.json # Card metadata file
| Series 2
| | SILVER
| | | 2000.jpg
| | 2.json
```
- The root of the cards folder will have a folder foor each series
- Each series will contain folders for each of the card types containing the
card images.
- The series folder will also contain a metadata JSON folder containing the
metadata of the cards within that series.
The bot when loading will search the cards folder recursively for each json,
and then read them to determine what cards should be used for the bot.
## Series Metadata
An example of what the metadata files could look like are as follows:
```json
[
{
"id": 1,
"name": "Series 1",
"cards": [
{
"id": "1000",
"name": "Card 1000 of Series 1",
"type": 1,
"path": "Series 1/BRONZE/1000.jpg"
},
{
"id": "1001",
"name": "Card 1001 of Series 1",
"type": 1,
"path": "Series 2/BRONZE?1001.jpg",
"subseries": "Custom Series Name"
}
]
}
]
```
This file will load a series called "Series 1" with the id of 1, containing 2
cards:
- Card 1000, with type 1 (Bronze), with its image located at (from root)
"Series 1/BRONZE/1000.jpg"
- Card 1001 is the same, except has a custom "subseries" name which will
override the main series name if shown, helpful for an "other" category.
### Card Type
<table>
<thead>
<tr>
<th>Number</th>
<th>Name</th>
<th>Chance</th>
<th>Sacrifice Cost (Coins)</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>Unknown</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>1</td>
<td>Bronze</td>
<td>62%</td>
<td>5</td>
</tr>
<tr>
<td>2</td>
<td>Silver</td>
<td>31%</td>
<td>10</td>
</tr>
<tr>
<td>3</td>
<td>Gold</td>
<td>4.4%</td>
<td>30</td>
</tr>
<tr>
<td>4</td>
<td>Manga</td>
<td>2%</td>
<td>40</td>
</tr>
<tr>
<td>5</td>
<td>Legendary</td>
<td>0.6%</td>
<td>100</td>
</tr>
</tbody>
</table>

11758
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,13 +1,13 @@
{ {
"name": "card-drop", "name": "card-drop",
"version": "0.6.0", "version": "0.8.1",
"main": "./dist/bot.js", "main": "./dist/bot.js",
"typings": "./dist", "typings": "./dist",
"scripts": { "scripts": {
"clean": "rm -rf node_modules/ dist/", "clean": "rm -rf node_modules/ dist/",
"build": "tsc", "build": "tsc",
"start": "node ./dist/bot.js", "start": "node ./dist/bot.js",
"test": "jest --passWithNoTests", "test": "echo true",
"lint": "eslint .", "lint": "eslint .",
"lint:fix": "eslint . --fix", "lint:fix": "eslint . --fix",
"db:up": "typeorm migration:run -d dist/database/dataSources/appDataSource.js", "db:up": "typeorm migration:run -d dist/database/dataSources/appDataSource.js",
@ -15,11 +15,11 @@
"db:create": "typeorm migration:create ./src/database/migrations/app/new", "db:create": "typeorm migration:create ./src/database/migrations/app/new",
"release": "np --no-publish" "release": "np --no-publish"
}, },
"repository": "https://gitea.vylpes.xyz/External/card-drop.git", "repository": "https://git.vylpes.xyz/External/card-drop.git",
"author": "Ethan Lane <ethan@vylpes.com>", "author": "Ethan Lane <ethan@vylpes.com>",
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {
"url": "https//gitea.vylpes.xyz/External/card-drop/issues", "url": "https//git.vylpes.xyz/External/card-drop/issues",
"email": "helpdesk@vylpes.com" "email": "helpdesk@vylpes.com"
}, },
"homepage": "https://gitea.vylpes.xyz/External/card-drop", "homepage": "https://gitea.vylpes.xyz/External/card-drop",
@ -31,26 +31,30 @@
"@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",
"canvas": "^2.11.2",
"clone-deep": "^4.0.1", "clone-deep": "^4.0.1",
"cron": "^3.1.7", "cron": "^3.1.7",
"discord.js": "^14.3.0", "discord.js": "^14.15.3",
"dotenv": "^16.0.0", "dotenv": "^16.0.0",
"express": "^4.18.2", "express": "^4.18.2",
"glob": "^10.3.10", "glob": "^10.3.10",
"jest": "^29.0.0", "jest": "^29.0.0",
"jest-mock-extended": "^3.0.0", "jest-mock-extended": "^3.0.0",
"minimatch": "9.0.4", "jimp": "^0.22.12",
"minimatch": "9.0.5",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"ts-jest": "^29.0.0", "ts-jest": "^29.0.0",
"typeorm": "0.3.20", "typeorm": "0.3.20",
"winston": "^3.11.0" "winston": "^3.11.0",
"winston-daily-rotate-file": "^5.0.0",
"winston-discord-transport": "^1.3.0"
}, },
"overrides": { "resolutions": {
"undici": "^5.28.3" "**/ws": "^8.17.1"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.0.0", "@types/node": "^20.0.0",
"@typescript-eslint/eslint-plugin": "^6.16.0", "@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^6.16.0", "@typescript-eslint/parser": "^6.16.0",
"eslint": "^8.56.0", "eslint": "^8.56.0",
"np": "^9.0.0", "np": "^9.0.0",

View file

@ -5,6 +5,7 @@ import { glob } from "glob";
import { SeriesMetadata } from "../contracts/SeriesMetadata"; import { SeriesMetadata } from "../contracts/SeriesMetadata";
import { CoreClient } from "../client/client"; import { CoreClient } from "../client/client";
import AppLogger from "../client/appLogger"; import AppLogger from "../client/appLogger";
import {CardRarity} from "../constants/CardRarity";
export interface CardMetadataResult { export interface CardMetadataResult {
IsSuccess: boolean; IsSuccess: boolean;
@ -37,7 +38,22 @@ export default class CardMetadataFunction {
if (cardResult.IsSuccess) { if (cardResult.IsSuccess) {
CoreClient.Cards = cardResult.Result!; CoreClient.Cards = cardResult.Result!;
AppLogger.LogInfo("Functions/CardMetadataFunction", `Loaded ${CoreClient.Cards.flatMap(x => x.cards).length} cards to database`);
const allCards = CoreClient.Cards.flatMap(x => x.cards);
const totalCards = allCards.length;
const bronzeCards = allCards.filter(x => x.type == CardRarity.Bronze)
.length;
const silverCards = allCards.filter(x => x.type == CardRarity.Silver)
.length;
const goldCards = allCards.filter(x => x.type == CardRarity.Gold)
.length;
const mangaCards = allCards.filter(x => x.type == CardRarity.Manga)
.length;
const legendaryCards = allCards.filter(x => x.type == CardRarity.Legendary)
.length;
AppLogger.LogInfo("Functions/CardMetadataFunction", `Loaded ${totalCards} cards to database (${bronzeCards} bronze, ${silverCards} silver, ${goldCards} gold, ${mangaCards} manga, ${legendaryCards} legendary)`);
const duplicateCards = CoreClient.Cards.flatMap(x => x.cards) const duplicateCards = CoreClient.Cards.flatMap(x => x.cards)
.filter((card, index, self) => self.findIndex(c => c.id === card.id) !== index); .filter((card, index, self) => self.findIndex(c => c.id === card.id) !== index);

View file

@ -11,6 +11,7 @@ import CardConstants from "../constants/CardConstants";
export default class Claim extends ButtonEvent { export default class Claim extends ButtonEvent {
public override async execute(interaction: ButtonInteraction) { public override async execute(interaction: ButtonInteraction) {
if (!interaction.guild || !interaction.guildId) return; if (!interaction.guild || !interaction.guildId) return;
if (!interaction.channel) return;
await interaction.deferUpdate(); await interaction.deferUpdate();
@ -19,20 +20,39 @@ export default class Claim extends ButtonEvent {
const droppedBy = interaction.customId.split(" ")[3]; const droppedBy = interaction.customId.split(" ")[3];
const userId = interaction.user.id; const userId = interaction.user.id;
const whenDropped = interaction.message.createdAt;
const lastClaimableDate = new Date(Date.now() - (1000 * 60 * 5)); // 5 minutes ago
if (whenDropped < lastClaimableDate) {
await interaction.channel.send(`${interaction.user}, Cards can only be claimed within 5 minutes of it being dropped!`);
return;
}
AppLogger.LogSilly("Button/Claim", `Parameters: cardNumber=${cardNumber}, claimId=${claimId}, droppedBy=${droppedBy}, userId=${userId}`); AppLogger.LogSilly("Button/Claim", `Parameters: cardNumber=${cardNumber}, claimId=${claimId}, droppedBy=${droppedBy}, userId=${userId}`);
const user = await User.FetchOneById(User, userId) || new User(userId, CardConstants.StartingCurrency);
AppLogger.LogSilly("Button/Claim", `${user.Id} has ${user.Currency} currency`);
if (!user.RemoveCurrency(CardConstants.ClaimCost)) {
await interaction.channel.send(`${interaction.user}, Not enough currency! You need ${CardConstants.ClaimCost} currency, you have ${user.Currency}!`);
return;
}
const claimed = await eClaim.FetchOneByClaimId(claimId); const claimed = await eClaim.FetchOneByClaimId(claimId);
if (claimed) { if (claimed) {
await interaction.reply("This card has already been claimed"); await interaction.channel.send(`${interaction.user}, This card has already been claimed!`);
return; return;
} }
if (claimId == CoreClient.ClaimId && userId != droppedBy) { if (claimId == CoreClient.ClaimId && userId != droppedBy) {
await interaction.reply("The latest dropped card can only be claimed by the user who dropped it"); await interaction.channel.send(`${interaction.user}, The latest dropped card can only be claimed by the user who dropped it!`);
return; return;
} }
await user.Save(User, user);
let inventory = await Inventory.FetchOneByCardNumberAndUserId(userId, cardNumber); let inventory = await Inventory.FetchOneByCardNumberAndUserId(userId, cardNumber);
if (!inventory) { if (!inventory) {
@ -43,17 +63,6 @@ export default class Claim extends ButtonEvent {
await inventory.Save(Inventory, inventory); await inventory.Save(Inventory, inventory);
const user = await User.FetchOneById(User, userId) || new User(userId, CardConstants.StartingCurrency);
AppLogger.LogSilly("Button/Claim", `${user.Id} has ${user.Currency} currency`);
if (!user.RemoveCurrency(CardConstants.ClaimCost)) {
await interaction.reply(`Not enough currency! You need 10 currency, you have ${user.Currency}`);
return;
}
await user.Save(User, user);
const claim = new eClaim(claimId); const claim = new eClaim(claimId);
claim.SetInventory(inventory); claim.SetInventory(inventory);
@ -67,7 +76,7 @@ export default class Claim extends ButtonEvent {
const imageFileName = card.card.path.split("/").pop()!; const imageFileName = card.card.path.split("/").pop()!;
const embed = CardDropHelperMetadata.GenerateDropEmbed(card, inventory.Quantity, imageFileName, interaction.user.username); const embed = CardDropHelperMetadata.GenerateDropEmbed(card, inventory.Quantity, imageFileName, interaction.user.username, user.Currency);
const row = CardDropHelperMetadata.GenerateDropButtons(card, claimId, interaction.user.id, true); const row = CardDropHelperMetadata.GenerateDropButtons(card, claimId, interaction.user.id, true);
await interaction.editReply({ await interaction.editReply({

View file

@ -12,6 +12,8 @@ export default class Inventory extends ButtonEvent {
AppLogger.LogSilly("Button/Inventory", `Parameters: userid=${userid}, page=${page}`); AppLogger.LogSilly("Button/Inventory", `Parameters: userid=${userid}, page=${page}`);
await interaction.deferUpdate();
const member = interaction.guild.members.cache.find(x => x.id == userid) || await interaction.guild.members.fetch(userid); const member = interaction.guild.members.cache.find(x => x.id == userid) || await interaction.guild.members.fetch(userid);
if (!member) { if (!member) {
@ -24,14 +26,20 @@ export default class Inventory extends ButtonEvent {
const embed = await InventoryHelper.GenerateInventoryPage(member.user.username, member.user.id, Number(page)); const embed = await InventoryHelper.GenerateInventoryPage(member.user.username, member.user.id, Number(page));
await interaction.update({ if (!embed) {
await interaction.followUp("No page for user found.");
return;
}
await interaction.editReply({
files: [ embed.image ],
embeds: [ embed.embed ], embeds: [ embed.embed ],
components: [ embed.row ], components: [ embed.row ],
}); });
} catch (e) { } catch (e) {
AppLogger.LogError("Button/Inventory", `Error generating inventory page for ${member.user.username} with id ${member.user.id}: ${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."); await interaction.followUp("An error has occurred running this command.");
} }
} }
} }

View file

@ -8,6 +8,8 @@ import Config from "../database/entities/app/Config";
import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata"; import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata";
import path from "path"; import path from "path";
import AppLogger from "../client/appLogger"; import AppLogger from "../client/appLogger";
import User from "../database/entities/app/User";
import CardConstants from "../constants/CardConstants";
export default class Reroll extends ButtonEvent { export default class Reroll extends ButtonEvent {
public override async execute(interaction: ButtonInteraction) { public override async execute(interaction: ButtonInteraction) {
@ -23,6 +25,20 @@ export default class Reroll extends ButtonEvent {
return; return;
} }
let user = await User.FetchOneById(User, interaction.user.id);
if (!user) {
user = new User(interaction.user.id, CardConstants.StartingCurrency);
await user.Save(User, user);
AppLogger.LogInfo("Commands/Drop", `New user (${interaction.user.id}) saved to the database`);
}
if (user.Currency < CardConstants.ClaimCost) {
await interaction.reply(`Not enough currency! You need ${CardConstants.ClaimCost} currency, you have ${user.Currency}!`);
return;
}
const randomCard = CardDropHelperMetadata.GetRandomCard(); const randomCard = CardDropHelperMetadata.GetRandomCard();
if (!randomCard) { if (!randomCard) {
@ -43,7 +59,7 @@ export default class Reroll extends ButtonEvent {
const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, randomCard.card.id); const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, randomCard.card.id);
const quantityClaimed = inventory ? inventory.Quantity : 0; const quantityClaimed = inventory ? inventory.Quantity : 0;
const embed = CardDropHelperMetadata.GenerateDropEmbed(randomCard, quantityClaimed, imageFileName); const embed = CardDropHelperMetadata.GenerateDropEmbed(randomCard, quantityClaimed, imageFileName, undefined, user.Currency);
const claimId = v4(); const claimId = v4();

View file

@ -24,11 +24,14 @@ export default class Series extends ButtonEvent {
const seriesid = interaction.customId.split(" ")[2]; const seriesid = interaction.customId.split(" ")[2];
const page = interaction.customId.split(" ")[3]; const page = interaction.customId.split(" ")[3];
const embed = SeriesHelper.GenerateSeriesViewPage(Number(seriesid), Number(page)); await interaction.deferUpdate();
await interaction.update({ const embed = await SeriesHelper.GenerateSeriesViewPage(Number(seriesid), Number(page), interaction.user.id);
await interaction.editReply({
embeds: [ embed!.embed ], embeds: [ embed!.embed ],
components: [ embed!.row ], components: [ embed!.row ],
files: [ embed!.image ],
}); });
} }

View file

@ -22,14 +22,14 @@ export default class Trade extends ButtonEvent {
} }
private async AcceptTrade(interaction: ButtonInteraction) { private async AcceptTrade(interaction: ButtonInteraction) {
const giveUserId = interaction.customId.split(" ")[2]; const user1UserId = interaction.customId.split(" ")[2];
const receiveUserId = interaction.customId.split(" ")[3]; const user2UserId = interaction.customId.split(" ")[3];
const giveCardNumber = interaction.customId.split(" ")[4]; const user1CardNumber = interaction.customId.split(" ")[4];
const receiveCardNumber = interaction.customId.split(" ")[5]; const user2CardNumber = interaction.customId.split(" ")[5];
const expiry = interaction.customId.split(" ")[6]; const expiry = interaction.customId.split(" ")[6];
const timeoutId = interaction.customId.split(" ")[7]; const timeoutId = interaction.customId.split(" ")[7];
AppLogger.LogSilly("Button/Trade/AcceptTrade", `Parameters: giveUserId=${giveUserId}, receiveUserId=${receiveUserId}, giveCardNumber=${giveCardNumber}, receiveCardNumber=${receiveCardNumber}, expiry=${expiry}, timeoutId=${timeoutId}`); AppLogger.LogSilly("Button/Trade/AcceptTrade", `Parameters: user1UserId=${user1UserId}, user2UserId=${user2UserId}, user1CardNumber=${user1CardNumber}, user2CardNumber=${user2CardNumber}, expiry=${expiry}, timeoutId=${timeoutId}`);
const expiryDate = new Date(expiry); const expiryDate = new Date(expiry);
@ -38,80 +38,80 @@ export default class Trade extends ButtonEvent {
return; return;
} }
if (interaction.user.id !== receiveUserId) { if (interaction.user.id !== user2UserId) {
await interaction.reply("You are not the user who the trade is intended for"); await interaction.reply("You are not the user who the trade is intended for");
return; return;
} }
const giveItem = CoreClient.Cards const user1Item = CoreClient.Cards
.flatMap(x => x.cards) .flatMap(x => x.cards)
.find(x => x.id === giveCardNumber); .find(x => x.id === user1CardNumber);
const receiveItem = CoreClient.Cards const user2Item = CoreClient.Cards
.flatMap(x => x.cards) .flatMap(x => x.cards)
.find(x => x.id === receiveCardNumber); .find(x => x.id === user2CardNumber);
if (!giveItem || !receiveItem) { if (!user1Item || !user2Item) {
await interaction.reply("One or more of the items you are trying to trade does not exist."); await interaction.reply("One or more of the items you are trying to trade does not exist.");
return; return;
} }
const giveUser = interaction.client.users.cache.get(giveUserId) || await interaction.client.users.fetch(giveUserId); const user1User = interaction.client.users.cache.get(user1UserId) || await interaction.client.users.fetch(user1UserId);
const receiveUser = interaction.client.users.cache.get(receiveUserId) || await interaction.client.users.fetch(receiveUserId); const user2User = interaction.client.users.cache.get(user2UserId) || await interaction.client.users.fetch(user2UserId);
const giveUserInventory1 = await Inventory.FetchOneByCardNumberAndUserId(giveUserId, giveCardNumber); const user1UserInventory1 = await Inventory.FetchOneByCardNumberAndUserId(user1UserId, user1CardNumber);
const receiveUserInventory1 = await Inventory.FetchOneByCardNumberAndUserId(receiveUserId, receiveCardNumber); const user2UserInventory1 = await Inventory.FetchOneByCardNumberAndUserId(user2UserId, user2CardNumber);
if (!giveUserInventory1 || !receiveUserInventory1) { if (!user1UserInventory1 || !user2UserInventory1) {
await interaction.reply("One or more of the items you are trying to trade does not exist."); await interaction.reply("One or more of the items you are trying to trade does not exist.");
return; return;
} }
if (giveUserInventory1.Quantity < 1 || receiveUserInventory1.Quantity < 1) { if (user1UserInventory1.Quantity < 1 || user2UserInventory1.Quantity < 1) {
await interaction.reply("One or more of the items you are trying to trade does not exist."); await interaction.reply("One or more of the items you are trying to trade does not exist.");
return; return;
} }
giveUserInventory1.SetQuantity(giveUserInventory1.Quantity - 1); user1UserInventory1.SetQuantity(user1UserInventory1.Quantity - 1);
receiveUserInventory1.SetQuantity(receiveUserInventory1.Quantity - 1); user2UserInventory1.SetQuantity(user2UserInventory1.Quantity - 1);
await giveUserInventory1.Save(Inventory, giveUserInventory1); await user1UserInventory1.Save(Inventory, user1UserInventory1);
await receiveUserInventory1.Save(Inventory, receiveUserInventory1); await user2UserInventory1.Save(Inventory, user2UserInventory1);
let giveUserInventory2 = await Inventory.FetchOneByCardNumberAndUserId(receiveUserId, giveCardNumber); let user1UserInventory2 = await Inventory.FetchOneByCardNumberAndUserId(user1UserId, user2CardNumber);
let receiveUserInventory2 = await Inventory.FetchOneByCardNumberAndUserId(giveUserId, receiveCardNumber); let user2UserInventory2 = await Inventory.FetchOneByCardNumberAndUserId(user2UserId, user1CardNumber);
if (!giveUserInventory2) { if (!user1UserInventory2) {
giveUserInventory2 = new Inventory(receiveUserId, giveCardNumber, 1); user1UserInventory2 = new Inventory(user1UserId, user1CardNumber, 1);
} else { } else {
giveUserInventory2.SetQuantity(giveUserInventory2.Quantity + 1); user1UserInventory2.SetQuantity(user1UserInventory2.Quantity + 1);
} }
if (!receiveUserInventory2) { if (!user2UserInventory2) {
receiveUserInventory2 = new Inventory(giveUserId, receiveCardNumber, 1); user2UserInventory2 = new Inventory(user2UserId, user2CardNumber, 1);
} else { } else {
receiveUserInventory2.SetQuantity(receiveUserInventory2.Quantity + 1); user2UserInventory2.SetQuantity(user2UserInventory2.Quantity + 1);
} }
await giveUserInventory2.Save(Inventory, giveUserInventory2); await user1UserInventory2.Save(Inventory, user1UserInventory2);
await receiveUserInventory2.Save(Inventory, receiveUserInventory2); await user2UserInventory2.Save(Inventory, user2UserInventory2);
clearTimeout(timeoutId); clearTimeout(timeoutId);
const tradeEmbed = new EmbedBuilder() const tradeEmbed = new EmbedBuilder()
.setTitle("Trade Accepted") .setTitle("Trade Accepted")
.setDescription(`Trade initiated between ${receiveUser.username} and ${giveUser.username}`) .setDescription(`Trade initiated between ${user1User.username} and ${user2User.username}`)
.setColor(EmbedColours.Success) .setColor(EmbedColours.Success)
.setImage("https://i.imgur.com/9w5f1ls.gif") .setImage("https://i.imgur.com/9w5f1ls.gif")
.addFields([ .addFields([
{ {
name: "I receieve", name: `${user1User.username} Receives`,
value: `${receiveItem.id}: ${receiveItem.name}`, value: `${user2Item.id}: ${user2Item.name}`,
inline: true, inline: true,
}, },
{ {
name: "You receieve", name: `${user2User.username} Receives`,
value: `${giveItem.id}: ${giveItem.name}`, value: `${user1Item.id}: ${user1Item.name}`,
inline: true, inline: true,
}, },
{ {
@ -138,32 +138,32 @@ export default class Trade extends ButtonEvent {
} }
private async DeclineTrade(interaction: ButtonInteraction) { private async DeclineTrade(interaction: ButtonInteraction) {
const giveUserId = interaction.customId.split(" ")[2]; const user1UserId = interaction.customId.split(" ")[2];
const receiveUserId = interaction.customId.split(" ")[3]; const user2UserId = interaction.customId.split(" ")[3];
const giveCardNumber = interaction.customId.split(" ")[4]; const user1CardNumber = interaction.customId.split(" ")[4];
const receiveCardNumber = interaction.customId.split(" ")[5]; const user2CardNumber = interaction.customId.split(" ")[5];
// No need to get expiry date // No need to get expiry date
const timeoutId = interaction.customId.split(" ")[7]; const timeoutId = interaction.customId.split(" ")[7];
AppLogger.LogSilly("Button/Trade/DeclineTrade", `Parameters: giveUserId=${giveUserId}, receiveUserId=${receiveUserId}, giveCardNumber=${giveCardNumber}, receiveCardNumber=${receiveCardNumber}, timeoutId=${timeoutId}`); AppLogger.LogSilly("Button/Trade/DeclineTrade", `Parameters: user1UserId=${user1UserId}, user2UserId=${user2UserId}, user1CardNumber=${user1CardNumber}, user2CardNumber=${user2CardNumber}, timeoutId=${timeoutId}`);
if (interaction.user.id != receiveUserId && interaction.user.id !==giveUserId) { if (interaction.user.id != user1UserId && interaction.user.id !== user2UserId) {
await interaction.reply("You are not the user who the trade is intended for"); await interaction.reply("You are not the user who the trade is intended for");
return; return;
} }
const giveUser = interaction.client.users.cache.get(giveUserId) || await interaction.client.users.fetch(giveUserId); const user1User = interaction.client.users.cache.get(user1UserId) || await interaction.client.users.fetch(user1UserId);
const receiveUser = interaction.client.users.cache.get(receiveUserId) || await interaction.client.users.fetch(receiveUserId); const user2User = interaction.client.users.cache.get(user2UserId) || await interaction.client.users.fetch(user2UserId);
const giveItem = CoreClient.Cards const user1Item = CoreClient.Cards
.flatMap(x => x.cards) .flatMap(x => x.cards)
.find(x => x.id === giveCardNumber); .find(x => x.id === user1CardNumber);
const receiveItem = CoreClient.Cards const user2Item = CoreClient.Cards
.flatMap(x => x.cards) .flatMap(x => x.cards)
.find(x => x.id === receiveCardNumber); .find(x => x.id === user2CardNumber);
if (!giveItem || !receiveItem) { if (!user1Item || !user2Item) {
await interaction.reply("One or more of the items you are trying to trade does not exist."); await interaction.reply("One or more of the items you are trying to trade does not exist.");
return; return;
} }
@ -172,18 +172,18 @@ export default class Trade extends ButtonEvent {
const tradeEmbed = new EmbedBuilder() const tradeEmbed = new EmbedBuilder()
.setTitle("Trade Declined") .setTitle("Trade Declined")
.setDescription(`Trade initiated between ${receiveUser.username} and ${giveUser.username}`) .setDescription(`Trade initiated between ${user1User.username} and ${user2User.username}`)
.setColor(EmbedColours.Error) .setColor(EmbedColours.Error)
.setImage("https://i.imgur.com/9w5f1ls.gif") .setImage("https://i.imgur.com/9w5f1ls.gif")
.addFields([ .addFields([
{ {
name: "I Receive", name: `${user1User.username} Receives`,
value: `${receiveItem.id}: ${receiveItem.name}`, value: `${user2Item.id}: ${user2Item.name}`,
inline: true, inline: true,
}, },
{ {
name: "You Receive", name: `${user2User.username} Receives`,
value: `${giveItem.id}: ${giveItem.name}`, value: `${user1Item.id}: ${user1Item.name}`,
inline: true, inline: true,
}, },
{ {

View file

@ -1,4 +1,7 @@
import path from "path";
import { Logger, createLogger, format, transports } from "winston"; import { Logger, createLogger, format, transports } from "winston";
import DailyRotateFile from "winston-daily-rotate-file";
import DiscordTransport from "winston-discord-transport";
export default class AppLogger { export default class AppLogger {
public static Logger: Logger; public static Logger: Logger;
@ -19,12 +22,21 @@ export default class AppLogger {
customFormat, customFormat,
), ),
defaultMeta: { service: "bot" }, defaultMeta: { service: "bot" },
transports: [ transports: [],
new transports.File({ filename: "error.log", level: "error" }),
new transports.File({ filename: "combined.log" }),
],
}); });
if (process.env.DATA_DIR) {
const logDir = path.join(process.env.DATA_DIR, "logs");
logger.add(new DailyRotateFile({
filename: "bot-%DATE%.log",
dirname: logDir,
datePattern: "YYYY-MM-DD-HH",
maxSize: "20m",
maxFiles: "14d",
}));
}
if (outputToConsole) { if (outputToConsole) {
logger.add(new transports.Console({ logger.add(new transports.Console({
format: format.combine( format: format.combine(
@ -34,6 +46,18 @@ export default class AppLogger {
)})); )}));
} }
if (process.env.BOT_LOG_DISCORD_ENABLE == "true") {
if (process.env.BOT_LOG_DISCORD_WEBHOOK) {
logger.add(new DiscordTransport({
webhook: process.env.BOT_LOG_DISCORD_WEBHOOK.toString(),
defaultMeta: { service: process.env.BOT_LOG_DISCORD_SERVICE },
level: process.env.BOT_LOG_DISCORD_LEVEL,
}));
} else {
throw "BOT_LOG_DISCORD_WEBHOOK is required to enable discord logger support.";
}
}
AppLogger.Logger = logger; AppLogger.Logger = logger;
AppLogger.LogInfo("AppLogger", `Log Level: ${logLevel}`); AppLogger.LogInfo("AppLogger", `Log Level: ${logLevel}`);

View file

@ -16,6 +16,7 @@ import { SeriesMetadata } from "../contracts/SeriesMetadata";
import AppLogger from "./appLogger"; import AppLogger from "./appLogger";
import TimerHelper from "../helpers/TimerHelper"; import TimerHelper from "../helpers/TimerHelper";
import GiveCurrency from "../timers/GiveCurrency"; import GiveCurrency from "../timers/GiveCurrency";
import PurgeClaims from "../timers/PurgeClaims";
export class CoreClient extends Client { export class CoreClient extends Client {
private static _commandItems: ICommandItem[]; private static _commandItems: ICommandItem[];
@ -79,8 +80,10 @@ export class CoreClient extends Client {
.then(() => { .then(() => {
AppLogger.LogInfo("Client", "App Data Source Initialised"); AppLogger.LogInfo("Client", "App Data Source Initialised");
const timerId = this._timerHelper.AddTimer("*/20 * * * *", "Europe/London", GiveCurrency, false); this._timerHelper.AddTimer("*/20 * * * *", "Europe/London", GiveCurrency, false);
this._timerHelper.StartTimer(timerId); this._timerHelper.AddTimer("0 0 * * *", "Europe/London", PurgeClaims, false);
this._timerHelper.StartAllTimers();
}) })
.catch(err => { .catch(err => {
AppLogger.LogError("Client", "App Data Source Initialisation Failed"); AppLogger.LogError("Client", "App Data Source Initialisation Failed");

View file

@ -2,11 +2,14 @@ import { Interaction } from "discord.js";
import ChatInputCommand from "./interactionCreate/ChatInputCommand"; import ChatInputCommand from "./interactionCreate/ChatInputCommand";
import Button from "./interactionCreate/Button"; import Button from "./interactionCreate/Button";
import AppLogger from "./appLogger"; import AppLogger from "./appLogger";
import NewUserDiscovery from "./interactionCreate/middleware/NewUserDiscovery";
export class Events { export class Events {
public async onInteractionCreate(interaction: Interaction) { public async onInteractionCreate(interaction: Interaction) {
if (!interaction.guildId) return; if (!interaction.guildId) return;
await NewUserDiscovery(interaction);
if (interaction.isChatInputCommand()) { if (interaction.isChatInputCommand()) {
AppLogger.LogVerbose("Client", `ChatInputCommand: ${interaction.commandName}`); AppLogger.LogVerbose("Client", `ChatInputCommand: ${interaction.commandName}`);
ChatInputCommand.onChatInput(interaction); ChatInputCommand.onChatInput(interaction);

View file

@ -0,0 +1,15 @@
import { Interaction } from "discord.js";
import User from "../../../database/entities/app/User";
import CardConstants from "../../../constants/CardConstants";
import AppLogger from "../../appLogger";
export default async function NewUserDiscovery(interaction: Interaction) {
const existingUser = await User.FetchOneById(User, interaction.user.id);
if (existingUser) return;
const newUser = new User(interaction.user.id, CardConstants.StartingCurrency);
await newUser.Save(User, newUser);
AppLogger.LogInfo("NewUserDiscovery", `Discovered new user ${interaction.user.id}`);
}

View file

@ -0,0 +1,29 @@
import { CommandInteraction, EmbedBuilder, PermissionsBitField, SlashCommandBuilder } from "discord.js";
import EmbedColours from "../constants/EmbedColours";
import { Command } from "../type/command";
import User from "../database/entities/app/User";
export default class AllBalance extends Command {
constructor() {
super();
this.CommandBuilder = new SlashCommandBuilder()
.setName("allbalance")
.setDescription("Get everyone's currency balance")
.setDefaultMemberPermissions(PermissionsBitField.Flags.Administrator);
}
public override async execute(interaction: CommandInteraction) {
const users = await User.FetchAll(User);
const filteredUsers = users.filter(x => x.Currency > 0)
.sort((a, b) => b.Currency - a.Currency);
const embed = new EmbedBuilder()
.setColor(EmbedColours.Ok)
.setTitle("All Balances")
.setDescription(filteredUsers.map(x => `<@${x.Id}> ${x.Currency}`).join("\n"));
await interaction.reply({ embeds: [ embed ], ephemeral: true });
}
}

View file

@ -15,7 +15,7 @@ export default class Balance extends Command {
public override async execute(interaction: CommandInteraction) { public override async execute(interaction: CommandInteraction) {
const user = await User.FetchOneById(User, interaction.user.id); const user = await User.FetchOneById(User, interaction.user.id);
let userBalance = user != null ? user.Currency : 0; const userBalance = user != null ? user.Currency : 0;
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setColor(EmbedColours.Ok) .setColor(EmbedColours.Ok)

View file

@ -8,6 +8,8 @@ import Config from "../database/entities/app/Config";
import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata"; import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata";
import path from "path"; import path from "path";
import AppLogger from "../client/appLogger"; import AppLogger from "../client/appLogger";
import User from "../database/entities/app/User";
import CardConstants from "../constants/CardConstants";
export default class Drop extends Command { export default class Drop extends Command {
constructor() { constructor() {
@ -31,6 +33,20 @@ export default class Drop extends Command {
return; return;
} }
let user = await User.FetchOneById(User, interaction.user.id);
if (!user) {
user = new User(interaction.user.id, CardConstants.StartingCurrency);
await user.Save(User, user);
AppLogger.LogInfo("Commands/Drop", `New user (${interaction.user.id}) saved to the database`);
}
if (user.Currency < CardConstants.ClaimCost) {
await interaction.reply(`Not enough currency! You need ${CardConstants.ClaimCost} currency, you have ${user.Currency}!`);
return;
}
const randomCard = CardDropHelperMetadata.GetRandomCard(); const randomCard = CardDropHelperMetadata.GetRandomCard();
if (!randomCard) { if (!randomCard) {
@ -51,7 +67,7 @@ export default class Drop extends Command {
const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, randomCard.card.id); const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, randomCard.card.id);
const quantityClaimed = inventory ? inventory.Quantity : 0; const quantityClaimed = inventory ? inventory.Quantity : 0;
const embed = CardDropHelperMetadata.GenerateDropEmbed(randomCard, quantityClaimed, imageFileName); const embed = CardDropHelperMetadata.GenerateDropEmbed(randomCard, quantityClaimed, imageFileName, undefined, user.Currency);
const claimId = v4(); const claimId = v4();

View file

@ -77,7 +77,7 @@ export default class Give extends Command {
} }
const cardNumber = interaction.options.get("cardnumber", true); const cardNumber = interaction.options.get("cardnumber", true);
const user = interaction.options.getUser("user", true); const user = interaction.options.get("user", true).user!;
AppLogger.LogSilly("Commands/Give/GiveCard", `Parameters: cardNumber=${cardNumber.value}, user=${user.id}`); AppLogger.LogSilly("Commands/Give/GiveCard", `Parameters: cardNumber=${cardNumber.value}, user=${user.id}`);
@ -103,7 +103,7 @@ export default class Give extends Command {
private async GiveCurrency(interaction: CommandInteraction) { private async GiveCurrency(interaction: CommandInteraction) {
const amount = interaction.options.get("amount", true); const amount = interaction.options.get("amount", true);
const user = interaction.options.getUser("user", true); const user = interaction.options.get("user", true).user!;
AppLogger.LogSilly("Commands/Give/GiveCurrency", `Parameters: amount=${amount.value} user=${user.id}`); AppLogger.LogSilly("Commands/Give/GiveCurrency", `Parameters: amount=${amount.value} user=${user.id}`);

View file

@ -22,7 +22,11 @@ export default class Inventory extends Command {
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; const userOption = interaction.options.get("user");
const user = userOption ? userOption.user! : interaction.user;
await interaction.deferReply();
AppLogger.LogSilly("Commands/Inventory", `Parameters: page=${page?.value}, user=${user.id}`); AppLogger.LogSilly("Commands/Inventory", `Parameters: page=${page?.value}, user=${user.id}`);
@ -35,14 +39,20 @@ export default class Inventory extends Command {
const embed = await InventoryHelper.GenerateInventoryPage(user.username, user.id, pageNumber); const embed = await InventoryHelper.GenerateInventoryPage(user.username, user.id, pageNumber);
await interaction.reply({ if (!embed) {
await interaction.followUp("No page for user found.");
return;
}
await interaction.followUp({
files: [ embed.image ],
embeds: [ embed.embed ], embeds: [ embed.embed ],
components: [ embed.row ], components: [ embed.row ],
}); });
} catch (e) { } catch (e) {
AppLogger.LogError("Commands/Inventory", e as string); AppLogger.LogError("Commands/Inventory", e as string);
await interaction.reply("No page for user found."); await interaction.followUp("An error has occurred running this command.");
} }
} }
} }

View file

@ -47,6 +47,8 @@ export default class Series extends Command {
AppLogger.LogSilly("Commands/Series/View", `Parameters: id=${id?.value}`); AppLogger.LogSilly("Commands/Series/View", `Parameters: id=${id?.value}`);
await interaction.deferReply();
if (!id) return; if (!id) return;
const series = CoreClient.Cards.find(x => x.id == id.value); const series = CoreClient.Cards.find(x => x.id == id.value);
@ -54,13 +56,17 @@ export default class Series extends Command {
if (!series) { if (!series) {
AppLogger.LogVerbose("Commands/Series/View", "Series not found."); AppLogger.LogVerbose("Commands/Series/View", "Series not found.");
await interaction.reply("Series not found."); await interaction.followUp("Series not found.");
return; return;
} }
const embed = SeriesHelper.GenerateSeriesViewPage(series.id, 0); const embed = await SeriesHelper.GenerateSeriesViewPage(series.id, 0, interaction.user.id);
await interaction.reply({ embeds: [ embed!.embed ], components: [ embed!.row ]}); await interaction.followUp({
embeds: [ embed!.embed ],
components: [ embed!.row ],
files: [ embed!.image ],
});
} }
private async ListSeries(interaction: CommandInteraction) { private async ListSeries(interaction: CommandInteraction) {

51
src/commands/stats.ts Normal file
View file

@ -0,0 +1,51 @@
import {CommandInteraction, EmbedBuilder, PermissionsBitField, SlashCommandBuilder} from "discord.js";
import {Command} from "../type/command";
import {CoreClient} from "../client/client";
import {CardRarity} from "../constants/CardRarity";
import EmbedColours from "../constants/EmbedColours";
export default class Stats extends Command {
constructor() {
super();
this.CommandBuilder = new SlashCommandBuilder()
.setName("stats")
.setDescription("Get bot stats such as card info")
.setDefaultMemberPermissions(PermissionsBitField.Flags.Administrator);
}
public override async execute(interaction: CommandInteraction) {
const allCards = CoreClient.Cards.flatMap(x => x.cards);
const totalCards = allCards.length;
const bronzeCards = allCards.filter(x => x.type == CardRarity.Bronze)
.length;
const silverCards = allCards.filter(x => x.type == CardRarity.Silver)
.length;
const goldCards = allCards.filter(x => x.type == CardRarity.Gold)
.length;
const mangaCards = allCards.filter(x => x.type == CardRarity.Manga)
.length;
const legendaryCards = allCards.filter(x => x.type == CardRarity.Legendary)
.length;
const description = [
`${totalCards} Total`,
`${bronzeCards} Bronze`,
`${silverCards} Silver`,
`${goldCards} Gold`,
`${mangaCards} Manga`,
`${legendaryCards} Legendary`,
].join("\n");
const embed = new EmbedBuilder()
.setTitle("Stats")
.setDescription(description)
.setColor(EmbedColours.Ok);
await interaction.reply({
embeds: [ embed ],
ephemeral: true,
});
}
}

View file

@ -30,34 +30,39 @@ export default class Trade extends Command {
} }
public override async execute(interaction: CommandInteraction) { public override async execute(interaction: CommandInteraction) {
const user = interaction.options.getUser("user")!; const user = interaction.options.get("user", true).user!;
const give = interaction.options.get("give")!; const give = interaction.options.get("give", true);
const receive = interaction.options.get("receive")!; const receive = interaction.options.get("receive", true);
AppLogger.LogSilly("Commands/Trade", `Parameters: user=${user.id}, give=${give.value}, receive=${receive.value}`); 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()); if (interaction.user.id == user.id) {
const receiveItemEntity = await Inventory.FetchOneByCardNumberAndUserId(user.id, receive.value!.toString()); await interaction.reply("You can not create a trade with yourself.");
return;
}
if (!giveItemEntity) { const user1ItemEntity = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, give.value!.toString());
const user2ItemEntity = await Inventory.FetchOneByCardNumberAndUserId(user.id, receive.value!.toString());
if (!user1ItemEntity) {
await interaction.reply("You do not have the item you are trying to trade."); await interaction.reply("You do not have the item you are trying to trade.");
return; return;
} }
if (!receiveItemEntity) { if (!user2ItemEntity) {
await interaction.reply("The user you are trying to trade with does not have the item you are trying to trade for."); await interaction.reply("The user you are trying to trade with does not have the item you are trying to trade for.");
return; return;
} }
const giveItem = CoreClient.Cards const user1Item = CoreClient.Cards
.flatMap(x => x.cards) .flatMap(x => x.cards)
.find(x => x.id === give.value!.toString()); .find(x => x.id === give.value!.toString());
const receiveItem = CoreClient.Cards const user2Item = CoreClient.Cards
.flatMap(x => x.cards) .flatMap(x => x.cards)
.find(x => x.id === receive.value!.toString()); .find(x => x.id === receive.value!.toString());
if (!giveItem || !receiveItem) { if (!user1Item || !user2Item) {
await interaction.reply("One or more of the items you are trying to trade does not exist."); await interaction.reply("One or more of the items you are trying to trade does not exist.");
return; return;
} }
@ -72,13 +77,13 @@ export default class Trade extends Command {
.setImage("https://media1.tenor.com/m/KkZwKl2AQ2QAAAAd/trade-offer.gif") .setImage("https://media1.tenor.com/m/KkZwKl2AQ2QAAAAd/trade-offer.gif")
.addFields([ .addFields([
{ {
name: "I Receive", name: `${interaction.user.username} Receives`,
value: `${receiveItem.id}: ${receiveItem.name}`, value: `${user2Item.id}: ${user2Item.name}`,
inline: true, inline: true,
}, },
{ {
name: "You Receive", name: `${user.username} Receives`,
value: `${giveItem.id}: ${giveItem.name}`, value: `${user1Item.id}: ${user1Item.name}`,
inline: true, inline: true,
}, },
{ {
@ -87,16 +92,16 @@ export default class Trade extends Command {
} }
]); ]);
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 timeoutId = setTimeout(async () => this.autoDecline(interaction, interaction.user.username, user.username, user1Item.id, user2Item.id, user1Item.name, user2Item.name), 1000 * 60 * 15); // 15 minutes
const row = new ActionRowBuilder<ButtonBuilder>() const row = new ActionRowBuilder<ButtonBuilder>()
.addComponents([ .addComponents([
new ButtonBuilder() new ButtonBuilder()
.setCustomId(`trade accept ${interaction.user.id} ${user.id} ${giveItem.id} ${receiveItem.id} ${expiry} ${timeoutId}`) .setCustomId(`trade accept ${interaction.user.id} ${user.id} ${user1Item.id} ${user2Item.id} ${expiry} ${timeoutId}`)
.setLabel("Accept") .setLabel("Accept")
.setStyle(ButtonStyle.Success), .setStyle(ButtonStyle.Success),
new ButtonBuilder() new ButtonBuilder()
.setCustomId(`trade decline ${interaction.user.id} ${user.id} ${giveItem.id} ${receiveItem.id} ${expiry} ${timeoutId}`) .setCustomId(`trade decline ${interaction.user.id} ${user.id} ${user1Item.id} ${user2Item.id} ${expiry} ${timeoutId}`)
.setLabel("Decline") .setLabel("Decline")
.setStyle(ButtonStyle.Danger), .setStyle(ButtonStyle.Danger),
]); ]);
@ -104,23 +109,23 @@ export default class Trade extends Command {
await interaction.reply({ content: `${user}`, embeds: [ tradeEmbed ], components: [ row ] }); 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) { private async autoDecline(interaction: CommandInteraction, user1Username: string, user2Username: string, user1CardNumber: string, user2CardNumber: string, user1CardName: string, user2CardName: string) {
AppLogger.LogSilly("Commands/Trade/AutoDecline", `Auto declining trade between ${giveUsername} and ${receiveUsername}`); AppLogger.LogSilly("Commands/Trade/AutoDecline", `Auto declining trade between ${user1Username} and ${user2Username}`);
const tradeEmbed = new EmbedBuilder() const tradeEmbed = new EmbedBuilder()
.setTitle("Trade Expired") .setTitle("Trade Expired")
.setDescription(`Trade initiated between ${receiveUsername} and ${giveUsername}`) .setDescription(`Trade initiated between ${user1Username} and ${user2Username}`)
.setColor(EmbedColours.Error) .setColor(EmbedColours.Error)
.setImage("https://media1.tenor.com/m/KkZwKl2AQ2QAAAAd/trade-offer.gif") .setImage("https://media1.tenor.com/m/KkZwKl2AQ2QAAAAd/trade-offer.gif")
.addFields([ .addFields([
{ {
name: "I Receive", name: `${user1Username} Receives`,
value: `${receiveCardNumber}: ${receiveCardName}`, value: `${user2CardNumber}: ${user2CardName}`,
inline: true, inline: true,
}, },
{ {
name: "You Receive", name: `${user2Username} Receives`,
value: `${giveCardNumber}: ${giveCardName}`, value: `${user1CardNumber}: ${user1CardName}`,
inline: true, inline: true,
}, },
{ {

View file

@ -65,11 +65,11 @@ export function GetSacrificeAmount(rarity: CardRarity): number {
case CardRarity.Bronze: case CardRarity.Bronze:
return 5; return 5;
case CardRarity.Silver: case CardRarity.Silver:
return 15; return 10;
case CardRarity.Gold: case CardRarity.Gold:
return 30; return 30;
case CardRarity.Manga: case CardRarity.Manga:
return 50; return 40;
case CardRarity.Legendary: case CardRarity.Legendary:
return 100; return 100;
default: default:

View file

@ -39,6 +39,12 @@ export default class AppBaseEntity {
await repository.remove(entity); await repository.remove(entity);
} }
public static async RemoveMany<T extends AppBaseEntity>(target: EntityTarget<T>, entity: T[]): Promise<void> {
const repository = AppDataSource.getRepository<T>(target);
await repository.remove(entity);
}
public static async FetchAll<T extends AppBaseEntity>(target: EntityTarget<T>, relations?: string[]): Promise<T[]> { public static async FetchAll<T extends AppBaseEntity>(target: EntityTarget<T>, relations?: string[]): Promise<T[]> {
const repository = AppDataSource.getRepository<T>(target); const repository = AppDataSource.getRepository<T>(target);

View file

@ -11,6 +11,8 @@ export interface CardMetadata {
name: string, name: string,
type: CardRarity, type: CardRarity,
path: string, path: string,
subseries?: string,
colour?: string,
} }
export interface DropResult { export interface DropResult {

View file

@ -4,6 +4,8 @@ import CardRarityChances from "../constants/CardRarityChances";
import { DropResult } from "../contracts/SeriesMetadata"; import { DropResult } from "../contracts/SeriesMetadata";
import { CoreClient } from "../client/client"; import { CoreClient } from "../client/client";
import AppLogger from "../client/appLogger"; import AppLogger from "../client/appLogger";
import CardConstants from "../constants/CardConstants";
import StringTools from "./StringTools";
export default class CardDropHelperMetadata { export default class CardDropHelperMetadata {
public static GetRandomCard(): DropResult | undefined { public static GetRandomCard(): DropResult | undefined {
@ -77,25 +79,59 @@ export default class CardDropHelperMetadata {
return { card, series }; return { card, series };
} }
public static GenerateDropEmbed(drop: DropResult, quantityClaimed: number, imageFileName: string, claimedBy?: string): EmbedBuilder { public static GenerateDropEmbed(drop: DropResult, quantityClaimed: number, imageFileName: string, claimedBy?: string, currency?: number): EmbedBuilder {
AppLogger.LogSilly("CardDropHelperMetadata/GenerateDropEmbed", `Parameters: drop=${drop.card.id}, quantityClaimed=${quantityClaimed}, imageFileName=${imageFileName}`); AppLogger.LogSilly("CardDropHelperMetadata/GenerateDropEmbed", `Parameters: drop=${drop.card.id}, quantityClaimed=${quantityClaimed}, imageFileName=${imageFileName}`);
let description = ""; const description = drop.card.subseries ?? drop.series.name;
description += `Series: ${drop.series.name}\n`; let colour = CardRarityToColour(drop.card.type);
description += `Claimed: ${quantityClaimed}\n`;
if (claimedBy != null) { if (drop.card.colour && StringTools.IsHexCode(drop.card.colour)) {
description += `Claimed by: ${claimedBy}\n`; const hexCode = Number("0x" + drop.card.colour);
if (hexCode) {
colour = hexCode;
} else { } else {
description += "Claimed by: (UNCLAIMED)\n"; AppLogger.LogWarn("CardDropHelperMetadata/GenerateDropEmbed", `Card's colour override is invalid: ${drop.card.id}, ${drop.card.colour}`);
}
} else if (drop.card.colour) {
AppLogger.LogWarn("CardDropHelperMetadata/GenerateDropEmbed", `Card's colour override is invalid: ${drop.card.id}, ${drop.card.colour}`);
} }
return new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(drop.card.name) .setTitle(drop.card.name)
.setDescription(description) .setDescription(description)
.setFooter({ text: `${CardRarityToString(drop.card.type)} · ${drop.card.id}` }) .setFooter({ text: `${CardRarityToString(drop.card.type)} · ${drop.card.id}` })
.setColor(CardRarityToColour(drop.card.type)) .setColor(colour)
.setImage(`attachment://${imageFileName}`); .setImage(`attachment://${imageFileName}`)
.addFields([
{
name: "Claimed",
value: `${quantityClaimed}`,
inline: true,
}
]);
if (claimedBy != null) {
embed.addFields([
{
name: "Claimed by",
value: claimedBy,
inline: true,
}
]);
}
if (currency != null) {
embed.addFields([
{
name: "Currency",
value: `${currency}`,
inline: true,
}
]);
}
return embed;
} }
public static GenerateDropButtons(drop: DropResult, claimId: string, userId: string, disabled: boolean = false): ActionRowBuilder<ButtonBuilder> { public static GenerateDropButtons(drop: DropResult, claimId: string, userId: string, disabled: boolean = false): ActionRowBuilder<ButtonBuilder> {
@ -105,7 +141,7 @@ export default class CardDropHelperMetadata {
.addComponents( .addComponents(
new ButtonBuilder() new ButtonBuilder()
.setCustomId(`claim ${drop.card.id} ${claimId} ${userId}`) .setCustomId(`claim ${drop.card.id} ${claimId} ${userId}`)
.setLabel("Claim") .setLabel(`Claim (${CardConstants.ClaimCost} 🪙)`)
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setDisabled(disabled), .setDisabled(disabled),
new ButtonBuilder() new ButtonBuilder()

View file

@ -0,0 +1,62 @@
import {createCanvas, loadImage} from "canvas";
import path from "path";
import AppLogger from "../client/appLogger";
import {existsSync} from "fs";
import Inventory from "../database/entities/app/Inventory";
import Jimp from "jimp";
interface CardInput {
id: string;
path: string;
}
export default class ImageHelper {
public static async GenerateCardImageGrid(cards: CardInput[], userId?: string): Promise<Buffer> {
const gridWidth = 3;
const gridHeight = Math.ceil(cards.length / gridWidth);
const imageWidth = 526;
const imageHeight = 712;
const canvasWidth = imageWidth * gridWidth;
const canvasHeight = imageHeight * gridHeight;
const canvas = createCanvas(canvasWidth, canvasHeight);
const ctx = canvas.getContext("2d");
for (let i = 0; i < cards.length; i++) {
const card = cards[i];
const filePath = path.join(process.env.DATA_DIR!, "cards", card.path);
const exists = existsSync(filePath);
if (!exists) {
AppLogger.LogError("ImageHelper/GenerateCardImageGrid", `Failed to load image from path ${card.path}`);
continue;
}
const imageData = await Jimp.read(filePath);
if (userId != null) {
const claimed = await Inventory.FetchOneByCardNumberAndUserId(userId, card.id);
if (!claimed || claimed.Quantity == 0) {
imageData.greyscale();
}
}
const image = await loadImage(await imageData.getBufferAsync("image/png"));
const x = i % gridWidth;
const y = Math.floor(i / gridWidth);
const imageX = imageWidth * x;
const imageY = imageHeight * y;
ctx.drawImage(image, imageX, imageY);
}
return canvas.toBuffer();
}
}

View file

@ -1,10 +1,11 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js"; import { ActionRowBuilder, AttachmentBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
import Inventory from "../database/entities/app/Inventory"; 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"; import cloneDeep from "clone-deep";
import AppLogger from "../client/appLogger"; import AppLogger from "../client/appLogger";
import ImageHelper from "./ImageHelper";
interface InventoryPage { interface InventoryPage {
id: number, id: number,
@ -18,16 +19,26 @@ interface InventoryPageCards {
name: string, name: string,
type: CardRarity, type: CardRarity,
quantity: number, quantity: number,
path: string,
} }
interface ReturnedInventoryPage {
embed: EmbedBuilder,
row: ActionRowBuilder<ButtonBuilder>,
image: AttachmentBuilder,
}
export default class InventoryHelper { export default class InventoryHelper {
public static async GenerateInventoryPage(username: string, userid: string, page: number): Promise<{ embed: EmbedBuilder, row: ActionRowBuilder<ButtonBuilder> }> { public static async GenerateInventoryPage(username: string, userid: string, page: number): Promise<ReturnedInventoryPage | undefined> {
AppLogger.LogSilly("Helpers/InventoryHelper", `Parameters: username=${username}, userid=${userid}, page=${page}`); AppLogger.LogSilly("Helpers/InventoryHelper", `Parameters: username=${username}, userid=${userid}, page=${page}`);
const cardsPerPage = 15; const cardsPerPage = 9;
const inventory = await Inventory.FetchAllByUserId(userid); const inventory = await Inventory.FetchAllByUserId(userid);
if (!inventory || inventory.length == 0) return undefined;
const clientCards = cloneDeep(CoreClient.Cards); const clientCards = cloneDeep(CoreClient.Cards);
const allSeriesClaimed = clientCards const allSeriesClaimed = clientCards
@ -62,6 +73,7 @@ export default class InventoryHelper {
name: card.name, name: card.name,
type: card.type, type: card.type,
quantity: item.Quantity, quantity: item.Quantity,
path: card.path,
}); });
} }
@ -77,15 +89,15 @@ export default class InventoryHelper {
const currentPage = pages[page]; const currentPage = pages[page];
if (!currentPage) { if (!currentPage) {
AppLogger.LogError("Helpers/InventoryHelper", "Unable to find page"); return undefined;
return Promise.reject("Unable to find page");
} }
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(username) .setTitle(username)
.setDescription(`**${currentPage.name} (${currentPage.seriesSubpage + 1})**\n${currentPage.cards.map(x => `[${x.id}] ${x.name} (${CardRarityToString(x.type)}) x${x.quantity}`).join("\n")}`) .setDescription(`**${currentPage.name} (${currentPage.seriesSubpage + 1})**\n${currentPage.cards.map(x => `[${x.id}] ${x.name} (${CardRarityToString(x.type)}) x${x.quantity}`).join("\n")}`)
.setFooter({ text: `Page ${page + 1} of ${pages.length}` }) .setFooter({ text: `Page ${page + 1} of ${pages.length}` })
.setColor(EmbedColours.Ok); .setColor(EmbedColours.Ok)
.setImage("attachment://page.png");
const row = new ActionRowBuilder<ButtonBuilder>() const row = new ActionRowBuilder<ButtonBuilder>()
.addComponents( .addComponents(
@ -100,6 +112,9 @@ export default class InventoryHelper {
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setDisabled(page + 1 == pages.length)); .setDisabled(page + 1 == pages.length));
return { embed, row }; const buffer = await ImageHelper.GenerateCardImageGrid(currentPage.cards.map(x => ({ id: x.id, path: x.path })));
const image = new AttachmentBuilder(buffer, { name: "page.png" });
return { embed, row, image };
} }
} }

View file

@ -1,15 +1,16 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js"; import { ActionRowBuilder, AttachmentBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
import AppLogger from "../client/appLogger"; import AppLogger from "../client/appLogger";
import cloneDeep from "clone-deep"; import cloneDeep from "clone-deep";
import { CoreClient } from "../client/client"; import { CoreClient } from "../client/client";
import EmbedColours from "../constants/EmbedColours"; import EmbedColours from "../constants/EmbedColours";
import { CardRarityToString } from "../constants/CardRarity"; import { CardRarityToString } from "../constants/CardRarity";
import ImageHelper from "./ImageHelper";
export default class SeriesHelper { export default class SeriesHelper {
public static GenerateSeriesViewPage(seriesId: number, page: number): { embed: EmbedBuilder, row: ActionRowBuilder<ButtonBuilder> } | null { public static async GenerateSeriesViewPage(seriesId: number, page: number, userId: string): Promise<{ embed: EmbedBuilder, row: ActionRowBuilder<ButtonBuilder>, image: AttachmentBuilder } | null> {
AppLogger.LogSilly("Helpers/SeriesHelper", `Parameters: seriesId=${seriesId}, page=${page}`); AppLogger.LogSilly("Helpers/SeriesHelper", `Parameters: seriesId=${seriesId}, page=${page}`);
const itemsPerPage = 15; const itemsPerPage = 9;
const series = cloneDeep(CoreClient.Cards) const series = cloneDeep(CoreClient.Cards)
.find(x => x.id == seriesId); .find(x => x.id == seriesId);
@ -20,6 +21,7 @@ export default class SeriesHelper {
} }
const totalPages = Math.ceil(series.cards.length / itemsPerPage); const totalPages = Math.ceil(series.cards.length / itemsPerPage);
const totalCards = series.cards.length;
if (page > totalPages) { 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`); AppLogger.LogVerbose("Helpers/SeriesHelper", `Trying to find page greater than what exists for this series. Page: ${page} but there are only ${totalPages} pages`);
@ -29,14 +31,15 @@ export default class SeriesHelper {
const cardsOnPage = series.cards.splice(page * itemsPerPage, itemsPerPage); const cardsOnPage = series.cards.splice(page * itemsPerPage, itemsPerPage);
const description = cardsOnPage const description = cardsOnPage
.map(x => `[${x.id}] ${x.name} ${CardRarityToString(x.type).toUpperCase()}`) .map(x => `[${x.id}] ${x.name} (${CardRarityToString(x.type)})`)
.join("\n"); .join("\n");
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(series.name) .setTitle(series.name)
.setColor(EmbedColours.Ok) .setColor(EmbedColours.Ok)
.setDescription(description) .setDescription(description)
.setFooter({ text: `${series.id} · ${series.cards.length} cards · Page ${page + 1} of ${totalPages}` }); .setFooter({ text: `${series.id} · ${totalCards} cards · Page ${page + 1} of ${totalPages}` })
.setImage("attachment://page.png");
const row = new ActionRowBuilder<ButtonBuilder>() const row = new ActionRowBuilder<ButtonBuilder>()
.addComponents( .addComponents(
@ -49,9 +52,12 @@ export default class SeriesHelper {
.setCustomId(`series view ${seriesId} ${page + 1}`) .setCustomId(`series view ${seriesId} ${page + 1}`)
.setLabel("Next") .setLabel("Next")
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setDisabled(page + 1 > totalPages)); .setDisabled(page + 1 == totalPages));
return { embed, row }; const buffer = await ImageHelper.GenerateCardImageGrid(cardsOnPage.map(x => ({id: x.id, path: x.path})), userId);
const image = new AttachmentBuilder(buffer, { name: "page.png" });
return { embed, row, image };
} }
public static GenerateSeriesListPage(page: number): { embed: EmbedBuilder, row: ActionRowBuilder<ButtonBuilder> } | null { public static GenerateSeriesListPage(page: number): { embed: EmbedBuilder, row: ActionRowBuilder<ButtonBuilder> } | null {
@ -72,7 +78,7 @@ export default class SeriesHelper {
const seriesOnPage = series.splice(page * itemsPerPage, itemsPerPage); const seriesOnPage = series.splice(page * itemsPerPage, itemsPerPage);
const description = seriesOnPage const description = seriesOnPage
.map(x => `[${x.id}] ${x.name}`) .map(x => `[${x.id}] ${x.name} (${x.cards.length} cards)`)
.join("\n"); .join("\n");
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
@ -92,7 +98,7 @@ export default class SeriesHelper {
.setCustomId(`series list ${page + 1}`) .setCustomId(`series list ${page + 1}`)
.setLabel("Next") .setLabel("Next")
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setDisabled(page + 1 > totalPages)); .setDisabled(page + 1 == totalPages));
return { embed, row }; return { embed, row };
} }

View file

@ -39,4 +39,18 @@ export default class StringTools {
public static ReplaceAll(str: string, find: string, replace: string) { public static ReplaceAll(str: string, find: string, replace: string) {
return str.replace(new RegExp(find, "g"), replace); return str.replace(new RegExp(find, "g"), replace);
} }
public static IsHexCode(str: string): boolean {
if (str.length != 6) return false;
const characters = "0123456789abcdefABCDEF";
for (let i = 0; i < 6; i++) {
const char = str[i];
if (!characters.includes(char)) return false;
}
return true;
}
} }

View file

@ -3,6 +3,7 @@ import { Environment } from "./constants/Environment";
// Global Command Imports // Global Command Imports
import About from "./commands/about"; import About from "./commands/about";
import AllBalance from "./commands/allbalance";
import Balance from "./commands/balance"; import Balance from "./commands/balance";
import Daily from "./commands/daily"; import Daily from "./commands/daily";
import Drop from "./commands/drop"; import Drop from "./commands/drop";
@ -12,6 +13,7 @@ import Inventory from "./commands/inventory";
import Resync from "./commands/resync"; import Resync from "./commands/resync";
import Sacrifice from "./commands/sacrifice"; import Sacrifice from "./commands/sacrifice";
import Series from "./commands/series"; import Series from "./commands/series";
import Stats from "./commands/stats";
import Trade from "./commands/trade"; import Trade from "./commands/trade";
import View from "./commands/view"; import View from "./commands/view";
@ -31,6 +33,7 @@ export default class Registry {
public static RegisterCommands() { public static RegisterCommands() {
// Global Commands // Global Commands
CoreClient.RegisterCommand("about", new About()); CoreClient.RegisterCommand("about", new About());
CoreClient.RegisterCommand("allbalance", new AllBalance());
CoreClient.RegisterCommand("balance", new Balance()); CoreClient.RegisterCommand("balance", new Balance());
CoreClient.RegisterCommand("daily", new Daily()); CoreClient.RegisterCommand("daily", new Daily());
CoreClient.RegisterCommand("drop", new Drop()); CoreClient.RegisterCommand("drop", new Drop());
@ -40,6 +43,7 @@ export default class Registry {
CoreClient.RegisterCommand("resync", new Resync()); CoreClient.RegisterCommand("resync", new Resync());
CoreClient.RegisterCommand("sacrifice", new Sacrifice()); CoreClient.RegisterCommand("sacrifice", new Sacrifice());
CoreClient.RegisterCommand("series", new Series()); CoreClient.RegisterCommand("series", new Series());
CoreClient.RegisterCommand("stats", new Stats());
CoreClient.RegisterCommand("trade", new Trade()); CoreClient.RegisterCommand("trade", new Trade());
CoreClient.RegisterCommand("view", new View()); CoreClient.RegisterCommand("view", new View());

View file

@ -3,15 +3,17 @@ import CardConstants from "../constants/CardConstants";
import User from "../database/entities/app/User"; import User from "../database/entities/app/User";
export default async function GiveCurrency() { export default async function GiveCurrency() {
AppLogger.LogInfo("Timers/GiveCurrency", "Giving currency to every known user"); AppLogger.LogDebug("Timers/GiveCurrency", "Giving currency to every known user");
const users = await User.FetchAll(User); const users = await User.FetchAll(User);
for (const user of users) { const usersFiltered = users.filter(x => x.Currency < 1000);
for (const user of usersFiltered) {
user.AddCurrency(CardConstants.TimerGiveAmount); user.AddCurrency(CardConstants.TimerGiveAmount);
} }
User.SaveAll(User, users); User.SaveAll(User, users);
AppLogger.LogInfo("Timers/GiveCurrency", `Successfully gave +${CardConstants.TimerGiveAmount} currency to ${users.length} users`); AppLogger.LogDebug("Timers/GiveCurrency", `Successfully gave +${CardConstants.TimerGiveAmount} currency to ${usersFiltered.length} users`);
} }

14
src/timers/PurgeClaims.ts Normal file
View file

@ -0,0 +1,14 @@
import AppLogger from "../client/appLogger";
import Claim from "../database/entities/app/Claim";
export default async function PurgeClaims() {
const claims = await Claim.FetchAll(Claim);
const whenLastClaimable = new Date(Date.now() - (1000 * 60 * 5)); // 5 minutes ago
const expiredClaims = claims.filter(x => x.WhenCreated < whenLastClaimable);
await Claim.RemoveMany(Claim, expiredClaims);
AppLogger.LogInfo("Timers/PurgeClaims", `Purged ${expiredClaims.length} claims from the database`);
}

66
tests/registry.test.ts Normal file
View file

@ -0,0 +1,66 @@
import {CoreClient} from "../src/client/client";
import Registry from "../src/registry";
import fs from "fs";
import path from "path";
describe("RegisterCommands", () => {
test("EXPECT every command in the commands folder to be registered", () => {
const registeredCommands: string[] = [];
CoreClient.RegisterCommand = jest.fn().mockImplementation((name: string) => {
registeredCommands.push(name);
});
Registry.RegisterCommands();
const commandFiles = getFilesInDirectory(path.join(process.cwd(), "src", "commands"))
.filter(x => x.endsWith(".ts"));
for (const file of commandFiles) {
expect(registeredCommands).toContain(file.split("/").pop()!.split(".")[0]);
}
expect(commandFiles.length).toBe(registeredCommands.length);
});
});
describe("RegisterButtonEvents", () => {
test("EXEPCT every button event in the button events folder to be registered", () => {
const registeredButtonEvents: string[] = [];
CoreClient.RegisterButtonEvent = jest.fn().mockImplementation((name: string) => {
registeredButtonEvents.push(name);
});
Registry.RegisterButtonEvents();
const eventFiles = getFilesInDirectory(path.join(process.cwd(), "src", "buttonEvents"))
.filter(x => x.endsWith(".ts"));
for (const file of eventFiles) {
expect(registeredButtonEvents).toContain(file.split("/").pop()!.split(".")[0].toLowerCase());
}
expect(eventFiles.length).toBe(registeredButtonEvents.length);
});
});
function getFilesInDirectory(dir: string): string[] {
let results: string[] = [];
const list = fs.readdirSync(dir);
list.forEach(file => {
file = path.join(dir, file);
const stat = fs.statSync(file);
if (stat && stat.isDirectory()) {
/* recurse into a subdirectory */
results = results.concat(getFilesInDirectory(file));
} else {
/* is a file */
results.push(file);
}
});
return results;
}

6938
yarn.lock Normal file

File diff suppressed because it is too large Load diff