Skip to content

Commit

Permalink
left trim
Browse files Browse the repository at this point in the history
  • Loading branch information
TelevisionNinja committed Sep 12, 2021
1 parent 8baf513 commit 3761077
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion commands/covid.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {
usage: `<state>`,
cooldown: 1,
async execute(msg, args) {
msg.channel.send({ embeds: await getDataEmbeds(args.join(' ').trim()) });
msg.channel.send({ embeds: await getDataEmbeds(args.join(' ').trimStart()) });
}
}

Expand Down
2 changes: 1 addition & 1 deletion commands/tulpCommands/deleteTulp.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
guildOnly: false,
usage: '<name>',
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) {
Expand Down
2 changes: 1 addition & 1 deletion commands/tulpCommands/easyMessages/sendEasyMsg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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})`;
Expand Down
2 changes: 1 addition & 1 deletion commands/tulpCommands/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
guildOnly: false,
usage: '<name>',
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') {
Expand Down
4 changes: 2 additions & 2 deletions commands/tulpCommands/sendMsg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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})`;
Expand Down
2 changes: 1 addition & 1 deletion lib/msgUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down

0 comments on commit 3761077

Please sign in to comment.