Skip to content

Commit

Permalink
fix: crash
Browse files Browse the repository at this point in the history
  • Loading branch information
ledouxm committed Mar 4, 2024
1 parent c6ca219 commit ae8401b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/commands/buttons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { ButtonInteraction, ButtonStyle } from "discord.js";
import { eq } from "drizzle-orm";

export const executeButtonInteraction = async (interaction: ButtonInteraction) => {
const [command, matchId, participantIndex] = interaction.customId.split("-");
const [command, matchId, participantIndexRaw] = interaction.customId.split("-");
const participantIndex = participantIndexRaw === "undefined" ? undefined : participantIndexRaw;

if (command === "details") {
if (!matchId) {
Expand Down Expand Up @@ -57,6 +58,7 @@ export const executeButtonInteraction = async (interaction: ButtonInteraction) =
const { details, participantIndex: pIndex } = game[0];
const index = participantIndex ?? pIndex;

console.log({ index, participantIndex, pIndex, id: interaction.customId });
const participant = details.info.participants[Number(index)];

const file = await createMatchDamageFile(details, participant);
Expand Down

0 comments on commit ae8401b

Please sign in to comment.