Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions config-generator/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@
"description-en": "Default log-channel for most modules and used to log relevant information",
"description-de": "Standard Log-Kanal für viele Module. Wird außerdem genutzt, um wesentliche Bot-Informationen zu senden"
},
{
"field_name": "disableEveryoneProtection",
"humanname-en": "Allow @everyone / @here pings",
"humanname-de": "@everyone und @here Pings erlauben",
"default": false,
"type": "boolean",
"description-de": "Erlaubt @everyone und @here pings in im Dashboard anpassbaren Nachrichten",
"description-en": "Allows @everyone and @here pings for messages configurable in the dashboard"
},
{
"field_name": "syncCommandGlobally",
"default": false,
Expand Down
5 changes: 3 additions & 2 deletions modules/birthday/birthday.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
const {getUser, getAutoSyncMembers} = require('@scnetwork/api');
const {embedType, disableModule} = require('../../src/functions/helpers');
const {MessageEmbed} = require('discord.js');
const {AgeFromDateString} = require('age-calculator');
const {AgeFromDate} = require('age-calculator');
const {localize} = require('../../src/functions/localize');

/**
Expand Down Expand Up @@ -65,6 +65,7 @@ generateBirthdayEmbed = async function (client, notifyUsers = false) {
id: au.id
}
});
console.log('AUTO SYNCED', au.id);
if (u) {
u.day = au.birthday.day;
u.month = au.birthday.month;
Expand Down Expand Up @@ -233,7 +234,7 @@ async function getUserStringForMonth(client, channel, month) {
}
let dateString = `${user.day}.${month}${user.year ? `.${user.year}` : ''}`;
if (user.year && !client.configurations['birthday']['config'].disableSync) {
const age = new AgeFromDateString(`${user.year}-${month - 1}-${user.day}`).age;
const age = new AgeFromDate(new Date(user.year, user.month - 1, user.day)).age;
if (age < 13 || age > 125) {
await user.destroy();
continue;
Expand Down
10 changes: 10 additions & 0 deletions modules/birthday/commands/birthday.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ module.exports.subcommands = {
});
}

if (!interaction.client.configurations['birthday']['config'].disableSync) {
const u = await getUser(interaction.user.id).catch(() => {
});
if (u && (u.birthday || {}).autoSync) return interaction.reply({
ephemeral: true,
content: '⚠ ' + localize('birthdays', 'auto-sync-on')
});
}

if ((day > 31 || day < 1) || (month > 12 || month < 1)) return interaction.reply({
ephemeral: true,
content: '⚠ ' + localize('birthdays', 'invalid-date')
Expand All @@ -129,6 +138,7 @@ module.exports.subcommands = {
interaction.birthday.day = day;
interaction.birthday.month = month;
interaction.birthday.year = year;
interaction.birthday.sync = false;
interaction.regenerateEmbed = true;

await interaction.reply(embedType(interaction.client.configurations['birthday']['config']['successfully_changed'], {}, {ephemeral: true}));
Expand Down
12 changes: 5 additions & 7 deletions modules/levels/commands/leaderboard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {sendMultipleSiteButtonMessage} = require('../../../src/functions/helpers');
const {sendMultipleSiteButtonMessage, truncate} = require('../../../src/functions/helpers');
const {MessageEmbed} = require('discord.js');
const {localize} = require('../../../src/functions/localize');

Expand Down Expand Up @@ -73,23 +73,21 @@ module.exports.run = async function (interaction) {
} else {
let userString = '';
let i = 0;
let total = 0;
for (const user of users) {
const member = interaction.guild.members.cache.get(user.userID);
if (!member) continue;
total++;
i++;
userString = userString + localize('levels', 'leaderboard-notation', {
p: i,
u: moduleConfig['useTags'] ? member.user.tag : member.user.toString(),
l: user.level,
xp: user.xp
}) + '\n';
if (i === total || i === 20) {
addSite({
if (i === users.filter(u => interaction.guild.members.cache.get(u.userID)).length || i % 20 === 0) {
addSite([{
name: localize('levels', 'users'),
value: userString
});
value: truncate(userString, 1024)
}]);
userString = '';
}
}
Expand Down
Loading