JaBa/commands/Administration/configuration.js

99 lines
4.9 KiB
JavaScript
Raw Normal View History

2021-12-10 21:39:54 +05:00
const Command = require("../../base/Command.js"),
Discord = require("discord.js");
class Configuration extends Command {
2021-12-26 19:29:37 +05:00
constructor(client) {
2021-12-10 21:39:54 +05:00
super(client, {
name: "configuration",
dirname: __dirname,
enabled: true,
guildOnly: true,
2021-12-26 19:29:37 +05:00
aliases: ["conf", "config"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
2021-12-10 21:39:54 +05:00
nsfw: false,
ownerOnly: false,
cooldown: 2000
2021-12-10 21:39:54 +05:00
});
}
2021-12-26 19:29:37 +05:00
async run(message, args, data) {
2021-12-10 21:39:54 +05:00
const guildData = data.guild;
const embed = new Discord.MessageEmbed()
2022-01-04 00:35:11 +05:00
.setAuthor({
name: message.guild.name,
iconURL: message.guild.iconURL()
})
2022-01-03 23:20:33 +05:00
.setColor(data.config.embed.color)
2022-01-04 00:35:11 +05:00
.setFooter({
text: data.config.embed.footer
});
2021-12-10 21:39:54 +05:00
// Guild prefix
embed.addField(message.translate("administration/configuration:PREFIX_TITLE"), guildData.prefix);
// Ignored channels
2021-12-26 13:53:50 +05:00
embed.addField(message.translate("administration/configuration:IGNORED_CHANNELS_TITLE"), guildData.ignoredChannels.length > 0 ? guildData.ignoredChannels.map((ch) => `<#${ch}>`).join(", ") : message.translate("administration/configuration:NO_IGNORED_CHANNELS"));
2021-12-10 21:39:54 +05:00
// Autorole plugin
2021-12-26 19:29:37 +05:00
embed.addField(message.translate("administration/configuration:AUTOROLE_TITLE"), guildData.plugins.autorole.enabled ? message.translate("administration/configuration:AUTOROLE_CONTENT", {
roleName: `<@&${guildData.plugins.autorole.role}>`
}) : message.translate("administration/configuration:AUTOROLE_DISABLED"));
2021-12-10 21:39:54 +05:00
// Welcome plugin
2021-12-26 19:29:37 +05:00
embed.addField(message.translate("administration/configuration:WELCOME_TITLE"), guildData.plugins.welcome.enabled ? message.translate("administration/configuration:WELCOME_CONTENT", {
channel: `<#${guildData.plugins.welcome.channel}>`,
withImage: guildData.plugins.welcome.withImage ? message.translate("common:YES") : message.translate("common:NO")
}) : message.translate("administration/configuration:WELCOME_DISABLED"));
2021-12-10 21:39:54 +05:00
// Goodbye plugin
2021-12-26 19:29:37 +05:00
embed.addField(message.translate("administration/configuration:GOODBYE_TITLE"), guildData.plugins.goodbye.enabled ? message.translate("administration/configuration:GOODBYE_CONTENT", {
channel: `<#${guildData.plugins.goodbye.channel}>`,
withImage: guildData.plugins.goodbye.withImage ? message.translate("common:YES") : message.translate("common:NO")
}) : message.translate("administration/configuration:GOODBYE_DISABLED"));
2021-12-10 21:39:54 +05:00
// Special channels
embed.addField(message.translate("administration/configuration:SPECIAL_CHANNELS"),
2021-12-30 20:15:25 +05:00
message.translate("administration/configuration:SUGGESTIONS", {
channel: guildData.plugins.suggestions ? `<#${guildData.plugins.suggestions}>` : message.translate("common:NOT_DEFINED")
}) + "\n" +
message.translate("administration/configuration:REPORTS", {
channel: guildData.plugins.reports ? `<#${guildData.plugins.reports}>` : message.translate("common:NOT_DEFINED")
}) + "\n" +
2021-12-10 21:39:54 +05:00
message.translate("administration/configuration:MODLOGS", {
channel: guildData.plugins.modlogs ? `<#${guildData.plugins.modlogs}>` : message.translate("common:NOT_DEFINED")
}) + "\n" +
2021-12-30 01:02:12 +05:00
message.translate("administration/configuration:BIRTHDAYS", {
channel: guildData.plugins.birthdays ? `<#${guildData.plugins.birthdays}>` : message.translate("common:NOT_DEFINED")
}) + "\n" +
2021-12-10 21:39:54 +05:00
message.translate("administration/configuration:FORTNITESHOP", {
channel: guildData.plugins.fortniteshop ? `<#${guildData.plugins.fortniteshop}>` : message.translate("common:NOT_DEFINED")
})
);
// Auto sanctions
2021-12-26 19:29:37 +05:00
embed.addField(message.translate("administration/configuration:AUTO_SANCTIONS"), (guildData.plugins.warnsSanctions.kick ? message.translate("administration/configuration:KICK_CONTENT", {
count: guildData.plugins.warnsSanctions.kick
}) : message.translate("administration/configuration:KICK_NOT_DEFINED")) + "\n" + (guildData.plugins.warnsSanctions.ban ? message.translate("administration/configuration:BAN_CONTENT", {
count: guildData.plugins.warnsSanctions.ban
}) : message.translate("administration/configuration:BAN_NOT_DEFINED")));
2021-12-10 21:39:54 +05:00
// Automod plugin
2021-12-26 19:29:37 +05:00
embed.addField(message.translate("administration/configuration:AUTOMOD_TITLE"), guildData.plugins.automod.enabled ? message.translate("administration/configuration:AUTOMOD_CONTENT", {
channels: guildData.plugins.automod.ignored.map((ch) => `<#${ch}>`)
}) : message.translate("administration/configuration:AUTOMOD_DISABLED"));
2021-12-10 21:39:54 +05:00
// Auto-delete mod commands
2021-12-26 13:53:50 +05:00
embed.addField(message.translate("administration/configuration:AUTODELETEMOD"), guildData.autoDeleteModCommands ? message.translate("administration/configuration:AUTODELETEMOD_ENABLED") : message.translate("administration/configuration:AUTODELETEMOD_DISABLED"));
2021-12-10 21:39:54 +05:00
// Dashboard link
embed.addField(message.translate("administration/configuration:DASHBOARD_TITLE"), `[${message.translate("administration/configuration:DASHBOARD_CONTENT")}](${this.client.config.dashboard.baseURL})`);
2022-01-04 00:35:11 +05:00
message.channel.send({
embeds: [embed]
});
2021-12-10 21:39:54 +05:00
}
};
2021-12-26 13:53:50 +05:00
module.exports = Configuration;