2021-12-30 00:53:09 +05:00
|
|
|
const Command = require("../../base/Command.js"),
|
|
|
|
Resolvers = require("../../helpers/resolvers");
|
|
|
|
|
|
|
|
class Setbirthdays extends Command {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
|
|
name: "setbirthdays",
|
|
|
|
dirname: __dirname,
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: true,
|
2022-01-01 00:50:09 +05:00
|
|
|
aliases: ["setb"],
|
2021-12-30 00:53:09 +05:00
|
|
|
memberPermissions: ["MANAGE_GUILD"],
|
|
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: false,
|
2022-01-01 00:50:09 +05:00
|
|
|
cooldown: 1000
|
2021-12-30 00:53:09 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async run(message, args, data) {
|
|
|
|
const areBirthdaysEnabled = Boolean(data.guild.plugins.birthdays);
|
|
|
|
const sentChannel = await Resolvers.resolveChannel({
|
|
|
|
message,
|
|
|
|
search: args.join(" "),
|
|
|
|
channelType: "text"
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!sentChannel && areBirthdaysEnabled) {
|
|
|
|
data.guild.plugins.birthdays = null;
|
|
|
|
data.guild.markModified("plugins.birthdays");
|
|
|
|
await data.guild.save();
|
2021-12-30 20:03:36 +05:00
|
|
|
return message.success("administration/setbirthdays:DISABLED");
|
2021-12-30 00:53:09 +05:00
|
|
|
} else {
|
|
|
|
const channel = sentChannel || message.channel;
|
|
|
|
data.guild.plugins.birthdays = channel.id;
|
|
|
|
data.guild.markModified("plugins.birthdays");
|
|
|
|
await data.guild.save();
|
2021-12-30 20:03:36 +05:00
|
|
|
return message.success("administration/setbirthdays:ENABLED", {
|
2021-12-30 00:53:09 +05:00
|
|
|
channel: channel.toString()
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Setbirthdays;
|