Compare commits

...

17 commits

Author SHA1 Message Date
b30e2f4533 Update dependency discord.js to v14.15.3
Some checks failed
Test / build (push) Failing after 9s
2024-06-02 23:02:05 +00:00
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
ebec66607f 0.6.1 2024-06-02 16:11:05 +01:00
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
837013835e Fix user being able to claim cards with a 0 balance 2024-06-02 15:39:24 +01:00
cfcc8ad100 0.6.0
All checks were successful
Deploy To Production / build (push) Successful in 2m30s
Deploy To Production / deploy (push) Successful in 17s
Deploy To Stage / build (push) Successful in 11s
Deploy To Stage / deploy (push) Successful in 16s
2024-06-01 18:09:42 +01:00
302a762912 0.6.0 2024-06-01 18:07:04 +01:00
6b9d71758a Add a warning to the logs if an ID is used twice (#248)
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.

- Make the bot log a warning if the card metadata function finds duplicated ids

#233

## 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: #248
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-06-01 14:52:38 +01:00
682f62d42b Update the daily command text to be more user friendly (#246)
All checks were successful
Deploy To Stage / build (push) Successful in 2m30s
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.

- Update the daily command text to be more user friendly

#202, #240

## 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: #246
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-06-01 14:49:13 +01:00
916244b57c Add balance command (#244)
All checks were successful
Deploy To Stage / build (push) Successful in 10s
Deploy To Stage / deploy (push) Successful in 19s
# 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 balance command

#228

## 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: #244
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-06-01 14:47:21 +01:00
696810e093 Update the give currency timer to give 10 coins every 20 minutes (#236)
All checks were successful
Deploy To Stage / build (push) Successful in 2m31s
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.

- Give the currency to a user every 20 minutes
- This is enough so that they can run claim once every 20 minutes

#204, #226, #229

## Type of change

Please delete options that are not relevant.

- [x] Bug fix (non-breaking change which fixes an issue)

# How Has This Been Tested?

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

# Checklist

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

Reviewed-on: #236
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-06-01 14:42:51 +01:00
be2b837d56 Merge branch 'main' into develop
All checks were successful
Deploy To Stage / build (push) Successful in 22s
Deploy To Stage / deploy (push) Successful in 16s
2024-05-30 17:38:33 +01:00
34ea1f87d7 0.5.2
All checks were successful
Deploy To Production / build (push) Successful in 2m27s
Deploy To Production / deploy (push) Successful in 17s
2024-05-30 17:34:22 +01:00
ba9ade0659 0.5.2
All checks were successful
Test / build (push) Successful in 2m28s
2024-05-30 17:28:43 +01:00
e36ef85507 Merge branch 'hotfix/0.5.2' into develop
All checks were successful
Deploy To Stage / build (push) Successful in 11s
Deploy To Stage / deploy (push) Successful in 16s
2024-05-29 17:40:36 +01:00
297e34e1cf Fix bug where large file attachments would cause claiming to fail interaction
All checks were successful
Test / build (push) Successful in 2m28s
2024-05-29 17:36:58 +01:00
318b07e206 Update dependency ts-jest to v29.1.3 (#241)
All checks were successful
Deploy To Stage / build (push) Successful in 2m29s
Deploy To Stage / deploy (push) Successful in 18s
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.2` -> `29.1.3`](https://renovatebot.com/diffs/npm/ts-jest/29.1.2/29.1.3) |

---

### Release Notes

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

### [`v29.1.3`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2913-2024-05-21)

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

##### Bug Fixes

-   add `@jest/transform` as an optional peer dependency ([0ba7f86](0ba7f861c3))
-   bring back Node 14 support ([eda56a7](eda56a7797))

##### Performance Improvements

-   remove ts resolved module cache file ([4c88da5](4c88da5899))

</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: #241
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-05-28 17:58:30 +01:00
15 changed files with 176 additions and 92 deletions

View file

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

139
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "card-drop", "name": "card-drop",
"version": "0.5.1", "version": "0.6.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "card-drop", "name": "card-drop",
"version": "0.5.1", "version": "0.6.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@discordjs/rest": "^2.0.0", "@discordjs/rest": "^2.0.0",
@ -732,19 +732,24 @@
} }
}, },
"node_modules/@discordjs/builders": { "node_modules/@discordjs/builders": {
"version": "1.7.0", "version": "1.8.2",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.8.2.tgz",
"integrity": "sha512-6wvG3QaCjtMu0xnle4SoOIeFB4y6fKMN6WZfy3BMKJdQQtPLik8KGzDwBVL/+wTtcE/ZlFjgEk74GublyEVZ7g==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@discordjs/formatters": "^0.3.3", "@discordjs/formatters": "^0.4.0",
"@discordjs/util": "^1.0.2", "@discordjs/util": "^1.1.0",
"@sapphire/shapeshift": "^3.9.3", "@sapphire/shapeshift": "^3.9.7",
"discord-api-types": "0.37.61", "discord-api-types": "0.37.83",
"fast-deep-equal": "^3.1.3", "fast-deep-equal": "^3.1.3",
"ts-mixer": "^6.0.3", "ts-mixer": "^6.0.4",
"tslib": "^2.6.2" "tslib": "^2.6.2"
}, },
"engines": { "engines": {
"node": ">=16.11.0" "node": ">=16.11.0"
},
"funding": {
"url": "https://github.com/discordjs/discord.js?sponsor"
} }
}, },
"node_modules/@discordjs/collection": { "node_modules/@discordjs/collection": {
@ -760,13 +765,18 @@
} }
}, },
"node_modules/@discordjs/formatters": { "node_modules/@discordjs/formatters": {
"version": "0.3.3", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.4.0.tgz",
"integrity": "sha512-fJ06TLC1NiruF35470q3Nr1bi95BdvKFAF+T5bNfZJ4bNdqZ3VZ+Ttg6SThqTxm6qumSG3choxLBHMC69WXNXQ==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"discord-api-types": "0.37.61" "discord-api-types": "0.37.83"
}, },
"engines": { "engines": {
"node": ">=16.11.0" "node": ">=16.11.0"
},
"funding": {
"url": "https://github.com/discordjs/discord.js?sponsor"
} }
}, },
"node_modules/@discordjs/rest": { "node_modules/@discordjs/rest": {
@ -792,22 +802,6 @@
"url": "https://github.com/discordjs/discord.js?sponsor" "url": "https://github.com/discordjs/discord.js?sponsor"
} }
}, },
"node_modules/@discordjs/rest/node_modules/@sapphire/snowflake": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.5.3.tgz",
"integrity": "sha512-jjmJywLAFoWeBi1W7994zZyiNWPIiqRRNAmSERxyg93xRGzNYvGjlZ0gR6x0F4gPRi2+0O6S71kOZYyr3cxaIQ==",
"license": "MIT",
"engines": {
"node": ">=v14.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@discordjs/rest/node_modules/discord-api-types": {
"version": "0.37.83",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.83.tgz",
"integrity": "sha512-urGGYeWtWNYMKnYlZnOnDHm8fVRffQs3U0SpE8RHeiuLKb/u92APS8HoQnPTFbnXmY1vVnXjXO4dOxcAn3J+DA==",
"license": "MIT"
},
"node_modules/@discordjs/util": { "node_modules/@discordjs/util": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/@discordjs/util/-/util-1.1.0.tgz", "resolved": "https://registry.npmjs.org/@discordjs/util/-/util-1.1.0.tgz",
@ -821,21 +815,26 @@
} }
}, },
"node_modules/@discordjs/ws": { "node_modules/@discordjs/ws": {
"version": "1.0.2", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/@discordjs/ws/-/ws-1.1.1.tgz",
"integrity": "sha512-PZ+vLpxGCRtmr2RMkqh8Zp+BenUaJqlS6xhgWKEZcgC/vfHLEzpHtKkB0sl3nZWpwtcKk6YWy+pU3okL2I97FA==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@discordjs/collection": "^2.0.0", "@discordjs/collection": "^2.1.0",
"@discordjs/rest": "^2.1.0", "@discordjs/rest": "^2.3.0",
"@discordjs/util": "^1.0.2", "@discordjs/util": "^1.1.0",
"@sapphire/async-queue": "^1.5.0", "@sapphire/async-queue": "^1.5.2",
"@types/ws": "^8.5.9", "@types/ws": "^8.5.10",
"@vladfrangu/async_event_emitter": "^2.2.2", "@vladfrangu/async_event_emitter": "^2.2.4",
"discord-api-types": "0.37.61", "discord-api-types": "0.37.83",
"tslib": "^2.6.2", "tslib": "^2.6.2",
"ws": "^8.14.2" "ws": "^8.16.0"
}, },
"engines": { "engines": {
"node": ">=16.11.0" "node": ">=16.11.0"
},
"funding": {
"url": "https://github.com/discordjs/discord.js?sponsor"
} }
}, },
"node_modules/@discordjs/ws/node_modules/@types/ws": { "node_modules/@discordjs/ws/node_modules/@types/ws": {
@ -1715,19 +1714,22 @@
} }
}, },
"node_modules/@sapphire/shapeshift": { "node_modules/@sapphire/shapeshift": {
"version": "3.9.3", "version": "3.9.7",
"resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.9.7.tgz",
"integrity": "sha512-4It2mxPSr4OGn4HSQWGmhFMsNFGfFVhWeRPCRwbH972Ek2pzfGRZtb0pJ4Ze6oIzcyh2jw7nUDa6qGlWofgd9g==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"fast-deep-equal": "^3.1.3", "fast-deep-equal": "^3.1.3",
"lodash": "^4.17.21" "lodash": "^4.17.21"
}, },
"engines": { "engines": {
"node": ">=v14.0.0", "node": ">=v16"
"npm": ">=7.0.0"
} }
}, },
"node_modules/@sapphire/snowflake": { "node_modules/@sapphire/snowflake": {
"version": "3.5.1", "version": "3.5.3",
"resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.5.3.tgz",
"integrity": "sha512-jjmJywLAFoWeBi1W7994zZyiNWPIiqRRNAmSERxyg93xRGzNYvGjlZ0gR6x0F4gPRi2+0O6S71kOZYyr3cxaIQ==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=v14.0.0", "node": ">=v14.0.0",
@ -2009,13 +2011,6 @@
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz",
"integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==" "integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA=="
}, },
"node_modules/@types/ws": {
"version": "8.5.9",
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/yargs": { "node_modules/@types/yargs": {
"version": "17.0.32", "version": "17.0.32",
"license": "MIT", "license": "MIT",
@ -4241,34 +4236,41 @@
} }
}, },
"node_modules/discord-api-types": { "node_modules/discord-api-types": {
"version": "0.37.61", "version": "0.37.83",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.83.tgz",
"integrity": "sha512-urGGYeWtWNYMKnYlZnOnDHm8fVRffQs3U0SpE8RHeiuLKb/u92APS8HoQnPTFbnXmY1vVnXjXO4dOxcAn3J+DA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/discord.js": { "node_modules/discord.js": {
"version": "14.14.1", "version": "14.15.3",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.15.3.tgz",
"integrity": "sha512-/UJDQO10VuU6wQPglA4kz2bw2ngeeSbogiIPx/TsnctfzV/tNf+q+i1HlgtX1OGpeOBpJH9erZQNO5oRM2uAtQ==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@discordjs/builders": "^1.7.0", "@discordjs/builders": "^1.8.2",
"@discordjs/collection": "1.5.3", "@discordjs/collection": "1.5.3",
"@discordjs/formatters": "^0.3.3", "@discordjs/formatters": "^0.4.0",
"@discordjs/rest": "^2.1.0", "@discordjs/rest": "^2.3.0",
"@discordjs/util": "^1.0.2", "@discordjs/util": "^1.1.0",
"@discordjs/ws": "^1.0.2", "@discordjs/ws": "^1.1.1",
"@sapphire/snowflake": "3.5.1", "@sapphire/snowflake": "3.5.3",
"@types/ws": "8.5.9", "discord-api-types": "0.37.83",
"discord-api-types": "0.37.61",
"fast-deep-equal": "3.1.3", "fast-deep-equal": "3.1.3",
"lodash.snakecase": "4.1.1", "lodash.snakecase": "4.1.1",
"tslib": "2.6.2", "tslib": "2.6.2",
"undici": "5.27.2", "undici": "6.13.0"
"ws": "8.14.2"
}, },
"engines": { "engines": {
"node": ">=16.11.0" "node": ">=16.11.0"
},
"funding": {
"url": "https://github.com/discordjs/discord.js?sponsor"
} }
}, },
"node_modules/discord.js/node_modules/@discordjs/collection": { "node_modules/discord.js/node_modules/@discordjs/collection": {
"version": "1.5.3", "version": "1.5.3",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.5.3.tgz",
"integrity": "sha512-SVb428OMd3WO1paV3rm6tSjM4wC+Kecaa1EUGX7vc6/fddvw/6lg90z4QtCqm21zvVe92vMMDt9+DkIvjXImQQ==",
"license": "Apache-2.0", "license": "Apache-2.0",
"engines": { "engines": {
"node": ">=16.11.0" "node": ">=16.11.0"
@ -10919,9 +10921,10 @@
} }
}, },
"node_modules/ts-jest": { "node_modules/ts-jest": {
"version": "29.1.2", "version": "29.1.3",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.3.tgz",
"integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==", "integrity": "sha512-6L9qz3ginTd1NKhOxmkP0qU3FyKjj5CPoY+anszfVn6Pmv/RIKzhiMCsH7Yb7UvJR9I2A64rm4zQl531s2F1iw==",
"license": "MIT",
"dependencies": { "dependencies": {
"bs-logger": "0.x", "bs-logger": "0.x",
"fast-json-stable-stringify": "2.x", "fast-json-stable-stringify": "2.x",
@ -10936,10 +10939,11 @@
"ts-jest": "cli.js" "ts-jest": "cli.js"
}, },
"engines": { "engines": {
"node": "^16.10.0 || ^18.0.0 || >=20.0.0" "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": ">=7.0.0-beta.0 <8", "@babel/core": ">=7.0.0-beta.0 <8",
"@jest/transform": "^29.0.0",
"@jest/types": "^29.0.0", "@jest/types": "^29.0.0",
"babel-jest": "^29.0.0", "babel-jest": "^29.0.0",
"jest": "^29.0.0", "jest": "^29.0.0",
@ -10949,6 +10953,9 @@
"@babel/core": { "@babel/core": {
"optional": true "optional": true
}, },
"@jest/transform": {
"optional": true
},
"@jest/types": { "@jest/types": {
"optional": true "optional": true
}, },
@ -10961,7 +10968,9 @@
} }
}, },
"node_modules/ts-mixer": { "node_modules/ts-mixer": {
"version": "6.0.3", "version": "6.0.4",
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.4.tgz",
"integrity": "sha512-ufKpbmrugz5Aou4wcr5Wc1UUFWOLhq+Fm6qa6P0w0K5Qw2yhaUoiWszhCVuNQyNwrlGiscHOmqYoAox1PtvgjA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/tslib": { "node_modules/tslib": {
@ -11652,7 +11661,9 @@
} }
}, },
"node_modules/ws": { "node_modules/ws": {
"version": "8.14.2", "version": "8.17.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz",
"integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=10.0.0" "node": ">=10.0.0"

View file

@ -1,6 +1,6 @@
{ {
"name": "card-drop", "name": "card-drop",
"version": "0.5.1", "version": "0.6.1",
"main": "./dist/bot.js", "main": "./dist/bot.js",
"typings": "./dist", "typings": "./dist",
"scripts": { "scripts": {

View file

@ -39,6 +39,13 @@ export default class CardMetadataFunction {
CoreClient.Cards = cardResult.Result!; CoreClient.Cards = cardResult.Result!;
AppLogger.LogInfo("Functions/CardMetadataFunction", `Loaded ${CoreClient.Cards.flatMap(x => x.cards).length} cards to database`); AppLogger.LogInfo("Functions/CardMetadataFunction", `Loaded ${CoreClient.Cards.flatMap(x => x.cards).length} cards to database`);
const duplicateCards = CoreClient.Cards.flatMap(x => x.cards)
.filter((card, index, self) => self.findIndex(c => c.id === card.id) !== index);
if (duplicateCards.length > 0) {
AppLogger.LogWarn("Functions/CardMetadataFunction", `Duplicate card ids found: ${duplicateCards.flatMap(x => x.id).join(", ")}`);
}
return { return {
IsSuccess: true, IsSuccess: true,
}; };

View file

@ -1,18 +1,19 @@
import { AttachmentBuilder, ButtonInteraction } from "discord.js"; import { ButtonInteraction } from "discord.js";
import { ButtonEvent } from "../type/buttonEvent"; import { ButtonEvent } from "../type/buttonEvent";
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 { default as eClaim } from "../database/entities/app/Claim"; import { default as eClaim } from "../database/entities/app/Claim";
import AppLogger from "../client/appLogger"; import AppLogger from "../client/appLogger";
import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata"; import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata";
import { readFileSync } from "fs";
import path from "path";
import User from "../database/entities/app/User"; import User from "../database/entities/app/User";
import CardConstants from "../constants/CardConstants"; 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();
const cardNumber = interaction.customId.split(" ")[1]; const cardNumber = interaction.customId.split(" ")[1];
const claimId = interaction.customId.split(" ")[2]; const claimId = interaction.customId.split(" ")[2];
@ -21,15 +22,26 @@ export default class Claim extends ButtonEvent {
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;
}
await user.Save(User, user);
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;
} }
@ -43,17 +55,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);
@ -65,17 +66,13 @@ export default class Claim extends ButtonEvent {
return; return;
} }
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", card.card.path));
const imageFileName = card.card.path.split("/").pop()!; const imageFileName = card.card.path.split("/").pop()!;
const attachment = new AttachmentBuilder(image, { name: imageFileName });
const embed = CardDropHelperMetadata.GenerateDropEmbed(card, inventory.Quantity, imageFileName, interaction.user.username); const embed = CardDropHelperMetadata.GenerateDropEmbed(card, inventory.Quantity, imageFileName, interaction.user.username);
const row = CardDropHelperMetadata.GenerateDropButtons(card, claimId, interaction.user.id, true); const row = CardDropHelperMetadata.GenerateDropButtons(card, claimId, interaction.user.id, true);
await interaction.update({ await interaction.editReply({
embeds: [ embed ], embeds: [ embed ],
files: [ attachment ],
components: [ row ], components: [ row ],
}); });
} }

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) {

View file

@ -79,7 +79,7 @@ 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("*/30 * * * * *", "Europe/London", GiveCurrency, false); const timerId = this._timerHelper.AddTimer("*/20 * * * *", "Europe/London", GiveCurrency, false);
this._timerHelper.StartTimer(timerId); this._timerHelper.StartTimer(timerId);
}) })
.catch(err => { .catch(err => {

28
src/commands/balance.ts Normal file
View file

@ -0,0 +1,28 @@
import { CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import User from "../database/entities/app/User";
import EmbedColours from "../constants/EmbedColours";
export default class Balance extends Command {
constructor() {
super();
this.CommandBuilder = new SlashCommandBuilder()
.setName("balance")
.setDescription("Get your currency balance");
}
public override async execute(interaction: CommandInteraction) {
const user = await User.FetchOneById(User, interaction.user.id);
let userBalance = user != null ? user.Currency : 0;
const embed = new EmbedBuilder()
.setColor(EmbedColours.Ok)
.setTitle("Balance")
.setDescription(`You currently have **${userBalance} currency**!`)
.setFooter({ text: interaction.user.username, iconURL: interaction.user.avatarURL() ?? undefined });
await interaction.reply({ embeds: [ embed ]});
}
}

View file

@ -38,6 +38,6 @@ export default class Daily extends Command {
await user.Save(User, user); await user.Save(User, user);
await interaction.reply(`Given ${CardConstants.DailyCurrency} currency to ${interaction.user.username}`); await interaction.reply(`Congratulations, you have claimed your daily ${CardConstants.DailyCurrency} currency! You now have ${user.Currency} currency and can claim again in 24 hours!`);
} }
} }

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) {

View file

@ -36,6 +36,11 @@ export default class Trade extends Command {
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}`);
if (interaction.user.id == user.id) {
await interaction.reply("You can not create a trade with yourself.");
return;
}
const giveItemEntity = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, give.value!.toString()); const giveItemEntity = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, give.value!.toString());
const receiveItemEntity = await Inventory.FetchOneByCardNumberAndUserId(user.id, receive.value!.toString()); const receiveItemEntity = await Inventory.FetchOneByCardNumberAndUserId(user.id, receive.value!.toString());

View file

@ -1,5 +1,6 @@
export default class CardConstants { export default class CardConstants {
public static readonly ClaimCost = 10; public static readonly ClaimCost = 10;
public static readonly TimerGiveAmount = 10;
public static readonly DailyCurrency = 100; public static readonly DailyCurrency = 100;
public static readonly StartingCurrency = 300; public static readonly StartingCurrency = 300;
} }

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 Balance from "./commands/balance";
import Daily from "./commands/daily"; import Daily from "./commands/daily";
import Drop from "./commands/drop"; import Drop from "./commands/drop";
import Gdrivesync from "./commands/gdrivesync"; import Gdrivesync from "./commands/gdrivesync";
@ -30,6 +31,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("balance", new Balance());
CoreClient.RegisterCommand("daily", new Daily()); CoreClient.RegisterCommand("daily", new Daily());
CoreClient.RegisterCommand("drop", new Drop()); CoreClient.RegisterCommand("drop", new Drop());
CoreClient.RegisterCommand("gdrivesync", new Gdrivesync()); CoreClient.RegisterCommand("gdrivesync", new Gdrivesync());

View file

@ -1,4 +1,5 @@
import AppLogger from "../client/appLogger"; import AppLogger from "../client/appLogger";
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() {
@ -7,10 +8,10 @@ export default async function GiveCurrency() {
const users = await User.FetchAll(User); const users = await User.FetchAll(User);
for (const user of users) { for (const user of users) {
user.AddCurrency(5); user.AddCurrency(CardConstants.TimerGiveAmount);
} }
User.SaveAll(User, users); User.SaveAll(User, users);
AppLogger.LogInfo("Timers/GiveCurrency", `Successfully gave +5 currency to ${users.length} users`); AppLogger.LogInfo("Timers/GiveCurrency", `Successfully gave +${CardConstants.TimerGiveAmount} currency to ${users.length} users`);
} }