From ca9cf0c90d87f4b08cd1a98c00c95b9d0d22acac Mon Sep 17 00:00:00 2001 From: Neko Life Date: Mon, 10 May 2021 18:26:04 +0000 Subject: [PATCH] Little looks changes --- cmds/moderation/mute.js | 14 ++++++++++---- cmds/utility/lookup.js | 10 +++++----- resources/functions.js | 18 +++++++++--------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/cmds/moderation/mute.js b/cmds/moderation/mute.js index 3a294dd..6cfe45f 100644 --- a/cmds/moderation/mute.js +++ b/cmds/moderation/mute.js @@ -41,11 +41,13 @@ module.exports = class mute extends commando.Command { minute: invokedAt.getMinutes(), second: invokedAt.getSeconds() } - let [timeForMessage, targetUser] = [[], []], reason = "No reason provided by " + msg.author.tag; + let durationHasSet = false; + let [timeForMessage, targetUser] = [["Indefinite"], []], reason = "No reason provided by " + msg.author.tag; for (const argument of args) { - if (/^\d+(?![^ymwdhs])[ymwdhs]?o?/i.test(argument.trim())) { + if (/^\d+(?![^ymwdhs])[ymwdhs]?o?/i.test(argument.trim()) && !durationHasSet) { const durationArg = argument.match(durationRegExp); console.log(durationArg); + timeForMessage = []; for (const value of durationArg) { console.log(value); const val = parseInt(value.match(/\d+/)[0], 10); @@ -79,6 +81,7 @@ module.exports = class mute extends commando.Command { timeForMessage.push(val + " Seconds"); } } + durationHasSet = true; } else { if (argument.length > 0 && argument !== "--") { reason = msg.author.tag+": "+argument.trim(); @@ -116,8 +119,11 @@ module.exports = class mute extends commando.Command { } } } - const testdate = new Date(String(duration.year), String(duration.month), String(duration.date), String(duration.hour), String(duration.minute), String(duration.second)); - return trySend(this.client, msg, `Result:\`\`\`js\nUsers: ${targetUser}\nReason: ${reason}\nMuted for: ${timeForMessage.join(" + ")}\nFrom: ${invokedAt.toUTCString()}\nEnds: ${testdate.toUTCString()}\`\`\``); + let testdate = new Date(String(duration.year), String(duration.month), String(duration.date), String(duration.hour), String(duration.minute), String(duration.second)); + if (testdate.toUTCString() === invokedAt.toUTCString()) { + testdate = undefined; + } + return trySend(this.client, msg, `Result:\`\`\`js\nUsers: ${targetUser}\nReason: ${reason}\nFor: ${timeForMessage.join(" + ")}\nBegins: ${invokedAt.toUTCString()}\nEnds: ${testdate?.toUTCString()}\`\`\``); } }; diff --git a/cmds/utility/lookup.js b/cmds/utility/lookup.js index af1c547..e5324f0 100644 --- a/cmds/utility/lookup.js +++ b/cmds/utility/lookup.js @@ -20,7 +20,7 @@ module.exports = class lookup extends commando.Command { */ async run(msg, arg) { let show; - const showArg = arg.match(/\-\-show *\d*/i); + const showArg = arg.match(/(? max) { - mes = mes+` and ${multipleFound.length - max} more...`; + mes = mes+`,\n' ${multipleFound.length - max} more...`; } - return `Multiple members found for: **${key}**\`\`\`md\n# ${mes}\`\`\``; + return `Multiple members found for: **${key}**\`\`\`js\n' ${mes}\`\`\``; } catch (e) { errLog(e, msg, client); } @@ -413,11 +413,11 @@ function multipleChannelsFound(client, msg, arr, key, max = 5, withID) { multi.push(mu); } } - let mes = multi.join(", "); + let mes = multi.join(",\n' "); if (multipleFound.length > max) { - mes = mes+` and ${multipleFound.length - max} more...`; + mes = mes+`,\n' ${multipleFound.length - max} more...`; } - return `Multiple channels found for: **${key}**\`\`\`md\n# ${mes}\`\`\``; + return `Multiple channels found for: **${key}**\`\`\`js\n' ${mes}\`\`\``; } catch (e) { errLog(e, msg, client); } @@ -453,11 +453,11 @@ function multipleChannelsFound(client, msg, arr, key, max = 5, withID) { multi.push(mu); } } - let mes = multi.join(", "); + let mes = multi.join(",\n' "); if (multipleFound.length > max) { - mes = mes+` and ${multipleFound.length - max} more...`; + mes = mes+`,\n' ${multipleFound.length - max} more...`; } - return `Multiple roles found for: **${key}**\`\`\`md\n# ${mes}\`\`\``; + return `Multiple roles found for: **${key}**\`\`\`js\n' ${mes}\`\`\``; } catch (e) { errLog(e, msg, client); }