Compare commits

..

22 commits

Author SHA1 Message Date
Ethan Lane 486826470a 0.4.0
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-13 13:35:14 +00:00
Ethan Lane 7a52ebb182 Add give command (#137)
All checks were successful
continuous-integration/drone/push Build is passing
# Description

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

- Add give command
- Update the whitelist for gdrive sync list to a general admins list

#113

## Type of change

Please delete options that are not relevant.

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

# How Has This Been Tested?

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

# Checklist

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

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/137
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-01-12 17:51:29 +00:00
RenovateBot 8a236d01b5 Update dependency typeorm to v0.3.19 (#136)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

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

---

### Release Notes

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

### [`v0.3.19`](https://github.com/typeorm/typeorm/blob/HEAD/CHANGELOG.md#0319-2024-01-03)

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

##### Bug Fixes

-   fixed `Cannot read properties of undefined (reading 'sync')` caused after glob package upgrade

### [`v0.3.18`](https://github.com/typeorm/typeorm/blob/HEAD/CHANGELOG.md#0318-2024-01-03)

[Compare Source](https://github.com/typeorm/typeorm/compare/0.3.17...0.3.18)

##### Bug Fixes

-   add BaseEntity to model-shim ([#&#8203;10503](https://github.com/typeorm/typeorm/issues/10503)) ([3cf938e](3cf938efc0))
-   add error handling for missing join columns ([#&#8203;10525](https://github.com/typeorm/typeorm/issues/10525)) ([122c897](122c897a2f)), closes [#&#8203;7034](https://github.com/typeorm/typeorm/issues/7034)
-   add missing export for View class ([#&#8203;10261](https://github.com/typeorm/typeorm/issues/10261)) ([7adbc9b](7adbc9bdc7))
-   added fail callback while opening the database in Cordova ([#&#8203;10566](https://github.com/typeorm/typeorm/issues/10566)) ([8b4df5b](8b4df5b299))
-   aggregate function throw error when column alias name is set ([#&#8203;10035](https://github.com/typeorm/typeorm/issues/10035)) ([022d2b5](022d2b5f62)), closes [#&#8203;9927](https://github.com/typeorm/typeorm/issues/9927)
-   backport postgres connection error handling to crdb ([#&#8203;10177](https://github.com/typeorm/typeorm/issues/10177)) ([149226d](149226dd67))
-   bump better-sqlite3 version range ([#&#8203;10452](https://github.com/typeorm/typeorm/issues/10452)) ([75ec8f2](75ec8f2032))
-   caching always enabled not caching queries ([#&#8203;10524](https://github.com/typeorm/typeorm/issues/10524)) ([8af533f](8af533f79f))
-   circular dependency breaking node.js 20.6 ([#&#8203;10344](https://github.com/typeorm/typeorm/issues/10344)) ([ba7ad3c](ba7ad3c69b)), closes [#&#8203;10338](https://github.com/typeorm/typeorm/issues/10338)
-   correctly keep query.data from ormOption for commit / rollback subscribers ([#&#8203;10151](https://github.com/typeorm/typeorm/issues/10151)) ([73ee70b](73ee70b331))
-   default value in child table/entity column decorator for multiple table inheritance is ignored for inherited columns ([#&#8203;10563](https://github.com/typeorm/typeorm/issues/10563)) ([#&#8203;10564](https://github.com/typeorm/typeorm/issues/10564)) ([af77a5d](af77a5d0ac))
-   deletedAt column leaking as side effect of object update while creating a row ([#&#8203;10435](https://github.com/typeorm/typeorm/issues/10435)) ([7de4890](7de4890265))
-   empty objects being hydrated when eager loading relations that have a `@VirtualColumn` ([#&#8203;10432](https://github.com/typeorm/typeorm/issues/10432)) ([b53e410](b53e410e5a)), closes [#&#8203;10431](https://github.com/typeorm/typeorm/issues/10431)
-   extend GiST index with range types for Postgres driver ([#&#8203;10572](https://github.com/typeorm/typeorm/issues/10572)) ([a4900ae](a4900ae15f)), closes [#&#8203;10567](https://github.com/typeorm/typeorm/issues/10567)
-   ignore changes for columns with `update: false` in persistence ([#&#8203;10250](https://github.com/typeorm/typeorm/issues/10250)) ([f8fa1fd](f8fa1fd821)), closes [#&#8203;10249](https://github.com/typeorm/typeorm/issues/10249)
-   improve helper for cli for commands missing positionals ([#&#8203;10133](https://github.com/typeorm/typeorm/issues/10133)) ([9f8899f](9f8899f56c))
-   loading datasource unable to process a regular default export ([#&#8203;10184](https://github.com/typeorm/typeorm/issues/10184)) ([201342d](201342d150)), closes [#&#8203;8810](https://github.com/typeorm/typeorm/issues/8810)
-   logMigration has incorrect logging condition ([#&#8203;10323](https://github.com/typeorm/typeorm/issues/10323)) ([d41930f](d41930f0d6)), closes [#&#8203;10322](https://github.com/typeorm/typeorm/issues/10322) [#&#8203;10322](https://github.com/typeorm/typeorm/issues/10322)
-   ManyToMany ER_DUP_ENTRY error ([#&#8203;10343](https://github.com/typeorm/typeorm/issues/10343)) ([e296063](e296063b12)), closes [#&#8203;5704](https://github.com/typeorm/typeorm/issues/5704)
-   migrations on indexed TIMESTAMP WITH TIME ZONE Oracle columns ([#&#8203;10506](https://github.com/typeorm/typeorm/issues/10506)) ([cf37f13](cf37f1370b)), closes [#&#8203;10493](https://github.com/typeorm/typeorm/issues/10493)
-   mongodb - undefined is not constructor ([#&#8203;10559](https://github.com/typeorm/typeorm/issues/10559)) ([ad5bf11](ad5bf11a91))
-   mongodb resolves leaked cursor ([#&#8203;10316](https://github.com/typeorm/typeorm/issues/10316)) ([2dc9624](2dc9624d00)), closes [#&#8203;10315](https://github.com/typeorm/typeorm/issues/10315)
-   mssql datasource testonborrow not affecting anything ([#&#8203;10589](https://github.com/typeorm/typeorm/issues/10589)) ([122b683](122b683840))
-   nested transactions issues ([#&#8203;10210](https://github.com/typeorm/typeorm/issues/10210)) ([25e6ecd](25e6ecdfd2))
-   prevent using absolute table path in migrations unless required ([#&#8203;10123](https://github.com/typeorm/typeorm/issues/10123)) ([dd59524](dd595242a7))
-   remove `date-fns` in favor of `DayJs` ([#&#8203;10306](https://github.com/typeorm/typeorm/issues/10306)) ([cf7147f](cf7147fa7c))
-   remove dynamic require calls ([#&#8203;10196](https://github.com/typeorm/typeorm/issues/10196)) ([a939654](a939654c95))
-   resolve circular dependency when using Vite ([#&#8203;10273](https://github.com/typeorm/typeorm/issues/10273)) ([080528b](080528b117))
-   resolve issue building eager relation alias for nested relations ([#&#8203;10004](https://github.com/typeorm/typeorm/issues/10004)) ([c6f608d](c6f608d3e8)), closes [#&#8203;9944](https://github.com/typeorm/typeorm/issues/9944)
-   resolve issue of generating migration for numeric arrays repeatedly ([#&#8203;10471](https://github.com/typeorm/typeorm/issues/10471)) ([39fdcf6](39fdcf651f)), closes [#&#8203;10043](https://github.com/typeorm/typeorm/issues/10043)
-   resolve issue queryBuilder makes different parameter identifiers for same parameter ([#&#8203;10327](https://github.com/typeorm/typeorm/issues/10327)) ([6c918ea](6c918ea392)), closes [#&#8203;7308](https://github.com/typeorm/typeorm/issues/7308)
-   resolve issues on upsert ([#&#8203;10588](https://github.com/typeorm/typeorm/issues/10588)) ([dc1bfed](dc1bfed6d5)), closes [#&#8203;10587](https://github.com/typeorm/typeorm/issues/10587)
-   scrub all comment end markers from comments ([#&#8203;10163](https://github.com/typeorm/typeorm/issues/10163)) ([d937f61](d937f6106a))
-   serialize bigint when building a query id [#&#8203;10336](https://github.com/typeorm/typeorm/issues/10336) ([#&#8203;10337](https://github.com/typeorm/typeorm/issues/10337)) ([bfc1cc5](bfc1cc5ab4))
-   should automatically cache if alwaysEnable ([#&#8203;10137](https://github.com/typeorm/typeorm/issues/10137)) ([173910e](173910ed79)), closes [#&#8203;9910](https://github.com/typeorm/typeorm/issues/9910)
-   SQLite simple-enum column parsing ([#&#8203;10550](https://github.com/typeorm/typeorm/issues/10550)) ([696e688](696e688d00))
-   update UpdateDateColumn on upsert ([#&#8203;10458](https://github.com/typeorm/typeorm/issues/10458)) ([fdb9866](fdb9866ad2)), closes [#&#8203;9015](https://github.com/typeorm/typeorm/issues/9015)
-   upgrade ts-node version to latest(10.9.1) version ([#&#8203;10143](https://github.com/typeorm/typeorm/issues/10143)) ([fcb9904](fcb9904f24))
-   using async datasource to configure typeorm ([#&#8203;10170](https://github.com/typeorm/typeorm/issues/10170)) ([fbd45db](fbd45dba32))

##### Features

-   ability to change default replication mode ([#&#8203;10419](https://github.com/typeorm/typeorm/issues/10419)) ([72b1d1b](72b1d1b865))
-   add concurrent indexes for postgres ([#&#8203;10442](https://github.com/typeorm/typeorm/issues/10442)) ([f4e6eaf](f4e6eaf155))
-   add exists and exists by ([#&#8203;10291](https://github.com/typeorm/typeorm/issues/10291)) ([b6b46fb](b6b46fb133))
-   add isolated where statements ([#&#8203;10213](https://github.com/typeorm/typeorm/issues/10213)) ([3cda7ec](3cda7ec39d))
-   add MSSQL disableAsciiToUnicodeParamConversion option and tests ([#&#8203;10161](https://github.com/typeorm/typeorm/issues/10161)) ([df7c069](df7c06948c)), closes [#&#8203;10131](https://github.com/typeorm/typeorm/issues/10131)
-   add support for mssql server DefaultAzureCredential usage ([#&#8203;10246](https://github.com/typeorm/typeorm/issues/10246)) ([c8ee5b1](c8ee5b1d1a))
-   add support for table comment in MySQL ([#&#8203;10017](https://github.com/typeorm/typeorm/issues/10017)) ([338df16](338df16439))
-   allow to use custom type witch extends object type for find where argument ([#&#8203;10475](https://github.com/typeorm/typeorm/issues/10475)) ([48f5f85](48f5f85d68))
-   BeforeQuery and AfterQuery events ([#&#8203;10234](https://github.com/typeorm/typeorm/issues/10234)) ([5c28154](5c28154cbe)), closes [#&#8203;3302](https://github.com/typeorm/typeorm/issues/3302)
-   custom STI discriminator value for EntitySchema ([#&#8203;10508](https://github.com/typeorm/typeorm/issues/10508)) ([b240d87](b240d87f34)), closes [#&#8203;10494](https://github.com/typeorm/typeorm/issues/10494)
-   enabled CTE for oracle driver ([#&#8203;10319](https://github.com/typeorm/typeorm/issues/10319)) ([65858f3](65858f3a17))
-   entityId in InsertEvent ([#&#8203;10540](https://github.com/typeorm/typeorm/issues/10540)) ([ae006af](ae006af501))
-   expose countDocuments in mongodb ([#&#8203;10314](https://github.com/typeorm/typeorm/issues/10314)) ([ebd61d1](ebd61d1440))
-   exposed entity and criteria properties on EntityNotFoundError ([#&#8203;10202](https://github.com/typeorm/typeorm/issues/10202)) ([bafcd17](bafcd1709b))
-   implement column comments for SAP HANA ([#&#8203;10502](https://github.com/typeorm/typeorm/issues/10502)) ([45e31cc](45e31cc57a))
-   implement OR operator ([#&#8203;10086](https://github.com/typeorm/typeorm/issues/10086)) ([a00b1df](a00b1df68f)), closes [#&#8203;10054](https://github.com/typeorm/typeorm/issues/10054) [#&#8203;10054](https://github.com/typeorm/typeorm/issues/10054) [#&#8203;10054](https://github.com/typeorm/typeorm/issues/10054) [#&#8203;10054](https://github.com/typeorm/typeorm/issues/10054) [#&#8203;10054](https://github.com/typeorm/typeorm/issues/10054) [#&#8203;10054](https://github.com/typeorm/typeorm/issues/10054) [#&#8203;10054](https://github.com/typeorm/typeorm/issues/10054)
-   implement streaming for SAP HANA ([#&#8203;10512](https://github.com/typeorm/typeorm/issues/10512)) ([7e9cead](7e9cead8a3))
-   implements QueryFailedError generic for driverError typing ([#&#8203;10253](https://github.com/typeorm/typeorm/issues/10253)) ([78b2f48](78b2f4805c))
-   modify repository.extend method for chaining repositories ([#&#8203;10256](https://github.com/typeorm/typeorm/issues/10256)) ([ca29c0f](ca29c0ff8e))
-   nullable embedded entities ([#&#8203;10289](https://github.com/typeorm/typeorm/issues/10289)) ([e67d704](e67d704138))
-   support for MongoDB 6.x ([#&#8203;10545](https://github.com/typeorm/typeorm/issues/10545)) ([3647b26](3647b269cc))
-   support mssql@10 ([#&#8203;10356](https://github.com/typeorm/typeorm/issues/10356)) ([f6bb671](f6bb6711e2)), closes [#&#8203;10340](https://github.com/typeorm/typeorm/issues/10340)
-   use node-oracledb 6 ([#&#8203;10285](https://github.com/typeorm/typeorm/issues/10285)) ([3af891a](3af891a8e6)), closes [#&#8203;10277](https://github.com/typeorm/typeorm/issues/10277)
-   user-defined index name for STI discriminator column ([#&#8203;10509](https://github.com/typeorm/typeorm/issues/10509)) ([89c5257](89c525761d)), closes [#&#8203;10496](https://github.com/typeorm/typeorm/issues/10496)

##### Performance Improvements

-   improve SapQueryRunner performance ([#&#8203;10198](https://github.com/typeorm/typeorm/issues/10198)) ([f6b87e3](f6b87e3ee1))

##### BREAKING CHANGES

-   With node-oracledb the thin client is used as default. Added a option to use the thick client. Also added the option to specify the instant client lib
-   MongoDB: from the previous behavior of returning a result with metadata describing when a document is not found.
    See: https://github.com/mongodb/node-mongodb-native/blob/HEAD/etc/notes/CHANGES\_6.0.0.md
-   [new nullable embeds feature](https://github.com/typeorm/typeorm/pull/10289) introduced a breaking change which might enforce you to update types on your entities to `  | null `,
    if all columns in your embed entity are nullable. Since database queries now return embedded property as `null` if all its column values are null.

</details>

---

### Configuration

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

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

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

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

---

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

---

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

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/136
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-08 13:43:50 +00:00
RenovateBot be591c14c6 Update dependency @types/node to v20.10.7 (#135)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

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

---

### Configuration

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

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

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

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

---

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

---

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

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/135
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-08 13:43:01 +00:00
RenovateBot 9703d1d2c3 Update dependency typescript to v5.3.3 (#117)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [typescript](https://www.typescriptlang.org/) ([source](https://github.com/Microsoft/TypeScript)) | devDependencies | minor | [`5.2.2` -> `5.3.3`](https://renovatebot.com/diffs/npm/typescript/5.2.2/5.3.3) |

---

### Release Notes

<details>
<summary>Microsoft/TypeScript (typescript)</summary>

### [`v5.3.3`](https://github.com/microsoft/TypeScript/releases/tag/v5.3.3): TypeScript 5.3.3

[Compare Source](https://github.com/Microsoft/TypeScript/compare/v5.3.2...v5.3.3)

For release notes, check out the [release announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-3/).

For the complete list of fixed issues, check out the

-   [fixed issues query for Typescript 5.3.0 (Beta)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.3.0%22+is%3Aclosed+).
-   [fixed issues query for Typescript 5.3.1 (RC)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.3.1%22+is%3Aclosed+).
-   [fixed issues query for Typescript 5.3.2 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.3.2%22+is%3Aclosed+).
-   [fixed issues query for Typescript 5.3.3 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.3.3%22+is%3Aclosed+).

Downloads are available on:

-   [NuGet package](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild)

### [`v5.3.2`](https://github.com/microsoft/TypeScript/releases/tag/v5.3.2): TypeScript 5.3

[Compare Source](https://github.com/Microsoft/TypeScript/compare/v5.2.2...v5.3.2)

For release notes, check out the [release announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-3/).

For the complete list of fixed issues, check out the

-   [fixed issues query for Typescript 5.3.0 (Beta)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.3.0%22+is%3Aclosed+).
-   [fixed issues query for Typescript 5.3.1 (RC)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.3.1%22+is%3Aclosed+).
-   [fixed issues query for Typescript 5.3.2 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.3.2%22+is%3Aclosed+).

Downloads are available on:

-   [NuGet package](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild)

</details>

---

### Configuration

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

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

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

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

---

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

---

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

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/117
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-08 13:40:37 +00:00
Ethan Lane 39529cf20c Add ESLint and fix issues (#133)
All checks were successful
continuous-integration/drone/push Build is passing
# Description

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

- Add ESLint to the project
- Fix issues which ESLint found

#49

## Type of change

Please delete options that are not relevant.

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

# How Has This Been Tested?

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

# Checklist

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

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/133
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-01-05 19:26:44 +00:00
RenovateBot 84749c3381 Update dependency @types/node to v20.10.6 (#132)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

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

---

### Configuration

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

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

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

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

---

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

---

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

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/132
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-01 16:09:49 +00:00
Ethan Lane fb874be76a Fix dropnumber and droprarity commands
All checks were successful
continuous-integration/drone/push Build is passing
2023-12-29 22:12:20 +00:00
Ethan Lane e05059cb9b Add to renovate config to add label on PRs (#128)
All checks were successful
continuous-integration/drone/push Build is passing
# Description

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

- Update the renovate config so that the bot will add the `type/dependencies` label to the PRs

#55

## Type of change

Please delete options that are not relevant.

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

# How Has This Been Tested?

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

# Checklist

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

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/128
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2023-12-29 21:03:15 +00:00
Ethan Lane dd86ecd5a4 Use exports in script
All checks were successful
continuous-integration/drone/push Build is passing
2023-12-29 21:00:44 +00:00
Ethan Lane 99f23cfb1c Add source
Some checks failed
continuous-integration/drone/push Build is failing
2023-12-29 20:56:14 +00:00
Ethan Lane ffaf533608 Redoo
Some checks failed
continuous-integration/drone/push Build is failing
2023-12-29 20:54:53 +00:00
Ethan Lane 526b42bb4a Undo commit
Some checks failed
continuous-integration/drone/push Build is failing
2023-12-29 20:41:02 +00:00
Ethan Lane c5d2edf011 Use alpine
Some checks failed
continuous-integration/drone/push Build is failing
2023-12-29 20:34:18 +00:00
Ethan Lane 70457ac850 Use on deploy script too
Some checks failed
continuous-integration/drone/push Build is failing
2023-12-29 20:27:38 +00:00
Ethan Lane bc494970a0 Use ip address
Some checks failed
continuous-integration/drone/push Build is failing
2023-12-29 20:25:15 +00:00
Ethan Lane 736053fb8b Use prescript
Some checks failed
continuous-integration/drone/push Build is failing
2023-12-29 20:24:10 +00:00
Ethan Lane 1ee7bb8630 Update drone script to use rsync (#121)
Some checks failed
continuous-integration/drone/push Build is failing
# Description

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

- Update drone pipelines to use resync

> **NOTE:** This requires a new repository secret - `ssh_key`

> **NOTE:** This requires moving the cards directory into the new appdata folder

#56

## Type of change

Please delete options that are not relevant.

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

# How Has This Been Tested?

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

- This can only be tested once merged, so no testing has been done, but a check has been done by me as a review

# Checklist

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

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/121
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2023-12-29 19:51:59 +00:00
Ethan Lane 5df92554c0 Remove resolution for undici (#126)
All checks were successful
continuous-integration/drone/push Build is passing
# Description

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

- Remove resolution for undici, as it is no longer causing a vulnerability

#125

## Type of change

Please delete options that are not relevant.

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

# How Has This Been Tested?

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

# Checklist

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

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/126
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2023-12-29 19:49:11 +00:00
RenovateBot 82941d4909 Update dependency np to v9 (#123)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [np](https://github.com/sindresorhus/np) | devDependencies | major | [`^8.0.4` -> `^9.0.0`](https://renovatebot.com/diffs/npm/np/8.0.4/9.2.0) |

---

### Release Notes

<details>
<summary>sindresorhus/np (np)</summary>

### [`v9.2.0`](https://github.com/sindresorhus/np/releases/tag/v9.2.0)

[Compare Source](https://github.com/sindresorhus/np/compare/v9.1.0...v9.2.0)

-   Fix yarn npm publish for scoped packages  [`8d3a984`](https://github.com/sindresorhus/np/commit/8d3a984)
-   Fix broken revert code after publish failure  [`819ed29`](https://github.com/sindresorhus/np/commit/819ed29)

### [`v9.1.0`](https://github.com/sindresorhus/np/releases/tag/v9.1.0)

[Compare Source](https://github.com/sindresorhus/np/compare/v9.0.0...v9.1.0)

-   Add Yarn Berry support ([#&#8203;723](https://github.com/sindresorhus/np/issues/723))  [`0d9522b`](https://github.com/sindresorhus/np/commit/0d9522b)

### [`v9.0.0`](https://github.com/sindresorhus/np/releases/tag/v9.0.0)

[Compare Source](https://github.com/sindresorhus/np/compare/v8.0.4...v9.0.0)

##### Breaking

-   Require Node.js 18 and npm 9  [`6c2e00e`](https://github.com/sindresorhus/np/commit/6c2e00e)

##### Improvements

-   Group unpublished files in folders ([#&#8203;716](https://github.com/sindresorhus/np/issues/716))  [`c31c2bc`](https://github.com/sindresorhus/np/commit/c31c2bc)
-   improve messages related to new files and dependencies ([#&#8203;702](https://github.com/sindresorhus/np/issues/702))  [`ad7b09e`](https://github.com/sindresorhus/np/commit/ad7b09e)

</details>

---

### Configuration

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

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

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

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

---

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

---

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

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/123
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2023-12-25 15:19:44 +00:00
Ethan Lane bcb7beabc6 Create simple inventory list (#120)
All checks were successful
continuous-integration/drone/push Build is passing
# Description

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

- Create a simple inventory list

#97

## Type of change

Please delete options that are not relevant.

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

# How Has This Been Tested?

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

# Checklist

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

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/120
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2023-12-22 14:41:13 +00:00
RenovateBot 66b499d8d2 Update dependency @types/node to v20.10.5 (#116)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

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

---

### Configuration

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

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

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

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

---

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

---

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

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/116
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2023-12-18 14:38:48 +00:00
50 changed files with 2346 additions and 661 deletions

View file

@ -7,15 +7,18 @@
# any secret values.
BOT_TOKEN=
BOT_VER=0.3.1
BOT_VER=0.4.0
BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816
BOT_CLIENTID=682942374040961060
BOT_ENV=4
BOT_ADMINS=147392775707426816,887272961504071690
ABOUT_FUNDING=
ABOUT_REPO=
DATA_DIR=
DB_HOST=127.0.0.1
DB_PORT=3301
DB_NAME=carddrop
@ -28,5 +31,4 @@ DB_CARD_FILE=:memory:
EXPRESS_PORT=3303
GDRIVESYNC_WHITELIST=147392775707426816,887272961504071690
GDRIVESYNC_AUTO=true

View file

@ -4,16 +4,36 @@ kind: pipeline
name: deployment
steps:
- name: deploy
image: appleboy/drone-ssh
- name: build
image: node
commands:
- npm ci
- npm run build
- name: test
image: node
commands:
- npm test
- name: deploy to prod
image: drillster/drone-rsync
secrets: [ ssh_key, bot_token_prod ]
settings:
host: 192.168.68.120
username: vylpes
password:
from_secret: ssh_password
port: 22
hosts:
- 192.168.68.120
user: vylpes
key:
from_secret: ssh_key
source: .
target: ~/apps/card-drop/card-drop_prod
recursive: true
script:
- sh /home/vylpes/scripts/card-drop/deploy_prod.sh
- export PATH="$HOME/.yarn/bin:$PATH"
- export PATH="$HOME/.nodeuse/bin:$PATH"
- export BOT_TOKEN="$BOT_TOKEN_PROD"
- cd ~/apps/card-drop/card-drop_prod
- docker compose --file docker-compose.prod.yml up -d
- sleep 10
- cp .prod.env .env
- pm2 restart card-drop_prod || pm2 start --name card-drop_prod dist/bot.js
trigger:
event:
@ -25,16 +45,36 @@ kind: pipeline
name: staging
steps:
- name: stage
image: appleboy/drone-ssh
- name: build
image: node
commands:
- npm ci
- npm run build
- name: test
image: node
commands:
- npm test
- name: deploy to stage
image: drillster/drone-rsync
secrets: [ ssh_key, bot_token_stage ]
settings:
host: 192.168.68.120
username: vylpes
password:
from_secret: ssh_password
port: 22
hosts:
- 192.168.68.120
user: vylpes
key:
from_secret: ssh_key
source: .
target: ~/apps/card-drop/card-drop_stage
recursive: true
script:
- sh /home/vylpes/scripts/card-drop/deploy_stage.sh
- export PATH="$HOME/.yarn/bin:$PATH"
- export PATH="$HOME/.nodeuse/bin:$PATH"
- export BOT_TOKEN="$BOT_TOKEN_STAGE"
- cd ~/apps/card-drop/card-drop_stage
- docker compose --file docker-compose.stage.yml up -d
- sleep 10
- cp .stage.env .env
- pm2 restart card-drop_stage || pm2 start --name card-drop_stage dist/bot.js
trigger:
branch:
@ -54,16 +94,18 @@ steps:
- npm ci
- npm run build
- name: lint
image: node
commands:
- npm run lint
- name: test
image: node
commands:
- npm ci
- npm test
trigger:
branch:
- main
- develop
- hotfix/*
- feature/*
- renovate/*

45
.eslintrc.json Normal file
View file

@ -0,0 +1,45 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
},
"globals": {
"jest": true,
"require": true,
"exports": true,
"process": true
},
"ignorePatterns": [
"dist/**/*"
]
}

2
.gitignore vendored
View file

@ -107,5 +107,5 @@ config.json
.DS_Store
ormconfig.json
gdrive-credentials.json
cards/
data/
*.db

View file

@ -7,15 +7,18 @@
# any secret values.
BOT_TOKEN=
BOT_VER=0.3.1
BOT_VER=0.4.0
BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816
BOT_CLIENTID=1093810443589529631
BOT_ENV=1
BOT_ADMINS=147392775707426816,887272961504071690
ABOUT_FUNDING=
ABOUT_REPO=
DATA_DIR=/home/vylpes/appdata/card-drop/card-drop_prod
DB_HOST=127.0.0.1
DB_PORT=3321
DB_NAME=carddrop
@ -28,5 +31,4 @@ DB_CARD_FILE=:memory:
EXPRESS_PORT=3323
GDRIVESYNC_WHITELIST=147392775707426816,887272961504071690
GDRIVESYNC_AUTO=false

View file

@ -7,15 +7,18 @@
# any secret values.
BOT_TOKEN=
BOT_VER=0.3.1
BOT_VER=0.4.0
BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816
BOT_CLIENTID=1147976642942214235
BOT_ENV=2
BOT_ADMINS=147392775707426816,887272961504071690
ABOUT_FUNDING=
ABOUT_REPO=
DATA_DIR=/home/vylpes/appdata/card-drop/card-drop_stage
DB_HOST=127.0.0.1
DB_PORT=3311
DB_NAME=carddrop
@ -28,5 +31,4 @@ DB_CARD_FILE=:memory:
EXPRESS_PORT=3313
GDRIVESYNC_WHITELIST=147392775707426816,887272961504071690
GDRIVESYNC_AUTO=false

1845
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "card-drop",
"version": "0.3.1",
"version": "0.4.0",
"main": "./dist/bot.js",
"typings": "./dist",
"scripts": {
@ -8,6 +8,8 @@
"build": "tsc",
"start": "node ./dist/bot.js",
"test": "jest --passWithNoTests",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"db:up": "typeorm migration:run -d dist/database/dataSources/appDataSource.js",
"db:down": "typeorm migration:revert -d dist/database/dataSources/appDataSource.js",
"db:create": "typeorm migration:create ./src/database/migrations/app/new",
@ -37,14 +39,15 @@
"minimatch": "9.0.3",
"mysql": "^2.18.1",
"ts-jest": "^29.0.0",
"typeorm": "0.3.17"
},
"resolutions": {
"**/undici": "^5.26.2"
"typeorm": "0.3.19"
},
"resolutions": {},
"devDependencies": {
"@types/node": "^20.0.0",
"np": "^8.0.4",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"eslint": "^8.56.0",
"np": "^9.0.0",
"typescript": "^5.0.0"
}
}

View file

@ -1,4 +1,5 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"baseBranches": ["develop"]
"baseBranches": ["develop"],
"labels": ["type/dependencies"]
}

View file

@ -2,12 +2,12 @@ import { readFileSync } from "fs";
import path from "path";
import Config from "../database/entities/app/Config";
import { glob } from "glob";
import SeriesMetadata from "../contracts/SeriesMetadata";
import { SeriesMetadata } from "../contracts/SeriesMetadata";
import { CoreClient } from "../client/client";
export default class CardMetadataFunction {
public static async Execute(overrideSafeMode: boolean = false): Promise<boolean> {
if (!overrideSafeMode && await Config.GetValue('safemode') == "true") return false;
if (!overrideSafeMode && await Config.GetValue("safemode") == "true") return false;
try {
CoreClient.Cards = await this.FindMetadataJSONs();
@ -16,7 +16,7 @@ export default class CardMetadataFunction {
} catch (e) {
console.error(e);
await Config.SetValue('safemode', 'true');
await Config.SetValue("safemode", "true");
return false;
}
@ -26,9 +26,9 @@ export default class CardMetadataFunction {
private static async FindMetadataJSONs(): Promise<SeriesMetadata[]> {
const res: SeriesMetadata[] = [];
const seriesJSONs = await glob(path.join(process.cwd(), 'cards', '/**/*.json'));
const seriesJSONs = await glob(path.join(process.env.DATA_DIR!, "cards", "/**/*.json"));
for (let jsonPath of seriesJSONs) {
for (const jsonPath of seriesJSONs) {
console.log(`Reading file ${jsonPath}`);
const jsonFile = readFileSync(jsonPath);
const parsedJson: SeriesMetadata[] = JSON.parse(jsonFile.toString());

View file

@ -14,6 +14,8 @@ const requiredConfigs: string[] = [
"BOT_OWNERID",
"BOT_CLIENTID",
"BOT_ENV",
"BOT_ADMINS",
"DATA_DIR",
"DB_HOST",
"DB_PORT",
"DB_AUTH_USER",
@ -21,8 +23,7 @@ const requiredConfigs: string[] = [
"DB_SYNC",
"DB_LOGGING",
"EXPRESS_PORT",
"GDRIVESYNC_WHITELIST",
]
];
requiredConfigs.forEach(config => {
if (!process.env[config]) {
@ -39,7 +40,7 @@ Registry.RegisterCommands();
Registry.RegisterEvents();
Registry.RegisterButtonEvents();
if (!existsSync(`${process.cwd()}/cards`) && process.env.GDRIVESYNC_AUTO && process.env.GDRIVESYNC_AUTO == 'true') {
if (!existsSync(`${process.env.DATA_DIR}/cards`) && process.env.GDRIVESYNC_AUTO && process.env.GDRIVESYNC_AUTO == "true") {
console.log("Card directory not found, syncing...");
CoreClient.AllowDrops = false;
@ -49,7 +50,7 @@ if (!existsSync(`${process.cwd()}/cards`) && process.env.GDRIVESYNC_AUTO && proc
console.error(error.code);
throw `Error while running sync command. Code: ${error.code}`;
} else {
console.log('Synced successfully.');
console.log("Synced successfully.");
CoreClient.AllowDrops = true;
}
});

View file

@ -8,20 +8,20 @@ export default class Claim extends ButtonEvent {
public override async execute(interaction: ButtonInteraction) {
if (!interaction.guild || !interaction.guildId) return;
const cardNumber = interaction.customId.split(' ')[1];
const claimId = interaction.customId.split(' ')[2];
const droppedBy = interaction.customId.split(' ')[3];
const cardNumber = interaction.customId.split(" ")[1];
const claimId = interaction.customId.split(" ")[2];
const droppedBy = interaction.customId.split(" ")[3];
const userId = interaction.user.id;
const claimed = await eClaim.FetchOneByClaimId(claimId);
if (claimed) {
await interaction.reply('This card has already been claimed');
await interaction.reply("This card has already been claimed");
return;
}
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.reply("The latest dropped card can only be claimed by the user who dropped it");
return;
}

View file

@ -0,0 +1,21 @@
import { ButtonInteraction } from "discord.js";
import { ButtonEvent } from "../type/buttonEvent";
import InventoryHelper from "../helpers/InventoryHelper";
export default class Inventory extends ButtonEvent {
public override async execute(interaction: ButtonInteraction) {
const userid = interaction.customId.split(" ")[1];
const page = interaction.customId.split(" ")[2];
try {
const embed = await InventoryHelper.GenerateInventoryPage(interaction.user.username, userid, Number(page));
await interaction.update({
embeds: [ embed.embed ],
components: [ embed.row ],
});
} catch {
await interaction.reply("No page for user found.");
}
}
}

View file

@ -1,4 +1,4 @@
import { AttachmentBuilder, ButtonInteraction, DiscordAPIError } from "discord.js";
import { AttachmentBuilder, ButtonInteraction } from "discord.js";
import { ButtonEvent } from "../type/buttonEvent";
import { readFileSync } from "fs";
import { v4 } from "uuid";
@ -11,28 +11,26 @@ import path from "path";
export default class Reroll extends ButtonEvent {
public override async execute(interaction: ButtonInteraction) {
if (!CoreClient.AllowDrops) {
await interaction.reply('Bot is currently syncing, please wait until its done.');
await interaction.reply("Bot is currently syncing, please wait until its done.");
return;
}
if (await Config.GetValue('safemode') == "true") {
await interaction.reply('Safe Mode has been activated, please resync to continue.');
if (await Config.GetValue("safemode") == "true") {
await interaction.reply("Safe Mode has been activated, please resync to continue.");
return;
}
const randomCard = CardDropHelperMetadata.GetRandomCard();
if (!randomCard) {
await interaction.reply('Unable to fetch card, please try again.');
await interaction.reply("Unable to fetch card, please try again.");
return;
}
try {
let image: Buffer;
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path));
const imageFileName = randomCard.card.path.split("/").pop()!;
image = readFileSync(path.join(process.cwd(), 'cards', randomCard.card.path));
await interaction.deferReply();
const attachment = new AttachmentBuilder(image, { name: imageFileName });

View file

@ -1,23 +1,22 @@
import { Client } from "discord.js";
import { Client, DMChannel, Guild, GuildBan, GuildMember, Message, NonThreadGuildBasedChannel, PartialGuildMember, PartialMessage } from "discord.js";
import * as dotenv from "dotenv";
import { EventType } from "../constants/EventType";
import ICommandItem from "../contracts/ICommandItem";
import IEventItem from "../contracts/IEventItem";
import EventExecutors from "../contracts/EventExecutors";
import { Command } from "../type/command";
import { Events } from "./events";
import { Util } from "./util";
import IButtonEventItem from "../contracts/IButtonEventItem";
import IButtonEventItem from "../contracts/ButtonEventItem";
import { ButtonEvent } from "../type/buttonEvent";
import AppDataSource from "../database/dataSources/appDataSource";
import { Environment } from "../constants/Environment";
import Webhooks from "../webhooks";
import CardMetadataFunction from "../Functions/CardMetadataFunction";
import SeriesMetadata from "../contracts/SeriesMetadata";
import { SeriesMetadata } from "../contracts/SeriesMetadata";
export class CoreClient extends Client {
private static _commandItems: ICommandItem[];
private static _eventItems: IEventItem[];
private static _eventExecutors: EventExecutors;
private static _buttonEvents: IButtonEventItem[];
private _events: Events;
@ -33,8 +32,8 @@ export class CoreClient extends Client {
return this._commandItems;
}
public static get eventItems(): IEventItem[] {
return this._eventItems;
public static get eventExecutors(): EventExecutors {
return this._eventExecutors;
}
public static get buttonEvents(): IButtonEventItem[] {
@ -46,7 +45,6 @@ export class CoreClient extends Client {
dotenv.config();
CoreClient._commandItems = [];
CoreClient._eventItems = [];
CoreClient._buttonEvents = [];
this._events = new Events();
@ -74,15 +72,11 @@ export class CoreClient extends Client {
await CardMetadataFunction.Execute(true);
this._util.loadEvents(this, CoreClient._eventItems);
this._util.loadEvents(this, CoreClient._eventExecutors);
this._util.loadSlashCommands(this);
this._webhooks.start();
console.log(`Registered Commands: ${CoreClient._commandItems.flatMap(x => x.Name).join(", ")}`);
console.log(`Registered Events: ${CoreClient._eventItems.flatMap(x => x.EventType).join(", ")}`);
console.log(`Registered Buttons: ${CoreClient._buttonEvents.flatMap(x => x.ButtonId).join(", ")}`);
await super.login(process.env.BOT_TOKEN);
}
@ -94,20 +88,260 @@ export class CoreClient extends Client {
ServerId: serverId,
};
if (environment &= CoreClient.Environment) {
if ((environment & CoreClient.Environment) == CoreClient.Environment) {
CoreClient._commandItems.push(item);
}
}
public static RegisterEvent(eventType: EventType, func: Function, environment: Environment = Environment.All) {
const item: IEventItem = {
EventType: eventType,
ExecutionFunction: func,
Environment: environment,
};
public static RegisterChannelCreateEvent(fn: (channel: NonThreadGuildBasedChannel) => void) {
if (this._eventExecutors) {
this._eventExecutors.ChannelCreate.push(fn);
} else {
this._eventExecutors = {
ChannelCreate: [ fn ],
ChannelDelete: [],
ChannelUpdate: [],
GuildBanAdd: [],
GuildBanRemove: [],
GuildCreate: [],
GuildMemberAdd: [],
GuildMemberRemove: [],
GuildMemebrUpdate: [],
MessageCreate: [],
MessageDelete: [],
MessageUpdate: [],
};
}
}
if (environment &= CoreClient.Environment) {
CoreClient._eventItems.push(item);
public static RegisterChannelDeleteEvent(fn: (channel: DMChannel | NonThreadGuildBasedChannel) => void) {
if (this._eventExecutors) {
this._eventExecutors.ChannelDelete.push(fn);
} else {
this._eventExecutors = {
ChannelCreate: [],
ChannelDelete: [ fn ],
ChannelUpdate: [],
GuildBanAdd: [],
GuildBanRemove: [],
GuildCreate: [],
GuildMemberAdd: [],
GuildMemberRemove: [],
GuildMemebrUpdate: [],
MessageCreate: [],
MessageDelete: [],
MessageUpdate: [],
};
}
}
public static RegisterChannelUpdateEvent(fn: (channel: DMChannel | NonThreadGuildBasedChannel) => void) {
if (this._eventExecutors) {
this._eventExecutors.ChannelCreate.push(fn);
} else {
this._eventExecutors = {
ChannelCreate: [],
ChannelDelete: [],
ChannelUpdate: [ fn ],
GuildBanAdd: [],
GuildBanRemove: [],
GuildCreate: [],
GuildMemberAdd: [],
GuildMemberRemove: [],
GuildMemebrUpdate: [],
MessageCreate: [],
MessageDelete: [],
MessageUpdate: [],
};
}
}
public static RegisterGuildBanAddEvent(fn: (ban: GuildBan) => void) {
if (this._eventExecutors) {
this._eventExecutors.GuildBanAdd.push(fn);
} else {
this._eventExecutors = {
ChannelCreate: [],
ChannelDelete: [],
ChannelUpdate: [],
GuildBanAdd: [ fn ],
GuildBanRemove: [],
GuildCreate: [],
GuildMemberAdd: [],
GuildMemberRemove: [],
GuildMemebrUpdate: [],
MessageCreate: [],
MessageDelete: [],
MessageUpdate: [],
};
}
}
public static RegisterGuildBanRemoveEvent(fn: (channel: GuildBan) => void) {
if (this._eventExecutors) {
this._eventExecutors.GuildBanRemove.push(fn);
} else {
this._eventExecutors = {
ChannelCreate: [],
ChannelDelete: [],
ChannelUpdate: [],
GuildBanAdd: [],
GuildBanRemove: [ fn ],
GuildCreate: [],
GuildMemberAdd: [],
GuildMemberRemove: [],
GuildMemebrUpdate: [],
MessageCreate: [],
MessageDelete: [],
MessageUpdate: [],
};
}
}
public static RegisterGuildCreateEvent(fn: (guild: Guild) => void) {
if (this._eventExecutors) {
this._eventExecutors.GuildCreate.push(fn);
} else {
this._eventExecutors = {
ChannelCreate: [],
ChannelDelete: [],
ChannelUpdate: [],
GuildBanAdd: [],
GuildBanRemove: [],
GuildCreate: [ fn ],
GuildMemberAdd: [],
GuildMemberRemove: [],
GuildMemebrUpdate: [],
MessageCreate: [],
MessageDelete: [],
MessageUpdate: [],
};
}
}
public static RegisterGuildMemberAddEvent(fn: (member: GuildMember) => void) {
if (this._eventExecutors) {
this._eventExecutors.GuildMemberAdd.push(fn);
} else {
this._eventExecutors = {
ChannelCreate: [],
ChannelDelete: [],
ChannelUpdate: [],
GuildBanAdd: [],
GuildBanRemove: [],
GuildCreate: [],
GuildMemberAdd: [ fn ],
GuildMemberRemove: [],
GuildMemebrUpdate: [],
MessageCreate: [],
MessageDelete: [],
MessageUpdate: [],
};
}
}
public static RegisterGuildMemberRemoveEvent(fn: (member: GuildMember | PartialGuildMember) => void) {
if (this._eventExecutors) {
this._eventExecutors.GuildMemberRemove.push(fn);
} else {
this._eventExecutors = {
ChannelCreate: [],
ChannelDelete: [],
ChannelUpdate: [],
GuildBanAdd: [],
GuildBanRemove: [],
GuildCreate: [],
GuildMemberAdd: [],
GuildMemberRemove: [ fn ],
GuildMemebrUpdate: [],
MessageCreate: [],
MessageDelete: [],
MessageUpdate: [],
};
}
}
public static GuildMemebrUpdate(fn: (oldMember: GuildMember | PartialGuildMember, newMember: GuildMember) => void) {
if (this._eventExecutors) {
this._eventExecutors.GuildMemebrUpdate.push(fn);
} else {
this._eventExecutors = {
ChannelCreate: [],
ChannelDelete: [],
ChannelUpdate: [],
GuildBanAdd: [],
GuildBanRemove: [],
GuildCreate: [],
GuildMemberAdd: [],
GuildMemberRemove: [],
GuildMemebrUpdate: [ fn ],
MessageCreate: [],
MessageDelete: [],
MessageUpdate: [],
};
}
}
public static RegisterMessageCreateEvent(fn: (message: Message<boolean>) => void) {
if (this._eventExecutors) {
this._eventExecutors.MessageCreate.push(fn);
} else {
this._eventExecutors = {
ChannelCreate: [],
ChannelDelete: [],
ChannelUpdate: [],
GuildBanAdd: [],
GuildBanRemove: [],
GuildCreate: [],
GuildMemberAdd: [],
GuildMemberRemove: [],
GuildMemebrUpdate: [],
MessageCreate: [ fn ],
MessageDelete: [],
MessageUpdate: [],
};
}
}
public static RegisterMessageDeleteEvent(fn: (message: Message<boolean> | PartialMessage) => void) {
if (this._eventExecutors) {
this._eventExecutors.MessageDelete.push(fn);
} else {
this._eventExecutors = {
ChannelCreate: [],
ChannelDelete: [],
ChannelUpdate: [],
GuildBanAdd: [],
GuildBanRemove: [],
GuildCreate: [],
GuildMemberAdd: [],
GuildMemberRemove: [],
GuildMemebrUpdate: [],
MessageCreate: [],
MessageDelete: [ fn ],
MessageUpdate: [],
};
}
}
public static RegisterMessageUpdateEvent(fn: (oldMessage: Message<boolean> | PartialMessage, newMessage: Message<boolean> | PartialMessage) => void) {
if (this._eventExecutors) {
this._eventExecutors.MessageUpdate.push(fn);
} else {
this._eventExecutors = {
ChannelCreate: [],
ChannelDelete: [],
ChannelUpdate: [],
GuildBanAdd: [],
GuildBanRemove: [],
GuildCreate: [],
GuildMemberAdd: [],
GuildMemberRemove: [],
GuildMemebrUpdate: [],
MessageCreate: [],
MessageDelete: [],
MessageUpdate: [ fn ],
};
}
}
@ -118,7 +352,7 @@ export class CoreClient extends Client {
Environment: environment,
};
if (environment &= CoreClient.Environment) {
if ((environment & CoreClient.Environment) == CoreClient.Environment) {
CoreClient._buttonEvents.push(item);
}
}

View file

@ -1,14 +1,14 @@
import { ButtonInteraction, Interaction } from "discord.js";
import { ButtonInteraction } from "discord.js";
import { CoreClient } from "../client";
export default class Button {
public static async onButtonClicked(interaction: ButtonInteraction) {
if (!interaction.isButton) return;
const item = CoreClient.buttonEvents.find(x => x.ButtonId == interaction.customId.split(' ')[0]);
const item = CoreClient.buttonEvents.find(x => x.ButtonId == interaction.customId.split(" ")[0]);
if (!item) {
await interaction.reply('Event not found');
await interaction.reply("Event not found");
return;
}

View file

@ -13,7 +13,7 @@ export default class ChatInputCommand {
if (!itemForServer) {
if (!item) {
await interaction.reply('Command not found');
await interaction.reply("Command not found");
return;
}

View file

@ -1,6 +1,5 @@
import { Client, REST, Routes, SlashCommandBuilder } from "discord.js";
import { EventType } from "../constants/EventType";
import IEventItem from "../contracts/IEventItem";
import EventExecutors from "../contracts/EventExecutors";
import { CoreClient } from "./client";
export class Util {
@ -10,25 +9,25 @@ export class Util {
const globalCommands = registeredCommands.filter(x => !x.ServerId);
const guildCommands = registeredCommands.filter(x => x.ServerId);
const globalCommandData: SlashCommandBuilder[] = [];
const globalCommandData: Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup">[] = [];
for (let command of globalCommands) {
for (const command of globalCommands) {
if (!command.Command.CommandBuilder) continue;
if (command.Environment &= CoreClient.Environment) {
if ((command.Environment & CoreClient.Environment) == CoreClient.Environment) {
globalCommandData.push(command.Command.CommandBuilder);
}
}
const guildIds: string[] = [];
for (let command of guildCommands) {
for (const command of guildCommands) {
if (!guildIds.find(x => x == command.ServerId)) {
guildIds.push(command.ServerId!);
}
}
const rest = new REST({ version: '10' }).setToken(process.env.BOT_TOKEN!);
const rest = new REST({ version: "10" }).setToken(process.env.BOT_TOKEN!);
rest.put(
Routes.applicationCommands(process.env.BOT_CLIENTID!),
@ -37,13 +36,13 @@ export class Util {
}
);
for (let guild of guildIds) {
const guildCommandData: SlashCommandBuilder[] = [];
for (const guild of guildIds) {
const guildCommandData: Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup">[] = [];
for (let command of guildCommands.filter(x => x.ServerId == guild)) {
for (const command of guildCommands.filter(x => x.ServerId == guild)) {
if (!command.Command.CommandBuilder) continue;
if (command.Environment &= CoreClient.Environment) {
if ((command.Environment & CoreClient.Environment) == CoreClient.Environment) {
guildCommandData.push(command.Command.CommandBuilder);
}
}
@ -55,53 +54,23 @@ export class Util {
{
body: guildCommandData
}
)
);
}
}
// Load the events
loadEvents(client: Client, events: IEventItem[]) {
events.forEach((e) => {
switch(e.EventType) {
case EventType.ChannelCreate:
client.on('channelCreate', (channel) => e.ExecutionFunction(channel));
break;
case EventType.ChannelDelete:
client.on('channelDelete', (channel) => e.ExecutionFunction(channel));
break;
case EventType.ChannelUpdate:
client.on('channelUpdate', (channel) => e.ExecutionFunction(channel));
break;
case EventType.GuildBanAdd:
client.on('guildBanAdd', (ban) => e.ExecutionFunction(ban));
break;
case EventType.GuildBanRemove:
client.on('guildBanRemove', (ban) => e.ExecutionFunction(ban));
break;
case EventType.GuildCreate:
client.on('guildCreate', (guild) => e.ExecutionFunction(guild));
break;
case EventType.GuildMemberAdd:
client.on('guildMemberAdd', (member) => e.ExecutionFunction(member));
break;
case EventType.GuildMemberRemove:
client.on('guildMemberRemove', (member) => e.ExecutionFunction(member));
break;
case EventType.GuildMemberUpdate:
client.on('guildMemberUpdate', (oldMember, newMember) => e.ExecutionFunction(oldMember, newMember));
break;
case EventType.MessageCreate:
client.on('messageCreate', (message) => e.ExecutionFunction(message));
break;
case EventType.MessageDelete:
client.on('messageDelete', (message) => e.ExecutionFunction(message));
break;
case EventType.MessageUpdate:
client.on('messageUpdate', (oldMessage, newMessage) => e.ExecutionFunction(oldMessage, newMessage));
break;
default:
console.error('Event not implemented.');
}
});
loadEvents(client: Client, events: EventExecutors) {
client.on("channelCreate", (channel) => events.ChannelCreate.forEach((fn) => fn(channel)));
client.on("channelDelete", (channel) => events.ChannelDelete.forEach((fn) => fn(channel)));
client.on("channelUpdate", (channel) => events.ChannelUpdate.forEach((fn) => fn(channel)));
client.on("guildBanAdd", (ban) => events.GuildBanAdd.forEach((fn) => fn(ban)));
client.on("guildBanRemove", (ban) => events.GuildBanRemove.forEach((fn) => fn(ban)));
client.on("guildCreate", (guild) => events.GuildCreate.forEach((fn) => fn(guild)));
client.on("guildMemberAdd", (member) => events.GuildMemberAdd.forEach((fn) => fn(member)));
client.on("guildMemberRemove", (member) => events.GuildMemberRemove.forEach((fn) => fn(member)));
client.on("guildMemberUpdate", (oldMember, newMember) => events.GuildMemebrUpdate.forEach((fn) => fn(oldMember, newMember)));
client.on("messageCreate", (message) => events.MessageCreate.forEach((fn) => fn(message)));
client.on("messageDelete", (message) => events.MessageDelete.forEach((fn) => fn(message)));
client.on("messageUpdate", (oldMessage, newMessage) => events.MessageUpdate.forEach((fn) => fn(oldMessage, newMessage)));
}
}

View file

@ -6,9 +6,9 @@ export default class About extends Command {
constructor() {
super();
super.CommandBuilder = new SlashCommandBuilder()
.setName('about')
.setDescription('About Bot');
this.CommandBuilder = new SlashCommandBuilder()
.setName("about")
.setDescription("About Bot");
}
public override async execute(interaction: CommandInteraction) {

View file

@ -1,4 +1,4 @@
import { AttachmentBuilder, CommandInteraction, DiscordAPIError, SlashCommandBuilder } from "discord.js";
import { AttachmentBuilder, CommandInteraction, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import { readFileSync } from "fs";
import { CoreClient } from "../client/client";
@ -12,35 +12,33 @@ export default class Drop extends Command {
constructor() {
super();
super.CommandBuilder = new SlashCommandBuilder()
.setName('drop')
.setDescription('Summon a new card drop');
this.CommandBuilder = new SlashCommandBuilder()
.setName("drop")
.setDescription("Summon a new card drop");
}
public override async execute(interaction: CommandInteraction) {
if (!CoreClient.AllowDrops) {
await interaction.reply('Bot is currently syncing, please wait until its done.');
await interaction.reply("Bot is currently syncing, please wait until its done.");
return;
}
if (await Config.GetValue('safemode') == "true") {
await interaction.reply('Safe Mode has been activated, please resync to continue.');
if (await Config.GetValue("safemode") == "true") {
await interaction.reply("Safe Mode has been activated, please resync to continue.");
return;
}
const randomCard = CardDropHelperMetadata.GetRandomCard();
if (!randomCard) {
await interaction.reply('Unable to fetch card, please try again.');
await interaction.reply("Unable to fetch card, please try again.");
return;
}
try {
let image: Buffer;
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path));
const imageFileName = randomCard.card.path.split("/").pop()!;
image = readFileSync(path.join(process.cwd(), 'cards', randomCard.card.path));
await interaction.deferReply();
const attachment = new AttachmentBuilder(image, { name: imageFileName });

View file

@ -9,37 +9,37 @@ export default class Gdrivesync extends Command {
constructor() {
super();
super.CommandBuilder = new SlashCommandBuilder()
.setName('gdrivesync')
.setDescription('Sync google drive to the bot')
this.CommandBuilder = new SlashCommandBuilder()
.setName("gdrivesync")
.setDescription("Sync google drive to the bot")
.setDefaultMemberPermissions(PermissionsBitField.Flags.Administrator);
}
public override async execute(interaction: CommandInteraction<CacheType>) {
if (!interaction.isChatInputCommand()) return;
const whitelistedUsers = process.env.GDRIVESYNC_WHITELIST!.split(',');
const whitelistedUsers = process.env.BOT_ADMINS!.split(",");
if (!whitelistedUsers.find(x => x == interaction.user.id)) {
await interaction.reply("Only whitelisted users can use this command.");
return;
}
await interaction.reply('Syncing, this might take a while...');
await interaction.reply("Syncing, this might take a while...");
CoreClient.AllowDrops = false;
exec(`rclone sync card-drop-gdrive: ${process.cwd()}/cards`, async (error: ExecException | null) => {
exec(`rclone sync card-drop-gdrive: ${process.env.DATA_DIR}/cards`, async (error: ExecException | null) => {
if (error) {
await interaction.editReply(`Error while running sync command. Safe Mode has been activated. Code: ${error.code}`);
await Config.SetValue('safemode', 'true');
await Config.SetValue("safemode", "true");
} else {
await CardMetadataFunction.Execute();
await interaction.editReply('Synced successfully.');
await interaction.editReply("Synced successfully.");
CoreClient.AllowDrops = true;
await Config.SetValue('safemode', 'false');
await Config.SetValue("safemode", "false");
}
});
}

68
src/commands/give.ts Normal file
View file

@ -0,0 +1,68 @@
import { CacheType, CommandInteraction, PermissionsBitField, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import { CoreClient } from "../client/client";
import Config from "../database/entities/app/Config";
import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata";
import Inventory from "../database/entities/app/Inventory";
export default class Give extends Command {
constructor() {
super();
this.CommandBuilder = new SlashCommandBuilder()
.setName("give")
.setDescription("Give a user a card manually, in case bot breaks")
.setDefaultMemberPermissions(PermissionsBitField.Flags.Administrator)
.addStringOption(x =>
x
.setName("cardnumber")
.setDescription("G")
.setRequired(true))
.addUserOption(x =>
x
.setName("user")
.setDescription("The user to give the card to")
.setRequired(true));
}
public override async execute(interaction: CommandInteraction<CacheType>) {
if (!CoreClient.AllowDrops) {
await interaction.reply("Bot is currently syncing, please wait until its done.");
return;
}
if (await Config.GetValue("safemode") == "true") {
await interaction.reply("Safe Mode has been activated, please resync to continue.");
return;
}
const whitelistedUsers = process.env.BOT_ADMINS!.split(",");
if (!whitelistedUsers.find(x => x == interaction.user.id)) {
await interaction.reply("Only whitelisted users can use this command.");
return;
}
const cardNumber = interaction.options.get("cardnumber", true);
const user = interaction.options.getUser("user", true);
const card = CardDropHelperMetadata.GetCardByCardNumber(cardNumber.value!.toString());
if (!card) {
await interaction.reply("Unable to fetch card, please try again.");
return;
}
let inventory = await Inventory.FetchOneByCardNumberAndUserId(user.id, card.id);
if (!inventory) {
inventory = new Inventory(user.id, card.id, 1);
} else {
inventory.SetQuantity(inventory.Quantity + 1);
}
await inventory.Save(Inventory, inventory);
await interaction.reply(`${card.name} given to ${interaction.user}, they now have ${inventory.Quantity}`);
}
}

38
src/commands/inventory.ts Normal file
View file

@ -0,0 +1,38 @@
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import InventoryHelper from "../helpers/InventoryHelper";
export default class Inventory extends Command {
constructor() {
super();
this.CommandBuilder = new SlashCommandBuilder()
.setName("inventory")
.setDescription("View your inventory")
.addNumberOption(x =>
x
.setName("page")
.setDescription("The page to start with"));
}
public override async execute(interaction: CommandInteraction) {
const page = interaction.options.get("page");
try {
let pageNumber = 0;
if (page && page.value) {
pageNumber = Number(page.value) - 1;
}
const embed = await InventoryHelper.GenerateInventoryPage(interaction.user.username, interaction.user.id, pageNumber);
await interaction.reply({
embeds: [ embed.embed ],
components: [ embed.row ],
});
} catch {
await interaction.reply("No page for user found.");
}
}
}

View file

@ -7,27 +7,27 @@ export default class Resync extends Command {
constructor() {
super();
super.CommandBuilder = new SlashCommandBuilder()
.setName('resync')
.setDescription('Resync the card database')
this.CommandBuilder = new SlashCommandBuilder()
.setName("resync")
.setDescription("Resync the card database")
.setDefaultMemberPermissions(PermissionsBitField.Flags.Administrator);
}
public override async execute(interaction: CommandInteraction<CacheType>) {
if (!interaction.isChatInputCommand()) return;
const whitelistedUsers = process.env.GDRIVESYNC_WHITELIST!.split(',');
const whitelistedUsers = process.env.BOT_ADMINS!.split(",");
if (!whitelistedUsers.find(x => x == interaction.user.id)) {
await interaction.reply("Only whitelisted users can use this command.");
return;
}
let result = await CardMetadataFunction.Execute(true);
const result = await CardMetadataFunction.Execute(true);
if (result) {
if (await Config.GetValue('safemode') == "true") {
await Config.SetValue('safemode', 'false');
if (await Config.GetValue("safemode") == "true") {
await Config.SetValue("safemode", "false");
await interaction.reply("Resynced database and disabled safe mode.");
return;

View file

@ -11,23 +11,23 @@ export default class Dropnumber extends Command {
constructor() {
super();
super.CommandBuilder = new SlashCommandBuilder()
.setName('dropnumber')
.setDescription('(TEST) Summon a specific card')
this.CommandBuilder = new SlashCommandBuilder()
.setName("dropnumber")
.setDescription("(TEST) Summon a specific card")
.addStringOption(x =>
x
.setName('cardnumber')
.setDescription('The card number to summon')
.setName("cardnumber")
.setDescription("The card number to summon")
.setRequired(true));
}
public override async execute(interaction: CommandInteraction<CacheType>) {
if (!interaction.isChatInputCommand()) return;
const cardNumber = interaction.options.get('cardnumber');
const cardNumber = interaction.options.get("cardnumber");
if (!cardNumber || !cardNumber.value) {
await interaction.reply('Card Number is required');
await interaction.reply("Card Number is required");
return;
}
@ -36,7 +36,7 @@ export default class Dropnumber extends Command {
.find(x => x.id == cardNumber.value);
if (!card) {
await interaction.reply('Card not found');
await interaction.reply("Card not found");
return;
}
@ -47,7 +47,7 @@ export default class Dropnumber extends Command {
const imageFileName = card.path.split("/").pop()!;
try {
image = readFileSync(path.join(process.cwd(), 'cards', card.path));
image = readFileSync(path.join(process.env.DATA_DIR!, "cards", card.path));
} catch {
await interaction.reply(`Unable to fetch image for card ${card.id}`);
return;
@ -78,7 +78,7 @@ export default class Dropnumber extends Command {
if (e instanceof DiscordAPIError) {
await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. Code: ${e.code}`);
} else {
await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. Code: UNKNOWN`);
await interaction.editReply("Unable to send next drop. Please try again, and report this if it keeps happening. Code: UNKNOWN");
}
}

View file

@ -12,37 +12,37 @@ export default class Droprarity extends Command {
constructor() {
super();
super.CommandBuilder = new SlashCommandBuilder()
.setName('droprarity')
.setDescription('(TEST) Summon a random card of a specific rarity')
this.CommandBuilder = new SlashCommandBuilder()
.setName("droprarity")
.setDescription("(TEST) Summon a random card of a specific rarity")
.addStringOption(x =>
x
.setName('rarity')
.setDescription('The rarity you want to summon')
.setName("rarity")
.setDescription("The rarity you want to summon")
.setRequired(true));
}
public override async execute(interaction: CommandInteraction<CacheType>) {
if (!interaction.isChatInputCommand()) return;
const rarity = interaction.options.get('rarity');
const rarity = interaction.options.get("rarity");
if (!rarity || !rarity.value) {
await interaction.reply('Rarity is required');
await interaction.reply("Rarity is required");
return;
}
const rarityType = CardRarityParse(rarity.value.toString());
if (rarityType == CardRarity.Unknown) {
await interaction.reply('Invalid rarity');
await interaction.reply("Invalid rarity");
return;
}
const card = await CardDropHelperMetadata.GetRandomCardByRarity(rarityType);
if (!card) {
await interaction.reply('Card not found');
await interaction.reply("Card not found");
return;
}
@ -50,7 +50,7 @@ export default class Droprarity extends Command {
const imageFileName = card.card.path.split("/").pop()!;
try {
image = readFileSync(path.join(process.cwd(), 'cards', card.card.path));
image = readFileSync(path.join(process.env.DATA_DIR!, "cards", card.card.path));
} catch {
await interaction.reply(`Unable to fetch image for card ${card.card.id}`);
return;
@ -81,7 +81,7 @@ export default class Droprarity extends Command {
if (e instanceof DiscordAPIError) {
await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. Code: ${e.code}`);
} else {
await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. Code: UNKNOWN`);
await interaction.editReply("Unable to send next drop. Please try again, and report this if it keeps happening. Code: UNKNOWN");
}
}

View file

@ -11,51 +11,51 @@ export enum CardRarity {
export function CardRarityToString(rarity: CardRarity): string {
switch (rarity) {
case CardRarity.Unknown:
return "Unknown";
case CardRarity.Bronze:
return "Bronze";
case CardRarity.Silver:
return "Silver";
case CardRarity.Gold:
return "Gold";
case CardRarity.Legendary:
return "Legendary";
case CardRarity.Manga:
return "Manga";
case CardRarity.Unknown:
return "Unknown";
case CardRarity.Bronze:
return "Bronze";
case CardRarity.Silver:
return "Silver";
case CardRarity.Gold:
return "Gold";
case CardRarity.Legendary:
return "Legendary";
case CardRarity.Manga:
return "Manga";
}
}
export function CardRarityToColour(rarity: CardRarity): number {
switch (rarity) {
case CardRarity.Unknown:
return EmbedColours.Grey;
case CardRarity.Bronze:
return EmbedColours.BronzeCard;
case CardRarity.Silver:
return EmbedColours.SilverCard;
case CardRarity.Gold:
return EmbedColours.GoldCard;
case CardRarity.Legendary:
return EmbedColours.LegendaryCard;
case CardRarity.Manga:
return EmbedColours.MangaCard;
case CardRarity.Unknown:
return EmbedColours.Grey;
case CardRarity.Bronze:
return EmbedColours.BronzeCard;
case CardRarity.Silver:
return EmbedColours.SilverCard;
case CardRarity.Gold:
return EmbedColours.GoldCard;
case CardRarity.Legendary:
return EmbedColours.LegendaryCard;
case CardRarity.Manga:
return EmbedColours.MangaCard;
}
}
export function CardRarityParse(rarity: string): CardRarity {
switch (rarity.toLowerCase()) {
case "bronze":
return CardRarity.Bronze;
case "silver":
return CardRarity.Silver;
case "gold":
return CardRarity.Gold;
case "legendary":
return CardRarity.Legendary;
case "manga":
return CardRarity.Manga;
default:
return CardRarity.Unknown;
case "bronze":
return CardRarity.Bronze;
case "silver":
return CardRarity.Silver;
case "gold":
return CardRarity.Gold;
case "legendary":
return CardRarity.Legendary;
case "manga":
return CardRarity.Manga;
default:
return CardRarity.Unknown;
}
}

View file

@ -11,13 +11,13 @@ export default class AppBaseEntity {
}
@PrimaryColumn()
Id: string;
Id: string;
@Column()
WhenCreated: Date;
WhenCreated: Date;
@Column()
WhenUpdated: Date;
WhenUpdated: Date;
public async Save<T extends AppBaseEntity>(target: EntityTarget<T>, entity: DeepPartial<T>): Promise<void> {
this.WhenUpdated = new Date();

View file

@ -1,8 +1,10 @@
import { Environment } from "../constants/Environment";
import { ButtonEvent } from "../type/buttonEvent";
export default interface IButtonEventItem {
interface ButtonEventItem {
ButtonId: string,
Event: ButtonEvent,
Environment: Environment,
}
}
export default ButtonEventItem;

View file

@ -0,0 +1,19 @@
import { DMChannel, Guild, GuildBan, GuildMember, Message, NonThreadGuildBasedChannel, PartialGuildMember, PartialMessage } from "discord.js";
interface EventExecutors {
ChannelCreate: ((channel: NonThreadGuildBasedChannel) => void)[],
ChannelDelete: ((channel: DMChannel | NonThreadGuildBasedChannel) => void)[],
ChannelUpdate: ((channel: DMChannel | NonThreadGuildBasedChannel) => void)[],
GuildBanAdd: ((ban: GuildBan) => void)[],
GuildBanRemove: ((ban: GuildBan) => void)[],
GuildCreate: ((guild: Guild) => void)[],
GuildMemberAdd: ((member: GuildMember) => void)[],
GuildMemberRemove: ((member: GuildMember | PartialGuildMember) => void)[],
GuildMemebrUpdate: ((oldMember: GuildMember | PartialGuildMember, newMember: GuildMember) => void)[],
MessageCreate: ((message: Message<boolean>) => void)[],
MessageDelete: ((message: Message<boolean> | PartialMessage) => void)[],
MessageUpdate: ((oldMessage: Message<boolean> | PartialMessage, newMessage: Message<boolean> | PartialMessage) => void)[],
}
export default EventExecutors;

View file

@ -1,9 +1,11 @@
import { Environment } from "../constants/Environment";
import { Command } from "../type/command";
export default interface ICommandItem {
interface ICommandItem {
Name: string,
Command: Command,
Environment: Environment,
ServerId?: string,
}
}
export default ICommandItem;

View file

@ -1,9 +0,0 @@
import { Environment } from "../constants/Environment";
import { EventType } from "../constants/EventType";
export default interface IEventItem {
EventType: EventType,
ExecutionFunction: Function,
Environment: Environment,
}

View file

@ -1,4 +1,4 @@
export default interface IGDriveFolderListing {
export interface IGDriveFolderListing {
id: string,
name: string,
};
}

View file

@ -1,6 +1,6 @@
import { CardRarity } from "../constants/CardRarity";
export default interface SeriesMetadata {
export interface SeriesMetadata {
id: number,
name: string,
cards: CardMetadata[],

View file

@ -12,10 +12,10 @@ export default class Claim extends AppBaseEntity {
}
@Column()
ClaimId: string;
ClaimId: string;
@ManyToOne(() => Inventory, x => x.Claims)
Inventory: Inventory;
Inventory: Inventory;
public SetInventory(inventory: Inventory) {
this.Inventory = inventory;

View file

@ -12,10 +12,10 @@ export default class Config extends AppBaseEntity {
}
@Column()
Key: string;
Key: string;
@Column()
Value: string;
Value: string;
public SetValue(value: string) {
this.Value = value;

View file

@ -14,16 +14,16 @@ export default class Inventory extends AppBaseEntity {
}
@Column()
UserId: string;
UserId: string;
@Column()
CardNumber: string;
CardNumber: string;
@Column()
Quantity: number;
Quantity: number;
@OneToMany(() => Claim, x => x.Inventory)
Claims: Claim[];
Claims: Claim[];
public SetQuantity(quantity: number) {
this.Quantity = quantity;
@ -40,4 +40,12 @@ export default class Inventory extends AppBaseEntity {
return single;
}
public static async FetchAllByUserId(userId: string): Promise<Inventory[]> {
const repository = AppDataSource.getRepository(Inventory);
const all = await repository.find({ where: { UserId: userId }});
return all;
}
}

View file

@ -1,17 +1,17 @@
import { MigrationInterface, QueryRunner } from "typeorm"
import MigrationHelper from "../../../../helpers/MigrationHelper"
import { MigrationInterface, QueryRunner } from "typeorm";
import MigrationHelper from "../../../../helpers/MigrationHelper";
export class CreateClaim1694609771821 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
MigrationHelper.Up('1694609771821-CreateClaim', '0.1.5', [
'01-CreateClaim',
'02-MoveToClaim',
'03-AlterInventory',
MigrationHelper.Up("1694609771821-CreateClaim", "0.1.5", [
"01-CreateClaim",
"02-MoveToClaim",
"03-AlterInventory",
], queryRunner);
}
public async down(queryRunner: QueryRunner): Promise<void> {
public async down(): Promise<void> {
}
}

View file

@ -1,15 +1,15 @@
import { MigrationInterface, QueryRunner } from "typeorm"
import MigrationHelper from "../../../../helpers/MigrationHelper"
import { MigrationInterface, QueryRunner } from "typeorm";
import MigrationHelper from "../../../../helpers/MigrationHelper";
export class CreateBase1693769942868 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
MigrationHelper.Up('1693769942868-CreateBase', '0.1', [
MigrationHelper.Up("1693769942868-CreateBase", "0.1", [
"01-table/Inventory",
], queryRunner);
}
public async down(queryRunner: QueryRunner): Promise<void> {
public async down(): Promise<void> {
}
}

View file

@ -1,15 +1,15 @@
import { MigrationInterface, QueryRunner } from "typeorm"
import MigrationHelper from "../../../../helpers/MigrationHelper"
import { MigrationInterface, QueryRunner } from "typeorm";
import MigrationHelper from "../../../../helpers/MigrationHelper";
export class CreateConfig1699814500650 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
MigrationHelper.Up('1699814500650-createConfig', '0.2', [
MigrationHelper.Up("1699814500650-createConfig", "0.2", [
"01-table/Config",
], queryRunner);
}
public async down(queryRunner: QueryRunner): Promise<void> {
public async down(): Promise<void> {
}
}

View file

@ -1,7 +1,7 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
import { CardRarity, CardRarityToColour, CardRarityToString } from "../constants/CardRarity";
import CardRarityChances from "../constants/CardRarityChances";
import { DropResult } from "../contracts/SeriesMetadata";
import { CardMetadata, DropResult } from "../contracts/SeriesMetadata";
import { CoreClient } from "../client/client";
export default class CardDropHelperMetadata {
@ -47,7 +47,15 @@ export default class CardDropHelperMetadata {
};
}
public static GenerateDropEmbed(drop: DropResult, quantityClaimed: Number, imageFileName: string): EmbedBuilder {
public static GetCardByCardNumber(cardNumber: string): CardMetadata | undefined {
const card = CoreClient.Cards
.flatMap(x => x.cards)
.find(x => x.id == cardNumber);
return card;
}
public static GenerateDropEmbed(drop: DropResult, quantityClaimed: number, imageFileName: string): EmbedBuilder {
let description = "";
description += `Series: ${drop.series.name}\n`;
description += `Claimed: ${quantityClaimed}\n`;
@ -68,7 +76,7 @@ export default class CardDropHelperMetadata {
.setLabel("Claim")
.setStyle(ButtonStyle.Primary),
new ButtonBuilder()
.setCustomId(`reroll`)
.setCustomId("reroll")
.setLabel("Reroll")
.setStyle(ButtonStyle.Secondary));
}

View file

@ -0,0 +1,98 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
import Inventory from "../database/entities/app/Inventory";
import { CoreClient } from "../client/client";
import EmbedColours from "../constants/EmbedColours";
import { CardRarity, CardRarityToString } from "../constants/CardRarity";
interface InventoryPage {
id: number,
name: string,
cards: InventoryPageCards[],
seriesSubpage: number,
}
interface InventoryPageCards {
id: string,
name: string,
type: CardRarity,
quantity: number,
}
export default class InventoryHelper {
public static async GenerateInventoryPage(username: string, userid: string, page: number): Promise<{ embed: EmbedBuilder, row: ActionRowBuilder<ButtonBuilder> }> {
const cardsPerPage = 15;
const inventory = await Inventory.FetchAllByUserId(userid);
const allSeriesClaimed = CoreClient.Cards
.sort((a, b) => a.id - b.id)
.filter(x => {
x.cards = x.cards
.sort((a, b) => b.type - a.type)
.filter(y => inventory.find(z => z.CardNumber == y.id));
return x;
});
const pages: InventoryPage[] = [];
for (const series of allSeriesClaimed) {
const seriesCards = series.cards;
for (let i = 0; i < seriesCards.length; i+= cardsPerPage) {
const cards = series.cards.slice(i, i + cardsPerPage);
const pageCards: InventoryPageCards[] = [];
for (const card of cards) {
const item = inventory.find(x => x.CardNumber == card.id);
if (!item) {
continue;
}
pageCards.push({
id: card.id,
name: card.name,
type: card.type,
quantity: item.Quantity,
});
}
pages.push({
id: series.id,
name: series.name,
cards: pageCards,
seriesSubpage: i / cardsPerPage,
});
}
}
const currentPage = pages[page];
if (!currentPage) {
console.error("Unable to find page");
return Promise.reject("Unable to find page");
}
const embed = new EmbedBuilder()
.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")}`)
.setFooter({ text: `Page ${page + 1} of ${pages.length}` })
.setColor(EmbedColours.Ok);
const row = new ActionRowBuilder<ButtonBuilder>()
.addComponents(
new ButtonBuilder()
.setCustomId(`inventory ${userid} ${page - 1}`)
.setLabel("Previous")
.setStyle(ButtonStyle.Primary)
.setDisabled(page == 0),
new ButtonBuilder()
.setCustomId(`inventory ${userid} ${page + 1}`)
.setLabel("Next")
.setStyle(ButtonStyle.Primary)
.setDisabled(page + 1 == pages.length));
return { embed, row };
}
}

View file

@ -3,7 +3,7 @@ import { QueryRunner } from "typeorm";
export default class MigrationHelper {
public static Up(migrationName: string, version: string, queryFiles: string[], queryRunner: QueryRunner) {
for (let path of queryFiles) {
for (const path of queryFiles) {
const query = readFileSync(`${process.cwd()}/database/${version}/${migrationName}/Up/${path}.sql`).toString();
queryRunner.query(query);
@ -11,7 +11,7 @@ export default class MigrationHelper {
}
public static Down(migrationName: string, version: string, queryFiles: string[], queryRunner: QueryRunner) {
for (let path of queryFiles) {
for (const path of queryFiles) {
const query = readFileSync(`${process.cwd()}/database/${version}/${migrationName}/Down/${path}.sql`).toString();
queryRunner.query(query);

View file

@ -1,7 +1,7 @@
export default class StringTools {
public static Capitalise(str: string): string {
const words = str.split(" ");
let result: string[] = [];
const result: string[] = [];
words.forEach(word => {
const firstLetter = word.substring(0, 1).toUpperCase();
@ -26,17 +26,17 @@ export default class StringTools {
public static RandomString(length: number) {
let result = "";
const characters = 'abcdefghkmnpqrstuvwxyz23456789';
const characters = "abcdefghkmnpqrstuvwxyz23456789";
const charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
for ( let i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
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);
}
}

View file

@ -4,23 +4,23 @@ export default class TimeLengthInput {
public readonly value: string;
constructor(input: string) {
this.value = StringTools.ReplaceAll(input, ',', '');
this.value = StringTools.ReplaceAll(input, ",", "");
}
public GetDays(): number {
return this.GetValue('d');
return this.GetValue("d");
}
public GetHours(): number {
return this.GetValue('h');
return this.GetValue("h");
}
public GetMinutes(): number {
return this.GetValue('m');
return this.GetValue("m");
}
public GetSeconds(): number {
return this.GetValue('s');
return this.GetValue("s");
}
public GetMilliseconds(): number {
@ -106,7 +106,7 @@ export default class TimeLengthInput {
}
private GetValue(designation: string): number {
const valueSplit = this.value.split(' ');
const valueSplit = this.value.split(" ");
const desString = valueSplit.find(x => x.charAt(x.length - 1) == designation);

View file

@ -2,7 +2,7 @@ import { Request, Response } from "express";
import CardMetadataFunction from "../Functions/CardMetadataFunction";
export default async function ReloadDB(req: Request, res: Response) {
console.log('Reloading Card DB...');
console.log("Reloading Card DB...");
await CardMetadataFunction.Execute();

View file

@ -1,9 +1,12 @@
import { CoreClient } from "./client/client";
import { Environment } from "./constants/Environment";
// Global Command Imports
import About from "./commands/about";
import Drop from "./commands/drop";
import Gdrivesync from "./commands/gdrivesync";
import Give from "./commands/give";
import Inventory from "./commands/inventory";
import Resync from "./commands/resync";
// Test Command Imports
@ -12,20 +15,22 @@ import Droprarity from "./commands/stage/droprarity";
// Button Event Imports
import Claim from "./buttonEvents/Claim";
import InventoryButtonEvent from "./buttonEvents/Inventory";
import Reroll from "./buttonEvents/Reroll";
import { Environment } from "./constants/Environment";
export default class Registry {
public static RegisterCommands() {
// Global Commands
CoreClient.RegisterCommand('about', new About());
CoreClient.RegisterCommand('drop', new Drop());
CoreClient.RegisterCommand('gdrivesync', new Gdrivesync());
CoreClient.RegisterCommand('resync', new Resync());
CoreClient.RegisterCommand("about", new About());
CoreClient.RegisterCommand("drop", new Drop());
CoreClient.RegisterCommand("gdrivesync", new Gdrivesync());
CoreClient.RegisterCommand("give", new Give());
CoreClient.RegisterCommand("inventory", new Inventory());
CoreClient.RegisterCommand("resync", new Resync());
// Test Commands
CoreClient.RegisterCommand('dropnumber', new Dropnumber(), Environment.Test);
CoreClient.RegisterCommand('droprarity', new Droprarity(), Environment.Test);
CoreClient.RegisterCommand("dropnumber", new Dropnumber(), Environment.Test);
CoreClient.RegisterCommand("droprarity", new Droprarity(), Environment.Test);
}
public static RegisterEvents() {
@ -33,7 +38,8 @@ export default class Registry {
}
public static RegisterButtonEvents() {
CoreClient.RegisterButtonEvent('claim', new Claim());
CoreClient.RegisterButtonEvent('reroll', new Reroll());
CoreClient.RegisterButtonEvent("claim", new Claim());
CoreClient.RegisterButtonEvent("inventory", new InventoryButtonEvent);
CoreClient.RegisterButtonEvent("reroll", new Reroll());
}
}

View file

@ -1,7 +1,5 @@
import { ButtonInteraction } from "discord.js";
export class ButtonEvent {
public execute(interaction: ButtonInteraction) {
}
export abstract class ButtonEvent {
abstract execute(interaction: ButtonInteraction): Promise<void>;
}

View file

@ -1,9 +1,7 @@
import { CommandInteraction } from "discord.js";
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
export class Command {
public CommandBuilder: any;
public execute(interaction: CommandInteraction) {
export abstract class Command {
public CommandBuilder: Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup">;
}
abstract execute(interaction: CommandInteraction): Promise<void>;
}

View file

@ -19,7 +19,7 @@ export default class Webhooks {
}
private setupRoutes() {
this.app.post('/api/reload-db', ReloadDB);
this.app.post("/api/reload-db", ReloadDB);
}
private setupListen() {