diff --git a/commands/message/core/help.js b/commands/message/core/help.js index 241f63e..5214d46 100644 --- a/commands/message/core/help.js +++ b/commands/message/core/help.js @@ -1,4 +1,4 @@ -const { codeblock, icon, link, pill, smallPill, iconPill } = require('../../../labscore/utils/markdown') +const { codeblock, icon, link, pill, smallPill, iconPill, stringwrap } = require('../../../labscore/utils/markdown') const { createEmbed, formatPaginationEmbeds, page } = require('../../../labscore/utils/embed') const { DISCORD_INVITES, DEFAULT_PREFIXES } = require('../../../labscore/constants') @@ -26,7 +26,7 @@ function renderCommandList(commands, descriptions, limit) { let desc = descriptions[i] if (desc.includes('\n')) desc = desc.split('\n')[0] - if (desc.length >= 41) desc = desc.substr(0, 40) + '...' + if (desc.length >= 41) desc = stringwrap(desc, 40) render.push(` ​ ​ \` ${c}${' '.repeat(pad)}\` ​ ​ ​ ​ ​${desc}`) i++ diff --git a/commands/message/info/appinfo.js b/commands/message/info/appinfo.js index d9a14ac..5782cfe 100644 --- a/commands/message/info/appinfo.js +++ b/commands/message/info/appinfo.js @@ -1,6 +1,6 @@ const { createEmbed } = require("../../../labscore/utils/embed"); const { editOrReply } = require("../../../labscore/utils/message"); -const { icon, highlight, link } = require('../../../labscore/utils/markdown'); +const { icon, highlight, link, stringwrap } = require('../../../labscore/utils/markdown'); const superagent = require('superagent'); @@ -137,10 +137,7 @@ module.exports = { } if(assets.length){ - let asset = assets.map(a => { - if(a.name.length >= 25) return link(`https://cdn.discordapp.com/app-assets/${application.id}/${a.id}.png?size=4096`, a.name.substr(0,23) + '...') - return link(`https://cdn.discordapp.com/app-assets/${application.id}/${a.id}.png?size=4096`, a.name.substr(0,23)) - }) + let asset = assets.map(a => link(`https://cdn.discordapp.com/app-assets/${application.id}/${a.id}.png?size=4096`, stringwrap(a.name, 23))) if(asset.length >= 6) asset[5] = link(`https://canary.discord.com/api/oauth2/applications/${application.id}/assets`, `View ${asset.length - 6} remaining assets`) embed.fields.push({ name: `${icon("image")} Assets`,