send message to user in PresenceUpdate event
How can I send a message to an user when the PresenceUpdate event was called?
13 Replies
• 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.yes
client.on('presenceUpdate', (oldMember, newMember) => {
// send message to newMember
});
no i'm programming a bot but i use RPC to call the eventnewMember.user.send()
Based on
https://old.discordjs.dev/#/docs/discord.js/main/class/Client?scrollTo=e-presenceUpdate
https://old.discordjs.dev/#/docs/discord.js/main/class/Presence
https://old.discordjs.dev/#/docs/discord.js/main/class/User?scrollTo=send
yes
will do
This may require additional intents
and what do i need to do to send it to a specific channel?
this would send it to users DMs
yea i know, but i want to send it to an specific channel
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
ok and how would i fetch the guild channels?
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....?
and then channel.send('lol')?
*channelToSend To.send
..send a message to a channel with information about the RPC or Game or whatever
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?
ig only for one guild, at least for now
sorry, way away, but for one channel you can use this
and this