Skip to content

Commit

Permalink
yeet newlines from library
Browse files Browse the repository at this point in the history
  • Loading branch information
dispherical committed Sep 22, 2024
1 parent f917ed4 commit 0bfea0d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sections/40-threads.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ module.exports = {
*/
render: async function ({ app, client, prisma }) {
function reduceText(text, link) {
if (text.length <= 160) return text;
if (text.split("\n").length > 1)
return text.split("\n")[0].slice(0, 160) + `<${link}|[...]>`;
const nli = text.indexOf("\n");
if (nli !== -1) return text.slice(0, nli) + `<${link}|[...]>`;
if (text.length <= 160) return text
return text.slice(0, 160) + `<${link}|[...]>`;
}
var text = "";
Expand Down

0 comments on commit 0bfea0d

Please sign in to comment.