fixed Birthday Event, Renamed DB Colls

This commit is contained in:
2026-04-06 15:47:54 +02:00
parent ea18387c75
commit 0769a482fb
33 changed files with 281 additions and 196 deletions
+12 -10
View File
@@ -8,11 +8,11 @@ module.exports = {
once: false,
async execute(member, client) {
console.log(`${member.user.username} hat Geburtstag!`)
let found = null
const db = mClient.db(process.env.DB)
const channelsColl = db.collection('channels')
const found = await channelsColl.find(
const db = mClient.db(process.env.M_DB)
const channelsColl = db.collection('config_channels')
found = await channelsColl.find(
{
$and: [
{ guildID: member.guild.id },
@@ -25,12 +25,13 @@ module.exports = {
return console.log('Channel not yet set for birthday!')
}
const guild = client.guilds.cache.get(found[0].guildID);
const channel = guild.channels.cache.get(found[0].channelID);
const roleID = '702877228857557002'
const role = guild.roles.cache.get(roleID)
const roleColl = db.collection('config_roles')
// Bot Role MUST BE above birthday Role, Birthday Role MUST BE above user roles
found = await roleColl.findOne({guildID: member.guild.id})
const role = guild.roles.cache.get(found.roleID)
try {
await member.roles.add(role)
@@ -79,8 +80,9 @@ module.exports = {
ctx.strokeText(text, textX, 60 + pfp.height);
ctx.fillText(text, textX, 60 + pfp.height);
ctx.font = '30px sans-serif';
text = `🥳 ${member.user.globalName ? member.user.globalName : member.user.username} 🎉`;
// requires apt-get install ttf-ancient-fonts
ctx.font = '30px "Noto Emoji", "Segoe UI Emoji", "Apple Color Emoji", sans-serif';
text = `🎉 ${member.user.globalName ? member.user.globalName : member.user.username} 🎉`;
textWidth = ctx.measureText(text).width;
textX = canvas.width / 2 - textWidth / 2;
textHeight = 30; // Approximate height of the text