codePreviews: fix files less than 30 lines
This commit is contained in:
parent
05c1ef07cb
commit
7abd01a125
1 changed files with 10 additions and 2 deletions
|
@ -60,12 +60,20 @@ async function processFile(link) {
|
||||||
: "Lines " + startLine + "-" + endLine;
|
: "Lines " + startLine + "-" + endLine;
|
||||||
|
|
||||||
const targetLines = (
|
const targetLines = (
|
||||||
entireFile ? lines.slice(0, 30) : lines.slice(startLine - 1, endLine)
|
entireFile
|
||||||
|
? lines.length > 30
|
||||||
|
? lines.slice(0, 30)
|
||||||
|
: lines
|
||||||
|
: lines.slice(startLine - 1, endLine)
|
||||||
).join("\n");
|
).join("\n");
|
||||||
|
|
||||||
return `**${fileName}: **${whichLines}\n\`\`\`${fileType}\n${unindent(
|
return `**${fileName}: **${whichLines}\n\`\`\`${fileType}\n${unindent(
|
||||||
targetLines
|
targetLines
|
||||||
)}${entireFile ? `\n... (${lines.length - 30} lines left)` : ""}\n\`\`\``;
|
)}${
|
||||||
|
entireFile && lines.length > 30
|
||||||
|
? `\n... (${lines.length - 30} lines left)`
|
||||||
|
: ""
|
||||||
|
}\n\`\`\``;
|
||||||
}
|
}
|
||||||
|
|
||||||
events.add("messageCreate", "codePreviews", async function (msg) {
|
events.add("messageCreate", "codePreviews", async function (msg) {
|
||||||
|
|
Loading…
Reference in a new issue