Compare commits

..

8 commits

Author SHA1 Message Date
27e214d262 Update dependency @types/node to v20.8.7
All checks were successful
continuous-integration/drone/push Build is passing
2023-10-22 23:01:43 +00:00
f38d1ef23a Ignore cards.db file
All checks were successful
continuous-integration/drone/push Build is passing
2023-10-21 17:51:49 +01:00
b1aab93fad Merge branch 'main' into develop
Some checks failed
continuous-integration/drone/push Build is failing
2023-10-21 17:50:11 +01:00
a8062f20ae v0.1.6
All checks were successful
continuous-integration/drone/push Build is passing
2023-10-21 17:49:57 +01:00
7b73c66a3c Fix bug where card db would try to load non-images to the database
All checks were successful
continuous-integration/drone/push Build is passing
2023-10-21 17:47:14 +01:00
ce75d8fab6 Add quantity claimed to drop embed (#61)
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 the quantity which the user has claimed to the drop embed

#37

## Type of change

Please delete options that are not relevant.

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

# How Has This Been Tested?

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

- This has been tested by running the command for a card which has no claimed card and ensure it says 0
- Then reran the command for that card and ensured it says 1

# Checklist

- [x] My code follows the style guidelines of this project
- [x] 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
- [x] 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/61
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2023-10-20 17:33:22 +01:00
6c78c0f74d Update dependency googleapis to v127 (#59)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [googleapis](https://github.com/googleapis/google-api-nodejs-client) | dependencies | major | [`^126.0.0` -> `^127.0.0`](https://renovatebot.com/diffs/npm/googleapis/126.0.0/127.0.0) |

---

### Configuration

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

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

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

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

---

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

---

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

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/59
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2023-10-16 19:21:22 +01:00
c24cfc3463 Update dependency jest to v29.7.0 (#41)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [jest](https://jestjs.io/) ([source](https://github.com/jestjs/jest)) | dependencies | minor | [`29.6.2` -> `29.7.0`](https://renovatebot.com/diffs/npm/jest/29.6.2/29.7.0) |
| [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | dependencies | patch | [`29.5.3` -> `29.5.5`](https://renovatebot.com/diffs/npm/@types%2fjest/29.5.3/29.5.5) |

---

### Release Notes

<details>
<summary>jestjs/jest (jest)</summary>

### [`v29.7.0`](55cd6a0aaf...4e56991693)

[Compare Source](55cd6a0aaf...4e56991693)

### [`v29.6.4`](fb7d95c8af...55cd6a0aaf)

[Compare Source](fb7d95c8af...55cd6a0aaf)

### [`v29.6.3`](0fd5b1c375...fb7d95c8af)

[Compare Source](0fd5b1c375...fb7d95c8af)

</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 these updates 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:eyJjcmVhdGVkSW5WZXIiOiIzNi44OS4wIiwidXBkYXRlZEluVmVyIjoiMzcuMC4wIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCJ9-->

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/41
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2023-10-16 19:19:13 +01:00
6 changed files with 601 additions and 549 deletions

3
.gitignore vendored
View file

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

View file

@ -1,6 +1,6 @@
{
"name": "card-drop",
"version": "0.1.5",
"version": "0.1.6",
"main": "./dist/bot.js",
"typings": "./dist",
"scripts": {
@ -28,7 +28,7 @@
"@types/uuid": "^9.0.0",
"discord.js": "^14.3.0",
"dotenv": "^16.0.0",
"googleapis": "^126.0.0",
"googleapis": "^127.0.0",
"jest": "^29.0.0",
"jest-mock-extended": "^3.0.0",
"minimatch": "9.0.3",

View file

@ -59,7 +59,7 @@ export default class CardSetupFunction {
const cardDirLegendary = legendaryExists ? readdirSync(path.join(process.cwd(), 'cards', series.Path, 'LEGENDARY')) : [];
const cardDirSilver = silverExists ? readdirSync(path.join(process.cwd(), 'cards', series.Path, 'SILVER')) : [];
for (let file of cardDirBronze) {
for (let file of cardDirBronze.filter(x => !x.startsWith('.') && (x.endsWith('.png') || x.endsWith('.jpg') || x.endsWith('.gif')))) {
const filePart = file.split('.');
const cardId = filePart[0];
@ -70,7 +70,7 @@ export default class CardSetupFunction {
cardsToSave.push(card);
}
for (let file of cardDirGold) {
for (let file of cardDirGold.filter(x => !x.startsWith('.') && (x.endsWith('.png') || x.endsWith('.jpg') || x.endsWith('.gif')))) {
const filePart = file.split('.');
const cardId = filePart[0];
@ -81,7 +81,7 @@ export default class CardSetupFunction {
cardsToSave.push(card);
}
for (let file of cardDirLegendary) {
for (let file of cardDirLegendary.filter(x => !x.startsWith('.') && (x.endsWith('.png') || x.endsWith('.jpg') || x.endsWith('.gif')))) {
const filePart = file.split('.');
const cardId = filePart[0];
@ -92,7 +92,7 @@ export default class CardSetupFunction {
cardsToSave.push(card);
}
for (let file of cardDirSilver) {
for (let file of cardDirSilver.filter(x => !x.startsWith('.') && (x.endsWith('.png') || x.endsWith('.jpg') || x.endsWith('.gif')))) {
const filePart = file.split('.');
const cardId = filePart[0];

View file

@ -6,6 +6,7 @@ import { CardRarityToColour, CardRarityToString } from "../constants/CardRarity"
import { v4 } from "uuid";
import { CoreClient } from "../client/client";
import Card from "../database/entities/card/Card";
import Inventory from "../database/entities/app/Inventory";
export default class Reroll extends ButtonEvent {
public override async execute(interaction: ButtonInteraction) {
@ -32,9 +33,16 @@ export default class Reroll extends ButtonEvent {
const attachment = new AttachmentBuilder(image, { name: randomCard.FileName });
const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, randomCard.CardNumber);
const quantityClaimed = inventory ? inventory.Quantity : 0;
let embedDescription = "";
embedDescription += `Series: ${randomCard.Series.Name}\n`;
embedDescription += `Claimed: ${quantityClaimed || 0}\n`;
const embed = new EmbedBuilder()
.setTitle(randomCard.Name)
.setDescription(randomCard.Series.Name)
.setDescription(embedDescription)
.setFooter({ text: CardRarityToString(randomCard.Rarity) })
.setColor(CardRarityToColour(randomCard.Rarity))
.setImage(`attachment://${randomCard.FileName}`);

View file

@ -6,6 +6,7 @@ import { readFileSync } from "fs";
import { CoreClient } from "../client/client";
import { v4 } from "uuid";
import Card from "../database/entities/card/Card";
import Inventory from "../database/entities/app/Inventory";
export default class Drop extends Command {
constructor() {
@ -38,9 +39,16 @@ export default class Drop extends Command {
const attachment = new AttachmentBuilder(image, { name: randomCard.FileName });
const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, randomCard.CardNumber);
const quantityClaimed = inventory ? inventory.Quantity : 0;
let embedDescription = "";
embedDescription += `Series: ${randomCard.Series.Name}\n`;
embedDescription += `Claimed: ${quantityClaimed || 0}\n`;
const embed = new EmbedBuilder()
.setTitle(randomCard.Name)
.setDescription(randomCard.Series.Name)
.setDescription(embedDescription)
.setFooter({ text: CardRarityToString(randomCard.Rarity) })
.setColor(CardRarityToColour(randomCard.Rarity))
.setImage(`attachment://${randomCard.FileName}`);

1115
yarn.lock

File diff suppressed because it is too large Load diff