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 toolkit2y 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
MrSharkOP2y 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
MrSharkOP2y ago
and what do i need to do to send it to a specific channel?
Tomáš
Tomáš2y ago
this would send it to users DMs
MrShark
MrSharkOP2y ago
yea i know, but i want to send it to an specific channel
Tomáš
Tomáš2y 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
MrSharkOP2y ago
ok and how would i fetch the guild channels?
Tomáš
Tomáš2y 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
MrSharkOP2y 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áš2y 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
MrSharkOP2y ago
ig only for one guild, at least for now
Tomáš
Tomáš2y ago
sorry, way away, but for one channel you can use this and this
Want results from more Discord servers?
Add your server