fix: properly give visitor role to new members

This commit is contained in:
syntaxbullet
2025-12-18 22:32:45 +01:00
parent 4642cf7f6a
commit 28936a7f7a

View File

@@ -1,13 +1,16 @@
import { Events } from "discord.js"; import { Events } from "discord.js";
import type { Event } from "@lib/types"; import type { Event } from "@lib/types";
import { config } from "@lib/config";
// Visitor role // Visitor role
const event: Event<Events.GuildMemberAdd> = { const event: Event<Events.GuildMemberAdd> = {
name: Events.GuildMemberAdd, name: Events.GuildMemberAdd,
execute: async (member) => { execute: async (member) => {
const role = member.guild.roles.cache.find(role => role.id === "1449859380269940947"); try {
if (!role) return; await member.roles.add(config.visitorRole);
await member.roles.add(role); } catch (error) {
console.error(`Failed to assign visitor role to ${member.user.tag}:`, error);
}
}, },
}; };