mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
birthday announce
This commit is contained in:
parent
950525d150
commit
c355555cc4
8 changed files with 63 additions and 10 deletions
|
@ -51,6 +51,7 @@ module.exports = mongoose.model("Guild", new Schema({
|
||||||
},
|
},
|
||||||
suggestions: false, // the channel in which the suggestions will be sent
|
suggestions: false, // the channel in which the suggestions will be sent
|
||||||
modlogs: false, // the channel in which the moderation logs (mute, kick, ban, etc...) will be sent
|
modlogs: false, // the channel in which the moderation logs (mute, kick, ban, etc...) will be sent
|
||||||
|
birthdays: false, // the channel in which birtdays announcements will be sent
|
||||||
reports: false, // the channel in which the reports will be sent
|
reports: false, // the channel in which the reports will be sent
|
||||||
fortniteshop: false, // the channel in which the fortnite shop image will be sent at 2.05am
|
fortniteshop: false, // the channel in which the fortnite shop image will be sent at 2.05am
|
||||||
logs: false // the channel in which the logs (message deleted, etc...) will be sent
|
logs: false // the channel in which the logs (message deleted, etc...) will be sent
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Translate extends Command {
|
||||||
});
|
});
|
||||||
|
|
||||||
const resEmbed = new Discord.MessageEmbed()
|
const resEmbed = new Discord.MessageEmbed()
|
||||||
.setAuthor("Translator", this.client.user.displayAvatarURL({
|
.setAuthor("Переводчик", this.client.user.displayAvatarURL({
|
||||||
size: 512,
|
size: 512,
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
format: "png"
|
format: "png"
|
||||||
|
|
|
@ -17,6 +17,10 @@ module.exports = class {
|
||||||
const discordtogether = require("../helpers/discordTogether");
|
const discordtogether = require("../helpers/discordTogether");
|
||||||
discordtogether.init(client);
|
discordtogether.init(client);
|
||||||
|
|
||||||
|
// Birthday Announce
|
||||||
|
const birthdays = require("../helpers/birthdays");
|
||||||
|
birthdays.init(client);
|
||||||
|
|
||||||
// DiscordBots.org STATS
|
// DiscordBots.org STATS
|
||||||
const discordbotsorg = require("../helpers/discordbots.org");
|
const discordbotsorg = require("../helpers/discordbots.org");
|
||||||
discordbotsorg.init(client);
|
discordbotsorg.init(client);
|
||||||
|
|
44
helpers/birthdays.js
Normal file
44
helpers/birthdays.js
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
const CronJob = require("cron").CronJob,
|
||||||
|
Discord = require("discord.js");
|
||||||
|
|
||||||
|
async function init(client) {
|
||||||
|
new CronJob("0 0 8 * * *", async function () {
|
||||||
|
client.guilds.cache.forEach(async (guild) => {
|
||||||
|
const date = new Date();
|
||||||
|
const currentMonth = date.getMonth() + 1;
|
||||||
|
const currentDay = date.getDate();
|
||||||
|
const guildData = await client.findOrCreateGuild({
|
||||||
|
id: guild.id
|
||||||
|
});
|
||||||
|
|
||||||
|
if (guildData.plugins.birthdays) {
|
||||||
|
const channel = client.channels.cache.get(guildData.plugins.birthdays);
|
||||||
|
if (channel) {
|
||||||
|
client.usersData
|
||||||
|
.find({ birthdate: { $gt: 1 } })
|
||||||
|
.then((users) => {
|
||||||
|
for (const user of users) {
|
||||||
|
const month = user.birthdate.getUTCMonth() + 1;
|
||||||
|
const day = user.birthdate.getUTCDate();
|
||||||
|
if (currentMonth === month && currentDay === day) {
|
||||||
|
const embed = new Discord.MessageEmbed()
|
||||||
|
.setAuthor(message.guild.name, message.guild.iconURL())
|
||||||
|
.setColor(client.config.embed.color)
|
||||||
|
.setFooter(client.config.embed.footer)
|
||||||
|
.addField(message.translate("economy/birthdate:HAPPY_BIRTHDAY"), message.translate("economy/birthdate:HAPPY_BIRTDAY_MESSAGE", {
|
||||||
|
user: user.id
|
||||||
|
}));
|
||||||
|
const msg = await channel.send(embed);
|
||||||
|
await msg.react("🎉");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}, null, true, "Europe/Moscow");
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
init
|
||||||
|
};
|
|
@ -28,8 +28,8 @@
|
||||||
"DASHBOARD_TITLE": "Edit your configuration:",
|
"DASHBOARD_TITLE": "Edit your configuration:",
|
||||||
"DASHBOARD_CONTENT": "Click here to go on the dashboard!",
|
"DASHBOARD_CONTENT": "Click here to go on the dashboard!",
|
||||||
"AUTO_SANCTIONS": "Automatic sanctions",
|
"AUTO_SANCTIONS": "Automatic sanctions",
|
||||||
"KICK_CONTENT": "__Kick:__ After **{{count}}** warnings.",
|
"KICK_CONTENT": "Kick: After **{{count}}** warnings.",
|
||||||
"KICK_NOT_DEFINED": "__Kick:__ Not defined.",
|
"KICK_NOT_DEFINED": "Kick: Not defined.",
|
||||||
"BAN_CONTENT": "__Ban:__ After **{{count}}** warnings.",
|
"BAN_CONTENT": "Ban: After **{{count}}** warnings.",
|
||||||
"BAN_NOT_DEFINED": "__Ban:__ Not defined."
|
"BAN_NOT_DEFINED": "Ban: Not defined."
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,7 @@
|
||||||
"INVALID_DATE_FORMAT": "You must use the following date format: DD/MM/YYYY. For example, `December 1, 2000` will be `01/12/2000`.",
|
"INVALID_DATE_FORMAT": "You must use the following date format: DD/MM/YYYY. For example, `December 1, 2000` will be `01/12/2000`.",
|
||||||
"DATE_TOO_HIGH": "More than 80 years old? :eyes:",
|
"DATE_TOO_HIGH": "More than 80 years old? :eyes:",
|
||||||
"DATE_TOO_LOW": "Humm, nop! You must be born!",
|
"DATE_TOO_LOW": "Humm, nop! You must be born!",
|
||||||
|
"HAPPY_BIRTHDAY": "Today is someone's birthday!",
|
||||||
|
"HAPPY_BIRTHDAY_MESSAGE": "Happy birthday, <@{{user}}>!",
|
||||||
"SUCCESS": "Your birthday has been set on {{date}}!"
|
"SUCCESS": "Your birthday has been set on {{date}}!"
|
||||||
}
|
}
|
|
@ -28,8 +28,8 @@
|
||||||
"DASHBOARD_TITLE": "Изменить настройки:",
|
"DASHBOARD_TITLE": "Изменить настройки:",
|
||||||
"DASHBOARD_CONTENT": "Нажмите сюда, чтобы перейти в панель управления!",
|
"DASHBOARD_CONTENT": "Нажмите сюда, чтобы перейти в панель управления!",
|
||||||
"AUTO_SANCTIONS": "Автоматические наказания",
|
"AUTO_SANCTIONS": "Автоматические наказания",
|
||||||
"KICK_CONTENT": "__Кик:__ После **{{count}}** предупреждений.",
|
"KICK_CONTENT": "Кик: После **{{count}}** предупреждений.",
|
||||||
"KICK_NOT_DEFINED": "__Кик:__ Не назначено.",
|
"KICK_NOT_DEFINED": "Кик: Не назначено.",
|
||||||
"BAN_CONTENT": "__Бан:__ После **{{count}}** предупреждений.",
|
"BAN_CONTENT": "Бан: После **{{count}}** предупреждений.",
|
||||||
"BAN_NOT_DEFINED": "__Бан:__ Не назначено."
|
"BAN_NOT_DEFINED": "Бан: Не назначено."
|
||||||
}
|
}
|
|
@ -5,7 +5,9 @@
|
||||||
"MISSING_DATE": "Пожалуйста, укажите правильную дату! Например, 20/11/2003",
|
"MISSING_DATE": "Пожалуйста, укажите правильную дату! Например, 20/11/2003",
|
||||||
"INVALID_DATE": "Используйте данный формат: ДД/ММ/ГГГГ. Например, `1 января 2010` будет `01/01/2010`.",
|
"INVALID_DATE": "Используйте данный формат: ДД/ММ/ГГГГ. Например, `1 января 2010` будет `01/01/2010`.",
|
||||||
"INVALID_DATE_FORMAT": "Используйте данный формат: ДД/ММ/ГГГГ. Например, `1 января 2010` будет `01/01/2010`.",
|
"INVALID_DATE_FORMAT": "Используйте данный формат: ДД/ММ/ГГГГ. Например, `1 января 2010` будет `01/01/2010`.",
|
||||||
"DATE_TOO_HIGH": "Вы старше 80 лет? :eyes:",
|
"DATE_TOO_HIGH": "Вам больше 80 лет? :eyes:",
|
||||||
"DATE_TOO_LOW": "Хммм... Вы ещё не родились!",
|
"DATE_TOO_LOW": "Хммм... Вы ещё не родились!",
|
||||||
|
"HAPPY_BIRTHDAY": "Сегодня у кого-то день рождения!",
|
||||||
|
"HAPPY_BIRTHDAY_MESSAGE": "С днём рождения, <@{{user}}> :3",
|
||||||
"SUCCESS": "Ваш день рождения установлен на {{date}}!"
|
"SUCCESS": "Ваш день рождения установлен на {{date}}!"
|
||||||
}
|
}
|
Loading…
Reference in a new issue