From 3761077fd3638797c02614a194cc9ec13ab382d7 Mon Sep 17 00:00:00 2001 From: TelevisionNinja Date: Sun, 12 Sep 2021 01:57:33 -0500 Subject: [PATCH] left trim --- commands/covid.js | 2 +- commands/tulpCommands/deleteTulp.js | 2 +- commands/tulpCommands/easyMessages/sendEasyMsg.js | 2 +- commands/tulpCommands/info.js | 2 +- commands/tulpCommands/sendMsg.js | 4 ++-- lib/msgUtils.js | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/commands/covid.js b/commands/covid.js index 1a7e70f..cc52f14 100644 --- a/commands/covid.js +++ b/commands/covid.js @@ -31,7 +31,7 @@ export default { usage: ``, cooldown: 1, async execute(msg, args) { - msg.channel.send({ embeds: await getDataEmbeds(args.join(' ').trim()) }); + msg.channel.send({ embeds: await getDataEmbeds(args.join(' ').trimStart()) }); } } diff --git a/commands/tulpCommands/deleteTulp.js b/commands/tulpCommands/deleteTulp.js index e369c1b..04e9fd8 100644 --- a/commands/tulpCommands/deleteTulp.js +++ b/commands/tulpCommands/deleteTulp.js @@ -13,7 +13,7 @@ export default { guildOnly: false, usage: '', async execute(msg, args) { - const username = args.join(' ').trim(); + const username = args.join(' ').trimStart(); const result = await tulps.delete(msg.author.id, username); if (result.rowCount) { diff --git a/commands/tulpCommands/easyMessages/sendEasyMsg.js b/commands/tulpCommands/easyMessages/sendEasyMsg.js index a3a983d..7a2f8dc 100644 --- a/commands/tulpCommands/easyMessages/sendEasyMsg.js +++ b/commands/tulpCommands/easyMessages/sendEasyMsg.js @@ -72,7 +72,7 @@ export default { mention = `[@${reference.author.username}](${reference.url})`; // remove reference inside of reference - referenceMsg = referenceMsg.replace(/^(> )(.|\n){1,}(\[.{1,}\]\(https:\/\/discord\.com\/channels\/.{0,}\)\n)/i, '').trim(); + referenceMsg = referenceMsg.replace(/^(> )(.|\n){1,}(\[.{1,}\]\(https:\/\/discord\.com\/channels\/.{0,}\)\n)/i, '').trimStart(); } else { mention = `<@${reference.author.id}> - [jump](${reference.url})`; diff --git a/commands/tulpCommands/info.js b/commands/tulpCommands/info.js index 7a0b76f..06ab358 100644 --- a/commands/tulpCommands/info.js +++ b/commands/tulpCommands/info.js @@ -13,7 +13,7 @@ export default { guildOnly: false, usage: '', async execute(msg, args) { - const username = args.join(' ').trim(); + const username = args.join(' ').trimStart(); const selectedTulp = await tulps.get(msg.author.id, username); if (typeof selectedTulp === 'undefined') { diff --git a/commands/tulpCommands/sendMsg.js b/commands/tulpCommands/sendMsg.js index 43d3e5b..c684c74 100644 --- a/commands/tulpCommands/sendMsg.js +++ b/commands/tulpCommands/sendMsg.js @@ -34,7 +34,7 @@ export default { return; } - let tulpMsg = str.substring(index + 1).trim(); + let tulpMsg = str.substring(index + 1).trimStart(); let attachmentArr = undefined; if (msg.attachments.size) { @@ -66,7 +66,7 @@ export default { mention = `[@${reference.author.username}](${reference.url})`; // remove reference inside of reference - referenceMsg = referenceMsg.replace(/^(> )(.|\n){1,}(\[.{1,}\]\(https:\/\/discord\.com\/channels\/.{0,}\)\n)/i, '').trim(); + referenceMsg = referenceMsg.replace(/^(> )(.|\n){1,}(\[.{1,}\]\(https:\/\/discord\.com\/channels\/.{0,}\)\n)/i, '').trimStart(); } else { mention = `<@${reference.author.id}> - [jump](${reference.url})`; diff --git a/lib/msgUtils.js b/lib/msgUtils.js index 440ef6a..31ab981 100644 --- a/lib/msgUtils.js +++ b/lib/msgUtils.js @@ -321,7 +321,7 @@ export function extractNameAndAvatar(msg, args) { const attachment = msg.attachments.map(img => img.url)[0]; const extractedUsername = argArr.shift().trim(); - const link = argArr.join(tagSeparator).trim(); + const link = argArr.join(tagSeparator).trimStart(); // the end is assumed to be trimmed const hasImgAttachment = typeof attachment !== 'undefined';