pragmatrick
pragmatrick

Reputation: 635

How to trigger guildMemberAdd manually or imitate it

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!

Upvotes: 0

Views: 849

Answers (1)

Liam
Liam

Reputation: 957

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.

Upvotes: 1

Related Questions