Skip to main content

๐Ÿ™Œ Persences

Status & activities updates of users and bots

๐Ÿค” "Presence"โ€‹

Presence is an object with several data and methods, you should read discord.js documentation to see how to work with Presence.

We will handle PresenceUpdate so you can also take a look at this page:

๐Ÿ†™ PresenceUpdateโ€‹

Has two arguments old_presence and new_presence who are instances of Presence.

โš ๏ธ Warning: old_presence is the user status before the update and new_presence after the update.

async function parse(old_presence, new_presence)
{
console.log(`${new_presence.member.user.username}'s status changed`)
}

module.exports = {
parse
}

โŽฏ Exports

At the bottom of the file we have exports, which includes several important elements.

module.exports = {
parse,
conditions: [],
any_guild: false,
dm: false,
allow_bots: false
}
  • parse โ†’ method to handle the event
  • any_guild โ†’ if false, the command can be executed only on the main guild
  • dm โ†’ if true, we can use this command in direct messages
  • allow_bots โ†’ if false, it will ignore events when the user is a bot