mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 13:14:58 +05:00
41 lines
No EOL
1.1 KiB
JavaScript
41 lines
No EOL
1.1 KiB
JavaScript
const Command = require("../../base/Command.js");
|
|
|
|
class Ignore extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: "ignore",
|
|
dirname: __dirname,
|
|
enabled: true,
|
|
guildOnly: true,
|
|
aliases: ["ig"],
|
|
memberPermissions: ["MANAGE_GUILD"],
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
nsfw: false,
|
|
ownerOnly: false,
|
|
cooldown: 1000
|
|
});
|
|
}
|
|
|
|
async run(message, args, data) {
|
|
const channel = message.mentions.channels.filter((ch) => ch.type === "GUILD_TEXT" && ch.guild.id === message.guild.id).first();
|
|
if (!channel) return message.error("misc:INVALID_CHANNEL");
|
|
|
|
const ignored = data.guild.ignoredChannels.includes(channel.id);
|
|
|
|
if (ignored) {
|
|
data.guild.ignoredChannels = data.guild.ignoredChannels.filter((ch) => ch !== channel.id);
|
|
data.guild.save();
|
|
return message.success("administration/ignore:ALLOWED", {
|
|
channel: channel.toString()
|
|
});
|
|
} else if (!ignored) {
|
|
data.guild.ignoredChannels.push(channel.id);
|
|
data.guild.save();
|
|
return message.success("administration/ignore:IGNORED", {
|
|
channel: channel.toString()
|
|
});
|
|
};
|
|
}
|
|
};
|
|
|
|
module.exports = Ignore; |