Pontifice
Pontifice
DIAdiscord.js - Imagine an app
Created by Pontifice on 8/22/2023 in #djs-questions
This Library Is Not Handling Member Joins
I've a problem with my member join event handling, by which it only executes after the first member join, but it don't catches the joining of any member after the first one since the restart of the bot. Here's the code:
const { Events } = require('discord.js');
const client = require('../structure/instance.js');
const config = require('../structure/config.json');
const texts = require('../resources/texts.js')


module.exports = {
name: Events.GuildMemberAdd,
once: true,
async execute(member) {
console.log('Member joined.');

const guild = client.guilds.cache.get(config.guildId);
const role = guild.roles.cache.find((role) => role.id === texts.members);
await member.roles.add(role);

return;
},
};
const { Events } = require('discord.js');
const client = require('../structure/instance.js');
const config = require('../structure/config.json');
const texts = require('../resources/texts.js')


module.exports = {
name: Events.GuildMemberAdd,
once: true,
async execute(member) {
console.log('Member joined.');

const guild = client.guilds.cache.get(config.guildId);
const role = guild.roles.cache.find((role) => role.id === texts.members);
await member.roles.add(role);

return;
},
};
6 replies