mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-25 22:55:00 +05:00
55 lines
No EOL
1.5 KiB
JavaScript
55 lines
No EOL
1.5 KiB
JavaScript
const Command = require("../../base/Command");
|
|
|
|
class Automod extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: "automod",
|
|
dirname: __dirname,
|
|
enabled: true,
|
|
guildOnly: true,
|
|
aliases: ["autom"],
|
|
memberPermissions: ["MANAGE_GUILD"],
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
nsfw: false,
|
|
ownerOnly: false,
|
|
cooldown: 1000
|
|
});
|
|
}
|
|
|
|
async run(message, args, data) {
|
|
const status = args[0];
|
|
if (!status || (status !== "on" && status !== "off")) return message.error("administration/automod:MISSING_STATUS");
|
|
|
|
if (status === "on") {
|
|
data.guild.plugins.automod = {
|
|
enabled: true,
|
|
ignored: []
|
|
};
|
|
data.guild.markModified("plugins.automod");
|
|
data.guild.save();
|
|
message.success("administration/automod:ENABLED", {
|
|
prefix: data.guild.prefix
|
|
});
|
|
} else if (status === "off") {
|
|
if (message.mentions.channels.filter((ch) => ch.type === "GUILD_TEXT" && ch.guild.id === message.guild.id).first()) {
|
|
const channel = message.mentions.channels.first();
|
|
data.guild.plugins.automod.ignored.push(channel);
|
|
data.guild.markModified("plugins.automod");
|
|
data.guild.save();
|
|
message.success("administration/automod:DISABLED_CHANNEL", {
|
|
channel: channel.toString()
|
|
});
|
|
} else {
|
|
data.guild.plugins.automod = {
|
|
enabled: false,
|
|
ignored: []
|
|
};
|
|
data.guild.markModified("plugins.automod");
|
|
data.guild.save();
|
|
message.success("administration/automod:DISABLED");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = Automod; |