Add ability to sacrifice multiple cards at once #354

Merged
Vylpes merged 4 commits from feature/337-sacrifice-multiple into develop 2024-09-15 16:57:25 +01:00
Showing only changes of commit 0e5489f0d1 - Show all commits

View file

@ -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]); const quantity = Number(interaction.customId.split(" ")[4]) ?? 1;
Vylpes marked this conversation as resolved Outdated

I don't actually think this works, try using || instead of ??

I don't actually think this works, try using `||` instead of `??`
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]); const quantity = Number(interaction.customId.split(" ")[4]) ?? 1;
Vylpes marked this conversation as resolved Outdated

Same here

Same here
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.");