codePreviews: fix line number regex

This commit is contained in:
Cynthia Foxwell 2022-05-07 17:06:31 -06:00
parent 4c681a137e
commit fa91219714

View file

@ -44,12 +44,12 @@ events.add("messageCreate", "codePreviews", async function (msg) {
? "" ? ""
: fileName.substring(fileName.indexOf(".") + 1); : fileName.substring(fileName.indexOf(".") + 1);
const lineStr = link.match(/#L\d+?(-L\d+?)?/)?.[0]; const lineStr = link.match(/#L\d+(-L\d+)?/)?.[0];
let startLine, endLine; let startLine, endLine;
let entireFile = false; let entireFile = false;
if (lineStr) { if (lineStr) {
let [start, end] = link.match(/L\d+?/g); let [start, end] = link.match(/L\d+/g);
start = parseInt(start.replace("L", "")); start = parseInt(start.replace("L", ""));
if (!end) { if (!end) {
startLine = endLine = start; startLine = endLine = start;