diff --git a/cmds/moderation/mute.js b/cmds/moderation/mute.js index a8bd17b..0734a3c 100644 --- a/cmds/moderation/mute.js +++ b/cmds/moderation/mute.js @@ -115,10 +115,10 @@ module.exports = class mute extends commando.Command { const found = findChannelRegEx(msg, key); logChannel = found[0]; } - if (/^none$/.test(key)) { + if (/^none$/i.test(key)) { logChannel = undefined; } - if (logChannel || /^none$/.test(key)) { + if (logChannel || /^none$/i.test(key)) { theSettingUp.logChannel = logChannel?.id; } else { resultMsg += `No channel found for: **${argument}**\n`; @@ -134,10 +134,10 @@ module.exports = class mute extends commando.Command { const found = findRoleRegEx(msg, key); role = found[0]?.id; } - if (/^none$/.test(key)) { + if (/^none$/i.test(key)) { role = undefined; } - if (role || /^none$/.test(key)) { + if (role || /^none$/i.test(key)) { theSettingUp.role = role; } else { resultMsg += `No role found for: **${argument}**\n`; @@ -251,10 +251,8 @@ module.exports = class mute extends commando.Command { resultMsg += `Can't find user: **${usermention.trim()}**\n`; } } else { - if (!settingUp) { - return trySend(this.client, msg, "Who are you wanna mute? Provide as first argument `<[RegExp | user_[mention | ID]]>`"); - } else { - + if (!settingUp && mentions.length === 1 && mentions[0].length === 0) { + return trySend(this.client, msg, "Who do you wanna mute? Provide as first argument `<[RegExp | user_[mention | ID]]>`"); } } } diff --git a/resources/structures.js b/resources/structures.js new file mode 100644 index 0000000..b9f1b9b --- /dev/null +++ b/resources/structures.js @@ -0,0 +1,70 @@ +'use strict'; + +const { Structures } = require("discord.js"); + +class Settings { + constructor(client, type, id) { + this.client = client; + this.type = type; + this.id = id; + } + + get(setting) { + collection(this.type).findOne({ id: this.id })[setting]; + } +} + +Structures.extend("Guild", Guild => { + return class GuildSettings extends Guild { + constructor(client, data) { + super(client, data); + this.settings = new Settings(client, "Guild", this.id); + } + embed = { + footer: { + text: undefined, + icon: undefined + }, + timestamp: false + }; + moderation = { + mute: { + role: undefined, + duration: { + date: undefined, + string: undefined + }, + log: undefined, + publicLog: undefined + }, + ban: { + duration: { + date: undefined, + string: undefined + }, + log: undefined, + publicLog: undefined + }, + kick: { + log: undefined, + publicLog: undefined + } + } + } +}); + +Structures.extend("User", User => { + return class Settings extends User { + constructor(client, data) { + super(client, data); + this.settings = new Settings(client, User, this.id); + } + embed = { + footer: { + text: undefined, + icon: undefined + }, + timestamp: false + }; + } +}); \ No newline at end of file