This commit is contained in:
parent
0e5489f0d1
commit
4359cbba1e
2 changed files with 5 additions and 3 deletions
|
@ -23,7 +23,7 @@ export default class Sacrifice extends ButtonEvent {
|
||||||
private async confirm(interaction: ButtonInteraction) {
|
private async confirm(interaction: ButtonInteraction) {
|
||||||
const userId = interaction.customId.split(" ")[2];
|
const userId = interaction.customId.split(" ")[2];
|
||||||
const cardNumber = interaction.customId.split(" ")[3];
|
const cardNumber = interaction.customId.split(" ")[3];
|
||||||
const quantity = Number(interaction.customId.split(" ")[4]) ?? 1;
|
const quantity = Number(interaction.customId.split(" ")[4]) || 1;
|
||||||
|
|
||||||
if (userId != interaction.user.id) {
|
if (userId != interaction.user.id) {
|
||||||
await interaction.reply("Only the user who created this sacrifice can confirm it.");
|
await interaction.reply("Only the user who created this sacrifice can confirm it.");
|
||||||
|
@ -105,7 +105,7 @@ export default class Sacrifice extends ButtonEvent {
|
||||||
private async cancel(interaction: ButtonInteraction) {
|
private async cancel(interaction: ButtonInteraction) {
|
||||||
const userId = interaction.customId.split(" ")[2];
|
const userId = interaction.customId.split(" ")[2];
|
||||||
const cardNumber = interaction.customId.split(" ")[3];
|
const cardNumber = interaction.customId.split(" ")[3];
|
||||||
const quantity = Number(interaction.customId.split(" ")[4]) ?? 1;
|
const quantity = Number(interaction.customId.split(" ")[4]) || 1;
|
||||||
|
|
||||||
if (userId != interaction.user.id) {
|
if (userId != interaction.user.id) {
|
||||||
await interaction.reply("Only the user who created this sacrifice can cancel it.");
|
await interaction.reply("Only the user who created this sacrifice can cancel it.");
|
||||||
|
|
|
@ -25,7 +25,9 @@ export default class Sacrifice extends Command {
|
||||||
|
|
||||||
public override async execute(interaction: CommandInteraction<CacheType>): Promise<void> {
|
public override async execute(interaction: CommandInteraction<CacheType>): Promise<void> {
|
||||||
const cardnumber = interaction.options.get("cardnumber", true);
|
const cardnumber = interaction.options.get("cardnumber", true);
|
||||||
const quantity = interaction.options.get("quantity")?.value as number ?? 1;
|
const quantityInput = interaction.options.get("quantity")?.value ?? 1;
|
||||||
|
|
||||||
|
const quantity = Number(quantityInput) || 1;
|
||||||
|
|
||||||
const cardInInventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, cardnumber.value! as string);
|
const cardInInventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, cardnumber.value! as string);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue