fix: properly give visitor role to new members
This commit is contained in:
@@ -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);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user