guh
This commit is contained in:
parent
e50061a99c
commit
9105c3563e
1 changed files with 10 additions and 2 deletions
|
@ -26,8 +26,16 @@ function notEmpty(str) {
|
|||
return str && str.trim() !== ''
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @param {number} len
|
||||
*/
|
||||
function shorten(str) {
|
||||
return str.length <= 20 ? str : `[${str.slice(0, 17)}...](${str})`;
|
||||
const len = 50;
|
||||
|
||||
var urlStart = str.indexOf("://") + 3;
|
||||
if (urlStart == 2) urlStart = 0;
|
||||
return str.length <= len ? str : `[${str.slice(urlStart, urlStart + (len - 3))}...](${str.startsWith("magnet:") ? (`${process.env.BASE_URL}/magnet/${str}`) : str})`;
|
||||
}
|
||||
|
||||
const emojis = JSON.parse(readFileSync("config/emojis.json"));
|
||||
|
|
Loading…
Reference in a new issue