I'm trying to make a welcome message bot with Discord.js, and the welcome message will be sent through a webhook in a certain channel when a member has the access to it.
And this is what I have right now:
client.on("guildMemberUpdate", member => { const wc = new WebhookClient('webhook-id', 'webook-token'); if (member.roles.cache.some(r => r.name === "test")) { wc.send(`Welcome <@${member.id}> !`); } else if (member.roles.cache.find(r => r.name === "Server Booster")) { wc.send(`Thank you for the boost <@${member.id}> !`); } else return; });
I am having a problem with the guildMemberUpdate
not emitting when the role is added, the console log shows it only triggers when a role is deleted.
Any insight would be greatly appreciated!
Thanks for reading
https://stackoverflow.com/questions/65911470/discord-js-guildmemberupdate-event January 27, 2021 at 09:01AM
没有评论:
发表评论