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;
|
||||
|
||||
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");
|
||||
|
||||
return `**${fileName}: **${whichLines}\n\`\`\`${fileType}\n${unindent(
|
||||
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) {
|
||||
|
|
Loading…
Reference in a new issue