Skip to content

Commit

Permalink
fix: can't delete capa when " - " in name;
Browse files Browse the repository at this point in the history
Now it delete only the first
  • Loading branch information
Mara-Li committed Dec 1, 2024
1 parent 75bc8e0 commit 5b76094
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/interactions/edit/dice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export async function validateDiceEdit(
const values = interaction.fields.getTextInputValue("allDice");
const valuesAsDice = values.split("\n- ").map((dice) => {
const [name, value] = dice.split(/ ?: ?/);
return { name: name.replace("- ", "").trim().toLowerCase(), value };
return { name: name.replace(/^- /, "").trim().toLowerCase(), value };
});
const dices = valuesAsDice.reduce(
(acc, { name, value }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/edit/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function editStats(
if (!templateStats || !templateStats.statistics) return;
const valuesAsStats = values.split("\n- ").map((stat) => {
const [name, value] = stat.split(/ ?: ?/);
return { name: name.replace("- ", "").trim().toLowerCase(), value };
return { name: name.replace(/^- /, "").trim().toLowerCase(), value };
});
//fusion all stats into an object instead of list
const stats = valuesAsStats.reduce(
Expand Down

0 comments on commit 5b76094

Please sign in to comment.