send message to user in PresenceUpdate event

How can I send a message to an user when the PresenceUpdate event was called?
13 Replies
d.js toolkit
d.js toolkit12mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
MrShark
MrShark12mo ago
yes client.on('presenceUpdate', (oldMember, newMember) => { // send message to newMember }); no i'm programming a bot but i use RPC to call the event
MrShark
MrShark12mo ago
and what do i need to do to send it to a specific channel?
Tomáš
Tomáš12mo ago
this would send it to users DMs
MrShark
MrShark12mo ago
yea i know, but i want to send it to an specific channel
Tomáš
Tomáš12mo ago
you would need to fetch the guild channels from the presence update and then choose some or you can just copy the id of the channel and hardcode fetch that channel and send message to it
MrShark
MrShark12mo ago
ok and how would i fetch the guild channels?
Tomáš
Tomáš12mo ago
const channelToSendTo = client.channels.fetch('id') sorry missread what exactly you are trying to accomplish? if is isn't a secret when is some guild a presence update is emmited, you want to....?
MrShark
MrShark12mo ago
and then channel.send('lol')? *channelToSend To.send ..send a message to a channel with information about the RPC or Game or whatever
Tomáš
Tomáš12mo ago
is your bot in multiple guilds, or is it planned to be? do you want to send the message to some channel in its respective guild or always to the same channel on one guild?
MrShark
MrShark12mo ago
ig only for one guild, at least for now
Tomáš
Tomáš12mo ago
sorry, way away, but for one channel you can use this and this