2021-12-10 21:39:54 +05:00
|
|
|
const Command = require("../../base/Command.js");
|
|
|
|
|
|
|
|
class Ignore extends Command {
|
2021-12-26 19:29:37 +05:00
|
|
|
constructor(client) {
|
2021-12-10 21:39:54 +05:00
|
|
|
super(client, {
|
|
|
|
name: "ignore",
|
|
|
|
dirname: __dirname,
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: true,
|
2022-01-01 00:50:09 +05:00
|
|
|
aliases: ["ig"],
|
2021-12-26 19:29:37 +05:00
|
|
|
memberPermissions: ["MANAGE_GUILD"],
|
|
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
2021-12-10 21:39:54 +05:00
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: false,
|
2021-12-22 17:32:50 +05:00
|
|
|
cooldown: 1000
|
2021-12-10 21:39:54 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-12-26 19:29:37 +05:00
|
|
|
async run(message, args, data) {
|
2022-01-03 23:20:33 +05:00
|
|
|
const channel = message.mentions.channels.filter((ch) => ch.type === "GUILD_TEXT" && ch.guild.id === message.guild.id).first();
|
2021-12-10 21:39:54 +05:00
|
|
|
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();
|
2021-12-26 19:29:37 +05:00
|
|
|
return message.success("administration/ignore:ALLOWED", {
|
|
|
|
channel: channel.toString()
|
|
|
|
});
|
2021-12-10 21:39:54 +05:00
|
|
|
} else if (!ignored) {
|
|
|
|
data.guild.ignoredChannels.push(channel.id);
|
|
|
|
data.guild.save();
|
2021-12-26 19:29:37 +05:00
|
|
|
return message.success("administration/ignore:IGNORED", {
|
|
|
|
channel: channel.toString()
|
|
|
|
});
|
2021-12-10 21:39:54 +05:00
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Ignore;
|