structures.js

This commit is contained in:
Neko Life 2021-05-17 07:58:59 +00:00
parent c6cafb3656
commit 82dda92d68
2 changed files with 76 additions and 8 deletions

View file

@ -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]]>`");
}
}
}

70
resources/structures.js Normal file
View file

@ -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
};
}
});