mirror of
https://github.com/danbulant/Shasha
synced 2026-07-07 12:01:22 +00:00
structures.js
This commit is contained in:
parent
c6cafb3656
commit
82dda92d68
2 changed files with 76 additions and 8 deletions
|
|
@ -115,10 +115,10 @@ module.exports = class mute extends commando.Command {
|
||||||
const found = findChannelRegEx(msg, key);
|
const found = findChannelRegEx(msg, key);
|
||||||
logChannel = found[0];
|
logChannel = found[0];
|
||||||
}
|
}
|
||||||
if (/^none$/.test(key)) {
|
if (/^none$/i.test(key)) {
|
||||||
logChannel = undefined;
|
logChannel = undefined;
|
||||||
}
|
}
|
||||||
if (logChannel || /^none$/.test(key)) {
|
if (logChannel || /^none$/i.test(key)) {
|
||||||
theSettingUp.logChannel = logChannel?.id;
|
theSettingUp.logChannel = logChannel?.id;
|
||||||
} else {
|
} else {
|
||||||
resultMsg += `No channel found for: **${argument}**\n`;
|
resultMsg += `No channel found for: **${argument}**\n`;
|
||||||
|
|
@ -134,10 +134,10 @@ module.exports = class mute extends commando.Command {
|
||||||
const found = findRoleRegEx(msg, key);
|
const found = findRoleRegEx(msg, key);
|
||||||
role = found[0]?.id;
|
role = found[0]?.id;
|
||||||
}
|
}
|
||||||
if (/^none$/.test(key)) {
|
if (/^none$/i.test(key)) {
|
||||||
role = undefined;
|
role = undefined;
|
||||||
}
|
}
|
||||||
if (role || /^none$/.test(key)) {
|
if (role || /^none$/i.test(key)) {
|
||||||
theSettingUp.role = role;
|
theSettingUp.role = role;
|
||||||
} else {
|
} else {
|
||||||
resultMsg += `No role found for: **${argument}**\n`;
|
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`;
|
resultMsg += `Can't find user: **${usermention.trim()}**\n`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!settingUp) {
|
if (!settingUp && mentions.length === 1 && mentions[0].length === 0) {
|
||||||
return trySend(this.client, msg, "Who are you wanna mute? Provide as first argument `<[RegExp | user_[mention | ID]]>`");
|
return trySend(this.client, msg, "Who do you wanna mute? Provide as first argument `<[RegExp | user_[mention | ID]]>`");
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
70
resources/structures.js
Normal file
70
resources/structures.js
Normal 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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue