Skip to content

Commit

Permalink
fix: typo that break the bot
Browse files Browse the repository at this point in the history
  • Loading branch information
Mara-Li committed Oct 24, 2024
1 parent 10ad478 commit f12a74c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/dice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,22 @@ export function parseResult(
const dicesResult = /(?<entry>\S+) ⟶ (?<calc>.*) =/;
const splitted = msgSuccess.split("\n");
const finalRes = [];
for (const i in splitted) {
const matches = dicesResult.exec(i);
let res = "";
for (let res of splitted) {
const matches = dicesResult.exec(res);
if (matches) {
const {entry, calc} = matches.groups || {};
if (entry) {
const entryStr = entry.replaceAll("\\*", "×");
res += msgSuccess.replace(entry, `\`${entryStr}\``);
res = res.replace(entry, `\`${entryStr}\``);
}
if (calc) {
const calcStr = calc.replaceAll("\\*", "×");
res += msgSuccess.replace(calc, `\`${calcStr}\``);
res = res.replace(calc, `\`${calcStr}\``);
}
} else res = i;
}
finalRes.push(res);
}
return `${comment}${finalRes.join("\n")}`;
return `${comment}${finalRes.join("\n ")}`;
}

/**
Expand Down

0 comments on commit f12a74c

Please sign in to comment.