update stringwrap logic

This commit is contained in:
bignutty 2025-01-11 02:52:22 +01:00
parent 50180cbdb3
commit 21bf3a2455

View file

@ -46,8 +46,8 @@ module.exports.timestamp = function(time, flag = "t"){
module.exports.stringwrap = function(content = "", length, newlines = true){
if(!newlines) content = content.replace(/\n/, ' ')
if(content.length > length){
c = content.substr(0, length) + '...';
while(c.endsWith(' ...')) c = c.substr(0, c.length - 4) + '...';
c = content.substr(0, length-1) + '…';
while(c.endsWith(' ')) c = c.substr(0, c.length - 2) + '…';
return c;
}
return content;