I made a bot and I want to add a feature to my bot. ping a specific room when people with a custom role leave the server. So, for example, we'll know when people with the "partner" role come out. I wanna write code in index.js. Can anyone help me?
I tried something but I couldn't do it because my js knowledge is not very good..
CodePudding user response:
Lemme tell you this isn't much related to discordjs itself, but the way discord client works. You should not probably ping a user who has left the server, as uncached users on mobile or any user may show as invalid user. Therefore you should log username#discriminator, or actually tag and then user id incase you want to keep the record of their IDs for future ping, etc.
CodePudding user response:
You can ping a user if they left a server, though some users will only see an id, because they have not added them as a friend.
First, you need to store their userid somewhere (txt or json can work) then when they leave the server can you use the bot to ping them (but it will not really ping them but show an user) by <message>.send({content: <@userid>}).