Compare commits

...

9 commits

Author SHA1 Message Date
887738c0c6 Fix linting issues
All checks were successful
Test / build (push) Successful in 15s
2024-10-11 17:54:40 +01:00
f7de57cf5d Fix embed not removing components after you run out 2024-10-11 17:54:24 +01:00
58e2fa3dfc Register button event 2024-10-11 17:42:17 +01:00
5bfb89524f Create sacrifice button handler 2024-10-11 17:41:30 +01:00
f6893b735e Merge branch 'develop' into feature/262-multidrop 2024-10-11 17:34:49 +01:00
480e496984 Update dependency typescript to v5.6.2 (#375)
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 17s
This PR contains the following updates:

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

---

### Release Notes

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

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

[Compare Source](https://github.com/microsoft/TypeScript/compare/v5.5.4...v5.6.2)

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

For the complete list of fixed issues, check out the

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

Downloads are available on:

-   [npm](https://www.npmjs.com/package/typescript)
-   [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:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6ImRldmVsb3AiLCJsYWJlbHMiOlsidHlwZS9kZXBlbmRlbmNpZXMiXX0=-->

Reviewed-on: #375
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-10-08 19:36:36 +01:00
a8a5e39e01 Update appleboy/ssh-action action to v1.1.0 (#374)
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 17s
This PR contains the following updates:

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

---

### Release Notes

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

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

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

##### Changelog

##### Bug fixes

-   [`0c7561b`](0c7561b1a3): fix: switch to SSH key authentication for security ([@&#8203;appleboy](https://github.com/appleboy))

##### Enhancements

-   [`9b978f0`](9b978f09f2): chore: update SSH action version in README files ([@&#8203;appleboy](https://github.com/appleboy))
-   [`1991c55`](1991c553ec): chore(file): update target file ([@&#8203;appleboy](https://github.com/appleboy))
-   [`aa293c2`](aa293c24bb): chore: optimize system configuration and API integration ([@&#8203;appleboy](https://github.com/appleboy))
-   [`036cad7`](036cad7df7): chore: update drone-ssh to version 1.7.7 ([@&#8203;appleboy](https://github.com/appleboy))
-   [`8b60782`](8b6078208d): chore(cli): enhance version handling and testing mechanisms ([@&#8203;appleboy](https://github.com/appleboy))
-   [`5ade826`](5ade826485): chore: improve CLI reliability and version visibility ([@&#8203;appleboy](https://github.com/appleboy))
-   [`eaeb069`](eaeb06998d): chore(cli): enhance curl command with silent mode and redirects ([@&#8203;appleboy](https://github.com/appleboy))
-   [`58164d0`](58164d0dc2): chore: remove Dockerfile and related configurations ([@&#8203;appleboy](https://github.com/appleboy))

##### Refactor

-   [`da612c8`](da612c8015): refactor: optimize CI pipeline for faster execution ([@&#8203;appleboy](https://github.com/appleboy))

##### Build process updates

-   [`c781418`](c78141851a): ci: enhance GitHub Actions for IPv6 and flexibility ([#&#8203;303](https://github.com/appleboy/ssh-action/issues/303)) ([@&#8203;appleboy](https://github.com/appleboy))
-   [`d2d6858`](d2d6858859): ci: enhance GitHub workflow for SSH actions and deployments ([@&#8203;appleboy](https://github.com/appleboy))
-   [`551964e`](551964ebda): ci: optimize GitHub Actions workflow configuration ([@&#8203;appleboy](https://github.com/appleboy))
-   [`f916346`](f916346256): ci: refactor CI workflow and improve robustness ([#&#8203;320](https://github.com/appleboy/ssh-action/issues/320)) ([@&#8203;appleboy](https://github.com/appleboy))
-   [`aabaf12`](aabaf1254d): ci: add bug report template ([@&#8203;appleboy](https://github.com/appleboy))
-   [`c8594ae`](c8594ae37d): ci: implement GitHub Actions for remote SSH execution ([@&#8203;appleboy](https://github.com/appleboy))
-   [`40aad53`](40aad53c5a): ci: add SSH authentication setup for GitHub Actions ([@&#8203;appleboy](https://github.com/appleboy))
-   [`0b0e770`](0b0e77098a): ci: optimize and enhance SSH server workflow ([@&#8203;appleboy](https://github.com/appleboy))
-   [`977b74a`](977b74a12d): ci: enhance CI workflow with SSH job and optimizations ([@&#8203;appleboy](https://github.com/appleboy))
-   [`2eeab5b`](2eeab5bdba): ci: refactor GitHub Actions key management ([@&#8203;appleboy](https://github.com/appleboy))
-   [`acd41e5`](acd41e5091): ci: enhance SSH job testing with varied key/password scenarios ([@&#8203;appleboy](https://github.com/appleboy))
-   [`f05aefe`](f05aefe351): ci: enhance SSH action configuration and error handling ([@&#8203;appleboy](https://github.com/appleboy))
-   [`e40b597`](e40b597081): ci: add GitHub Actions job for SSH key passphrase support ([@&#8203;appleboy](https://github.com/appleboy))
-   [`15b64dc`](15b64dc891): ci: enhance CI pipeline with SSH key handling improvements ([@&#8203;appleboy](https://github.com/appleboy))
-   [`a39b3cc`](a39b3cce7d): ci: enhance CI/CD pipeline with SSH command execution ([@&#8203;appleboy](https://github.com/appleboy))
-   [`815c574`](815c5743ac): ci: enhance deployment with multi-host SSH action ([@&#8203;appleboy](https://github.com/appleboy))
-   [`378323e`](378323e4c8): ci: add multi-server support to CI workflow ([@&#8203;appleboy](https://github.com/appleboy))
-   [`fc1c1fc`](fc1c1fce51): ci: add GitHub Actions job for [`ed25519`](https://github.com/appleboy/ssh-action/commit/ed25519) key support ([@&#8203;appleboy](https://github.com/appleboy))
-   [`f0e5a23`](f0e5a23d53): ci: add environment variable handling in GitHub Actions ([@&#8203;appleboy](https://github.com/appleboy))
-   [`9c32aa6`](9c32aa61f8): ci: refactor workflows and API integrations ([@&#8203;appleboy](https://github.com/appleboy))
-   [`97f8d75`](97f8d752b5): ci: enable root access in CI pipeline ([@&#8203;appleboy](https://github.com/appleboy))
-   [`5a8776f`](5a8776fd15): ci: switch to password authentication in GitHub workflow ([@&#8203;appleboy](https://github.com/appleboy))
-   [`b6941ae`](b6941ae5d5): ci: refactor codebase and optimize performance ([@&#8203;appleboy](https://github.com/appleboy))
-   [`43895f2`](43895f2cd5): ci: refactor SSH testing workflows and job configurations ([@&#8203;appleboy](https://github.com/appleboy))
-   [`06fa62e`](06fa62e61c): ci: rename the workflow files. ([@&#8203;appleboy](https://github.com/appleboy))
-   [`b4a07ca`](b4a07ca594): ci: enhance GitHub Actions with secret variable support ([#&#8203;330](https://github.com/appleboy/ssh-action/issues/330)) ([@&#8203;appleboy](https://github.com/appleboy))
-   [`25ce8cb`](25ce8cbbcb): ci: implement automated release workflow with GoReleaser ([@&#8203;appleboy](https://github.com/appleboy))

##### Documentation updates

-   [`8a779a5`](8a779a5b1a): docs: describe true usage of allenvs parameter ([#&#8203;301](https://github.com/appleboy/ssh-action/issues/301)) ([@&#8203;hussu010](https://github.com/hussu010))
-   [`fe44be0`](fe44be0b96): docs: improve documentation and CI robustness ([@&#8203;appleboy](https://github.com/appleboy))
-   [`dd0f09c`](dd0f09ca07): docs: improve README clarity and completeness ([@&#8203;appleboy](https://github.com/appleboy))
-   [`71d43ea`](71d43ea0f7): docs: improve documentation and testing configurations ([@&#8203;appleboy](https://github.com/appleboy))
-   [`28428a1`](28428a13f5): docs: improve cross-platform clipboard support for key copying ([@&#8203;appleboy](https://github.com/appleboy))
-   [`d732991`](d732991ab0): docs(lang): README.zh-cn Document ([#&#8203;332](https://github.com/appleboy/ssh-action/issues/332)) ([@&#8203;astralwaveio](https://github.com/astralwaveio))

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

Reviewed-on: #374
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-10-08 19:35:21 +01:00
816e550c84 Update dependency express to v4.21.0 (#373)
All checks were successful
Deploy To Stage / build (push) Successful in 9s
Deploy To Stage / deploy (push) Successful in 16s
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [express](http://expressjs.com/) ([source](https://github.com/expressjs/express)) | dependencies | minor | [`4.19.2` -> `4.21.0`](https://renovatebot.com/diffs/npm/express/4.19.2/4.21.0) |

---

### Release Notes

<details>
<summary>expressjs/express (express)</summary>

### [`v4.21.0`](https://github.com/expressjs/express/releases/tag/4.21.0)

[Compare Source](https://github.com/expressjs/express/compare/4.20.0...4.21.0)

#### What's Changed

-   Deprecate `"back"` magic string in redirects by [@&#8203;blakeembrey](https://github.com/blakeembrey) in https://github.com/expressjs/express/pull/5935
-   finalhandler@1.3.1 by [@&#8203;wesleytodd](https://github.com/wesleytodd) in https://github.com/expressjs/express/pull/5954
-   fix(deps): serve-static@1.16.2 by [@&#8203;wesleytodd](https://github.com/wesleytodd) in https://github.com/expressjs/express/pull/5951
-   Upgraded dependency qs to 6.13.0 to match qs in body-parser by [@&#8203;agadzinski93](https://github.com/agadzinski93) in https://github.com/expressjs/express/pull/5946

#### New Contributors

-   [@&#8203;agadzinski93](https://github.com/agadzinski93) made their first contribution in https://github.com/expressjs/express/pull/5946

**Full Changelog**: https://github.com/expressjs/express/compare/4.20.0...4.21.0

### [`v4.20.0`](https://github.com/expressjs/express/blob/HEAD/History.md#4200--2024-09-10)

[Compare Source](https://github.com/expressjs/express/compare/4.19.2...4.20.0)

\==========

-   deps: serve-static@0.16.0
    -   Remove link renderization in html while redirecting
-   deps: send@0.19.0
    -   Remove link renderization in html while redirecting
-   deps: body-parser@0.6.0
    -   add `depth` option to customize the depth level in the parser
    -   IMPORTANT: The default `depth` level for parsing URL-encoded data is now `32` (previously was `Infinity`)
-   Remove link renderization in html while using `res.redirect`
-   deps: path-to-regexp@0.1.10
    -   Adds support for named matching groups in the routes using a regex
    -   Adds backtracking protection to parameters without regexes defined
-   deps: encodeurl@~2.0.0
    -   Removes encoding of `\`, `|`, and `^` to align better with URL spec
-   Deprecate passing `options.maxAge` and `options.expires` to `res.clearCookie`
    -   Will be ignored in v5, clearCookie will set a cookie with an expires in the past to instruct clients to delete the cookie

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

Reviewed-on: #373
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-10-08 19:34:18 +01:00
cd7e0945a9 Update dependency @types/node to v20.16.10 (#372)
All checks were successful
Deploy To Stage / build (push) Successful in 17s
Deploy To Stage / deploy (push) Successful in 17s
This PR contains the following updates:

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

---

### Configuration

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

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

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

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

---

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

---

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

Reviewed-on: #372
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-10-08 19:32:47 +01:00
5 changed files with 161 additions and 80 deletions

View file

@ -30,7 +30,7 @@ jobs:
needs: build needs: build
runs-on: node runs-on: node
steps: steps:
- uses: https://github.com/appleboy/ssh-action@v1.0.3 - uses: https://github.com/appleboy/ssh-action@v1.1.0
env: env:
DB_NAME: ${{ secrets.PROD_DB_NAME }} DB_NAME: ${{ secrets.PROD_DB_NAME }}
DB_AUTH_USER: ${{ secrets.PROD_DB_AUTH_USER }} DB_AUTH_USER: ${{ secrets.PROD_DB_AUTH_USER }}

View file

@ -30,7 +30,7 @@ jobs:
needs: build needs: build
runs-on: node runs-on: node
steps: steps:
- uses: https://github.com/appleboy/ssh-action@v1.0.3 - uses: https://github.com/appleboy/ssh-action@v1.1.0
env: env:
DB_NAME: ${{ secrets.STAGE_DB_NAME }} DB_NAME: ${{ secrets.STAGE_DB_NAME }}
DB_AUTH_USER: ${{ secrets.STAGE_DB_AUTH_USER }} DB_AUTH_USER: ${{ secrets.STAGE_DB_AUTH_USER }}

View file

@ -8,6 +8,7 @@ import { readFileSync } from "fs";
import path from "path"; import path from "path";
import ErrorMessages from "../constants/ErrorMessages"; import ErrorMessages from "../constants/ErrorMessages";
import User from "../database/entities/app/User"; import User from "../database/entities/app/User";
import { GetSacrificeAmount } from "../constants/CardRarity";
export default class Multidrop extends ButtonEvent { export default class Multidrop extends ButtonEvent {
public override async execute(interaction: ButtonInteraction) { public override async execute(interaction: ButtonInteraction) {
@ -17,13 +18,16 @@ export default class Multidrop extends ButtonEvent {
case "keep": case "keep":
await this.Keep(interaction); await this.Keep(interaction);
break; break;
case "sacrifice":
await this.Sacrifice(interaction);
break;
default: default:
await interaction.reply("Invalid action"); await interaction.reply("Invalid action");
AppLogger.LogError("Button/Multidrop", `Invalid action, ${action}`); AppLogger.LogError("Button/Multidrop", `Invalid action, ${action}`);
} }
} }
public async Keep(interaction: ButtonInteraction) { private async Keep(interaction: ButtonInteraction) {
const cardNumber = interaction.customId.split(" ")[2]; const cardNumber = interaction.customId.split(" ")[2];
let cardsRemaining = Number(interaction.customId.split(" ")[3]) || 0; let cardsRemaining = Number(interaction.customId.split(" ")[3]) || 0;
const userId = interaction.customId.split(" ")[4]; const userId = interaction.customId.split(" ")[4];
@ -71,7 +75,12 @@ export default class Multidrop extends ButtonEvent {
.setDescription("Your multidrop has ran out! Please buy a new one!") .setDescription("Your multidrop has ran out! Please buy a new one!")
.setColor(EmbedColours.Ok); .setColor(EmbedColours.Ok);
await interaction.update({ embeds: [ embed ]}); await interaction.update({
embeds: [ embed ],
attachments: [],
components: [],
});
return; return;
} }
@ -88,7 +97,7 @@ export default class Multidrop extends ButtonEvent {
await interaction.deferUpdate(); await interaction.deferUpdate();
try { try {
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", )); const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path));
const imageFileName = randomCard.card.path.split("/").pop()!; const imageFileName = randomCard.card.path.split("/").pop()!;
const attachment = new AttachmentBuilder(image, { name: imageFileName }); const attachment = new AttachmentBuilder(image, { name: imageFileName });
@ -100,7 +109,7 @@ export default class Multidrop extends ButtonEvent {
const row = CardDropHelperMetadata.GenerateMultidropButtons(randomCard, cardsRemaining, interaction.user.id, cardsRemaining < 0); const row = CardDropHelperMetadata.GenerateMultidropButtons(randomCard, cardsRemaining, interaction.user.id, cardsRemaining < 0);
await interaction.update({ await interaction.editReply({
embeds: [ embed ], embeds: [ embed ],
files: [ attachment ], files: [ attachment ],
components: [ row ], components: [ row ],
@ -108,7 +117,97 @@ export default class Multidrop extends ButtonEvent {
} catch (e) { } catch (e) {
AppLogger.LogError("Button/Multidrop/Keep", `Error sending next drop for card ${randomCard.card.id}: ${e}`); AppLogger.LogError("Button/Multidrop/Keep", `Error sending next drop for card ${randomCard.card.id}: ${e}`);
await interaction.reply(`Unable to send next drop. Please try again, and report this if it keeps happening. (${randomCard.card.id})`); await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. (${randomCard.card.id})`);
}
}
private async Sacrifice(interaction: ButtonInteraction) {
const cardNumber = interaction.customId.split(" ")[2];
let cardsRemaining = Number(interaction.customId.split(" ")[3]) || 0;
const userId = interaction.customId.split(" ")[4];
if (interaction.user.id != userId) {
await interaction.reply("You're not the user this drop was made for!");
return;
}
const card = CardDropHelperMetadata.GetCardByCardNumber(cardNumber);
if (!card) {
await interaction.reply("Unable to find card.");
AppLogger.LogWarn("Button/Multidrop/Sacrifice", `Card not found, ${cardNumber}`);
return;
}
if (cardsRemaining < 0) {
await interaction.reply("Your multidrop has ran out! Please buy a new one!");
return;
}
const user = await User.FetchOneById(User, interaction.user.id);
if (!user) {
AppLogger.LogWarn("Button/Multidrop/Sacrifice", ErrorMessages.UnableToFetchUser);
await interaction.reply(ErrorMessages.UnableToFetchUser);
return;
}
// Sacrifice
const sacrificeAmount = GetSacrificeAmount(card.card.type);
user.AddCurrency(sacrificeAmount);
await user.Save(User, user);
// Pack has ran out
if (cardsRemaining == 0) {
const embed = new EmbedBuilder()
.setDescription("Your multidrop has ran out! Please buy a new one!")
.setColor(EmbedColours.Ok);
await interaction.update({
embeds: [ embed ],
attachments: [],
components: [],
});
return;
}
// Drop next card
const randomCard = CardDropHelperMetadata.GetRandomCard();
cardsRemaining -= 1;
if (!randomCard) {
AppLogger.LogWarn("Button/Multidrop/Sacrifice", ErrorMessages.UnableToFetchCard);
await interaction.reply(ErrorMessages.UnableToFetchCard);
return;
}
await interaction.deferUpdate();
try {
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path));
const imageFileName = randomCard.card.path.split("/").pop()!;
const attachment = new AttachmentBuilder(image, { name: imageFileName });
const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, randomCard.card.id);
const quantityClaimed = inventory ? inventory.Quantity : 0;
const embed = CardDropHelperMetadata.GenerateMultidropEmbed(randomCard, quantityClaimed, imageFileName, cardsRemaining, undefined, user.Currency);
const row = CardDropHelperMetadata.GenerateMultidropButtons(randomCard, cardsRemaining, interaction.user.id, cardsRemaining < 0);
await interaction.editReply({
embeds: [ embed ],
files: [ attachment ],
components: [ row ],
});
} catch (e) {
AppLogger.LogError("Button/Multidrop/Sacrifice", `Error sending next drop for card ${randomCard.card.id}: ${e}`);
await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. (${randomCard.card.id})`);
} }
} }
} }

View file

@ -26,6 +26,7 @@ import Droprarity from "./commands/stage/droprarity";
// Button Event Imports // Button Event Imports
import Claim from "./buttonEvents/Claim"; import Claim from "./buttonEvents/Claim";
import InventoryButtonEvent from "./buttonEvents/Inventory"; import InventoryButtonEvent from "./buttonEvents/Inventory";
import MultidropButtonEvent from "./buttonEvents/Multidrop";
import Reroll from "./buttonEvents/Reroll"; import Reroll from "./buttonEvents/Reroll";
import SacrificeButtonEvent from "./buttonEvents/Sacrifice"; import SacrificeButtonEvent from "./buttonEvents/Sacrifice";
import SeriesEvent from "./buttonEvents/Series"; import SeriesEvent from "./buttonEvents/Series";
@ -63,6 +64,7 @@ export default class Registry {
public static RegisterButtonEvents() { public static RegisterButtonEvents() {
CoreClient.RegisterButtonEvent("claim", new Claim()); CoreClient.RegisterButtonEvent("claim", new Claim());
CoreClient.RegisterButtonEvent("inventory", new InventoryButtonEvent()); CoreClient.RegisterButtonEvent("inventory", new InventoryButtonEvent());
CoreClient.RegisterButtonEvent("multidrop", new MultidropButtonEvent());
CoreClient.RegisterButtonEvent("reroll", new Reroll()); CoreClient.RegisterButtonEvent("reroll", new Reroll());
CoreClient.RegisterButtonEvent("sacrifice", new SacrificeButtonEvent()); CoreClient.RegisterButtonEvent("sacrifice", new SacrificeButtonEvent());
CoreClient.RegisterButtonEvent("series", new SeriesEvent()); CoreClient.RegisterButtonEvent("series", new SeriesEvent());

114
yarn.lock
View file

@ -1282,9 +1282,9 @@
integrity sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g== integrity sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==
"@types/node@^20.0.0": "@types/node@^20.0.0":
version "20.16.5" version "20.16.10"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.16.5.tgz#d43c7f973b32ffdf9aa7bd4f80e1072310fd7a53" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.16.10.tgz#0cc3fdd3daf114a4776f54ba19726a01c907ef71"
integrity sha512-VwYCweNo3ERajwy0IUlqqcyZ8/A7Zwa9ZP3MnENWcB11AejO+tLy3pu850goUW2FC/IJMdZUfKpX/yxL1gymCA== integrity sha512-vQUKgWTjEIRFCvK6CyriPH3MZYiYlNy0fKiEYHWbcoWLEgs4opurGGKlebrTLqdSMIbXImH6XExNiIyNUv3WpA==
dependencies: dependencies:
undici-types "~6.19.2" undici-types "~6.19.2"
@ -1798,25 +1798,7 @@ bmp-js@^0.1.0:
resolved "https://registry.yarnpkg.com/bmp-js/-/bmp-js-0.1.0.tgz#e05a63f796a6c1ff25f4771ec7adadc148c07233" resolved "https://registry.yarnpkg.com/bmp-js/-/bmp-js-0.1.0.tgz#e05a63f796a6c1ff25f4771ec7adadc148c07233"
integrity sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw== integrity sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw==
body-parser@1.20.2: body-parser@1.20.3, body-parser@^1.20.2:
version "1.20.2"
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.2.tgz#6feb0e21c4724d06de7ff38da36dad4f57a747fd"
integrity sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==
dependencies:
bytes "3.1.2"
content-type "~1.0.5"
debug "2.6.9"
depd "2.0.0"
destroy "1.2.0"
http-errors "2.0.0"
iconv-lite "0.4.24"
on-finished "2.4.1"
qs "6.11.0"
raw-body "2.5.2"
type-is "~1.6.18"
unpipe "1.0.0"
body-parser@^1.20.2:
version "1.20.3" version "1.20.3"
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.3.tgz#1953431221c6fb5cd63c4b36d53fab0928e548c6" resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.3.tgz#1953431221c6fb5cd63c4b36d53fab0928e548c6"
integrity sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g== integrity sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==
@ -2701,6 +2683,11 @@ encodeurl@~1.0.2:
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==
encodeurl@~2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-2.0.0.tgz#7b8ea898077d7e409d3ac45474ea38eaf0857a58"
integrity sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==
end-of-stream@^1.1.0: end-of-stream@^1.1.0:
version "1.4.4" version "1.4.4"
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0"
@ -2934,36 +2921,36 @@ expect@^29.0.0, expect@^29.7.0:
jest-util "^29.7.0" jest-util "^29.7.0"
express@^4.18.2: express@^4.18.2:
version "4.19.2" version "4.21.0"
resolved "https://registry.yarnpkg.com/express/-/express-4.19.2.tgz#e25437827a3aa7f2a827bc8171bbbb664a356465" resolved "https://registry.yarnpkg.com/express/-/express-4.21.0.tgz#d57cb706d49623d4ac27833f1cbc466b668eb915"
integrity sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q== integrity sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng==
dependencies: dependencies:
accepts "~1.3.8" accepts "~1.3.8"
array-flatten "1.1.1" array-flatten "1.1.1"
body-parser "1.20.2" body-parser "1.20.3"
content-disposition "0.5.4" content-disposition "0.5.4"
content-type "~1.0.4" content-type "~1.0.4"
cookie "0.6.0" cookie "0.6.0"
cookie-signature "1.0.6" cookie-signature "1.0.6"
debug "2.6.9" debug "2.6.9"
depd "2.0.0" depd "2.0.0"
encodeurl "~1.0.2" encodeurl "~2.0.0"
escape-html "~1.0.3" escape-html "~1.0.3"
etag "~1.8.1" etag "~1.8.1"
finalhandler "1.2.0" finalhandler "1.3.1"
fresh "0.5.2" fresh "0.5.2"
http-errors "2.0.0" http-errors "2.0.0"
merge-descriptors "1.0.1" merge-descriptors "1.0.3"
methods "~1.1.2" methods "~1.1.2"
on-finished "2.4.1" on-finished "2.4.1"
parseurl "~1.3.3" parseurl "~1.3.3"
path-to-regexp "0.1.7" path-to-regexp "0.1.10"
proxy-addr "~2.0.7" proxy-addr "~2.0.7"
qs "6.11.0" qs "6.13.0"
range-parser "~1.2.1" range-parser "~1.2.1"
safe-buffer "5.2.1" safe-buffer "5.2.1"
send "0.18.0" send "0.19.0"
serve-static "1.15.0" serve-static "1.16.2"
setprototypeof "1.2.0" setprototypeof "1.2.0"
statuses "2.0.1" statuses "2.0.1"
type-is "~1.6.18" type-is "~1.6.18"
@ -3093,13 +3080,13 @@ fill-range@^7.1.1:
dependencies: dependencies:
to-regex-range "^5.0.1" to-regex-range "^5.0.1"
finalhandler@1.2.0: finalhandler@1.3.1:
version "1.2.0" version "1.3.1"
resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.2.0.tgz#7d23fe5731b207b4640e4fcd00aec1f9207a7b32" resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.3.1.tgz#0c575f1d1d324ddd1da35ad7ece3df7d19088019"
integrity sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg== integrity sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==
dependencies: dependencies:
debug "2.6.9" debug "2.6.9"
encodeurl "~1.0.2" encodeurl "~2.0.0"
escape-html "~1.0.3" escape-html "~1.0.3"
on-finished "2.4.1" on-finished "2.4.1"
parseurl "~1.3.3" parseurl "~1.3.3"
@ -4792,10 +4779,10 @@ meow@^12.1.1:
resolved "https://registry.yarnpkg.com/meow/-/meow-12.1.1.tgz#e558dddbab12477b69b2e9a2728c327f191bace6" resolved "https://registry.yarnpkg.com/meow/-/meow-12.1.1.tgz#e558dddbab12477b69b2e9a2728c327f191bace6"
integrity sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw== integrity sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==
merge-descriptors@1.0.1: merge-descriptors@1.0.3:
version "1.0.1" version "1.0.3"
resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.3.tgz#d80319a65f3c7935351e5cfdac8f9318504dbed5"
integrity sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w== integrity sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==
merge-stream@^2.0.0: merge-stream@^2.0.0:
version "2.0.0" version "2.0.0"
@ -5541,10 +5528,10 @@ path-scurry@^2.0.0:
lru-cache "^11.0.0" lru-cache "^11.0.0"
minipass "^7.1.2" minipass "^7.1.2"
path-to-regexp@0.1.7: path-to-regexp@0.1.10:
version "0.1.7" version "0.1.10"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.10.tgz#67e9108c5c0551b9e5326064387de4763c4d5f8b"
integrity sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ== integrity sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==
path-type@^4.0.0: path-type@^4.0.0:
version "4.0.0" version "4.0.0"
@ -5689,13 +5676,6 @@ pure-rand@^6.0.0:
resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2"
integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==
qs@6.11.0:
version "6.11.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a"
integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==
dependencies:
side-channel "^1.0.4"
qs@6.13.0: qs@6.13.0:
version "6.13.0" version "6.13.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906" resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906"
@ -6029,10 +6009,10 @@ semver@^7.5.3, semver@^7.6.0, semver@^7.6.3:
resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143"
integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==
send@0.18.0: send@0.19.0:
version "0.18.0" version "0.19.0"
resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" resolved "https://registry.yarnpkg.com/send/-/send-0.19.0.tgz#bbc5a388c8ea6c048967049dbeac0e4a3f09d7f8"
integrity sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg== integrity sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==
dependencies: dependencies:
debug "2.6.9" debug "2.6.9"
depd "2.0.0" depd "2.0.0"
@ -6048,15 +6028,15 @@ send@0.18.0:
range-parser "~1.2.1" range-parser "~1.2.1"
statuses "2.0.1" statuses "2.0.1"
serve-static@1.15.0: serve-static@1.16.2:
version "1.15.0" version "1.16.2"
resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.15.0.tgz#faaef08cffe0a1a62f60cad0c4e513cff0ac9540" resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.16.2.tgz#b6a5343da47f6bdd2673848bf45754941e803296"
integrity sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g== integrity sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==
dependencies: dependencies:
encodeurl "~1.0.2" encodeurl "~2.0.0"
escape-html "~1.0.3" escape-html "~1.0.3"
parseurl "~1.3.3" parseurl "~1.3.3"
send "0.18.0" send "0.19.0"
set-blocking@^2.0.0: set-blocking@^2.0.0:
version "2.0.0" version "2.0.0"
@ -6107,7 +6087,7 @@ shebang-regex@^3.0.0:
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
side-channel@^1.0.4, side-channel@^1.0.6: side-channel@^1.0.6:
version "1.0.6" version "1.0.6"
resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.6.tgz#abd25fb7cd24baf45466406b1096b7831c9215f2" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.6.tgz#abd25fb7cd24baf45466406b1096b7831c9215f2"
integrity sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA== integrity sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==
@ -6705,9 +6685,9 @@ types-pkg-json@^1.1.0:
types-json "^1.2.2" types-json "^1.2.2"
typescript@^5.0.0: typescript@^5.0.0:
version "5.5.4" version "5.6.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.2.tgz#d1de67b6bef77c41823f822df8f0b3bcff60a5a0"
integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q== integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==
undici-types@~6.19.2: undici-types@~6.19.2:
version "6.19.8" version "6.19.8"