Little looks changes

This commit is contained in:
Neko Life 2021-05-10 18:26:04 +00:00
parent 7e85e06dd8
commit ca9cf0c90d
3 changed files with 24 additions and 18 deletions

View file

@ -41,11 +41,13 @@ module.exports = class mute extends commando.Command {
minute: invokedAt.getMinutes(), minute: invokedAt.getMinutes(),
second: invokedAt.getSeconds() 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) { 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); const durationArg = argument.match(durationRegExp);
console.log(durationArg); console.log(durationArg);
timeForMessage = [];
for (const value of durationArg) { for (const value of durationArg) {
console.log(value); console.log(value);
const val = parseInt(value.match(/\d+/)[0], 10); const val = parseInt(value.match(/\d+/)[0], 10);
@ -79,6 +81,7 @@ module.exports = class mute extends commando.Command {
timeForMessage.push(val + " Seconds"); timeForMessage.push(val + " Seconds");
} }
} }
durationHasSet = true;
} else { } else {
if (argument.length > 0 && argument !== "--") { if (argument.length > 0 && argument !== "--") {
reason = msg.author.tag+": "+argument.trim(); 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)); let 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()}\`\`\``); 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()}\`\`\``);
} }
}; };

View file

@ -20,7 +20,7 @@ module.exports = class lookup extends commando.Command {
*/ */
async run(msg, arg) { async run(msg, arg) {
let show; let show;
const showArg = arg.match(/\-\-show *\d*/i); const showArg = arg.match(/(?<!\\)\-\-show *\d*/i);
if (showArg?.[0]) { if (showArg?.[0]) {
const digit = showArg[0].match(/\d*/g); const digit = showArg[0].match(/\d*/g);
for (const val of digit) { for (const val of digit) {
@ -30,7 +30,7 @@ module.exports = class lookup extends commando.Command {
} }
} }
} }
arg = arg.replace(/\-\-show *\d*/i, ""); arg = arg.replace(/(?<!\\)\-\-show *\d*/i, "").trim();
const args = arg.split(/ +/); const args = arg.split(/ +/);
let [fetchedMember, fetchedRoles, fetchedChannels, memMes] = [[], [], [], ""]; let [fetchedMember, fetchedRoles, fetchedChannels, memMes] = [[], [], [], ""];
const lowCaseArg0 = args[0].toLowerCase(); const lowCaseArg0 = args[0].toLowerCase();
@ -49,7 +49,7 @@ module.exports = class lookup extends commando.Command {
if (fetchedRoles.length === 0 || fetchedRoles[0] === null) { if (fetchedRoles.length === 0 || fetchedRoles[0] === null) {
return trySend(this.client, msg, `No role found for: **${cleanRoleID}**`); return trySend(this.client, msg, `No role found for: **${cleanRoleID}**`);
} }
memMes = `Role found for: **${cleanRoleID}**\`\`\`md\n# ${fetchedRoles[0].name} (${fetchedRoles[0].id})\`\`\``; memMes = `Role found for: **${cleanRoleID}**\`\`\`js\n' ${fetchedRoles[0].name} (${fetchedRoles[0].id})\`\`\``;
} }
} }
} else { } else {
@ -68,7 +68,7 @@ module.exports = class lookup extends commando.Command {
if (fetchedChannels.length === 0 || fetchedChannels[0] === null) { if (fetchedChannels.length === 0 || fetchedChannels[0] === null) {
return trySend(this.client, msg, `No channel found for: **${cleanChannelID}**`); return trySend(this.client, msg, `No channel found for: **${cleanChannelID}**`);
} }
memMes = `Channel found for: **${cleanChannelID}**\`\`\`md\n# ${fetchedChannels[0].name} (${fetchedChannels[0].id})\`\`\``; memMes = `Channel found for: **${cleanChannelID}**\`\`\`js\n' ${fetchedChannels[0].name} (${fetchedChannels[0].id})\`\`\``;
} }
} }
} else { } else {
@ -84,7 +84,7 @@ module.exports = class lookup extends commando.Command {
if (fetchedMember.length === 0 || fetchedMember[0] === null) { if (fetchedMember.length === 0 || fetchedMember[0] === null) {
return trySend(this.client, msg, `No member found for: **${arg}**`); return trySend(this.client, msg, `No member found for: **${arg}**`);
} }
memMes = `Member found for: **${arg}**\`\`\`md\n# ${fetchedMember[0].user.tag} (${fetchedMember[0].user.id})\`\`\``; memMes = `Member found for: **${arg}**\`\`\`js\n' ${fetchedMember[0].user.tag} (${fetchedMember[0].user.id})\`\`\``;
} }
} }
} }

View file

@ -191,11 +191,11 @@ function multipleMembersFound(client, msg, arr, key, max = 5, withID) {
multi.push(mu); multi.push(mu);
} }
} }
let mes = multi.join(", "); let mes = multi.join(",\n' ");
if (multipleFound.length > max) { if (multipleFound.length > 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) { } catch (e) {
errLog(e, msg, client); errLog(e, msg, client);
} }
@ -413,11 +413,11 @@ function multipleChannelsFound(client, msg, arr, key, max = 5, withID) {
multi.push(mu); multi.push(mu);
} }
} }
let mes = multi.join(", "); let mes = multi.join(",\n' ");
if (multipleFound.length > max) { 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) { } catch (e) {
errLog(e, msg, client); errLog(e, msg, client);
} }
@ -453,11 +453,11 @@ function multipleChannelsFound(client, msg, arr, key, max = 5, withID) {
multi.push(mu); multi.push(mu);
} }
} }
let mes = multi.join(", "); let mes = multi.join(",\n' ");
if (multipleFound.length > max) { 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) { } catch (e) {
errLog(e, msg, client); errLog(e, msg, client);
} }