0
votes

I recently did an personal greeting for every new member that joins my discord (A small one). The bot generates a full image with a wallpaper, the user's avatar and a greeting message. But I only works (obviously) for new users. Now I want my friends also to be greeted. I imagine just typing in a channel /greet and it would imitate a new MemberAdd. My command-Handler is working fine, I copied the code from the oroginal client.on("guildMemberAdd"...), but realised, that I need somehow to reference the member, like in client.on("guildMemberAdd", async (member) => { How can I get from an ID to the member, like const member = .... The rest should work then fine.

Thanks in advance!

2

2 Answers

1
votes

You could just use this simple method. Let's assume you have a member object.

member.guild.members.cache.find(m => m.id === "id");
1
votes

You can emit events, that means you can run the events. Just use the .emit function with the arguments, example:

Client.emit("guildMemberAdd", guildMember)

That will run the function as if it was a member joining.