mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
setbirthdays
This commit is contained in:
parent
c355555cc4
commit
7c7931c7f8
2 changed files with 52 additions and 0 deletions
45
commands/Administration/setbirthdays.js
Normal file
45
commands/Administration/setbirthdays.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
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,
|
||||
aliases: [],
|
||||
memberPermissions: ["MANAGE_GUILD"],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
});
|
||||
}
|
||||
|
||||
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();
|
||||
return message.success("administration/setbirthdays:SUCCESS_DISABLED");
|
||||
} else {
|
||||
const channel = sentChannel || message.channel;
|
||||
data.guild.plugins.birthdays = channel.id;
|
||||
data.guild.markModified("plugins.birthdays");
|
||||
await data.guild.save();
|
||||
return message.success("administration/setbirthdays:SUCCESS_ENABLED", {
|
||||
channel: channel.toString()
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = Setbirthdays;
|
7
languages/ru-RU/administration/setbirthdays.json
Normal file
7
languages/ru-RU/administration/setbirthdays.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"DESCRIPTION": "Установить канал для поздравлений с днём рождения!",
|
||||
"USAGE": "{{prefix}}setbirthdays (#канал)",
|
||||
"EXAMPLES": "{{prefix}}setbirthdays #дни-рождения\n{{prefix}}setbirthdays",
|
||||
"SUCCESS_ENABLED": "Поздравления включены в канале **{{channel}}**!",
|
||||
"SUCCESS_DISABLED": "Поздравления отключены!"
|
||||
}
|
Loading…
Reference in a new issue