Discord Presence

Discord.js Version 14.14.1 NodeJS Version: 18.15.0 Been working on my logs for discord trying to get a presence log so when someone changes there custom status/online indicator it logs it in my logs channel, when when i inspect the guild/user object the presence isnt there its just
presences: PresenceManager {},
presences: PresenceManager {},
i have a presence set, i even tryed changing my custom status and clearing it, nothing seems to change it, i do have the intent for presence but still nothing guildMemberUpdate Code: https://gist.github.com/SkullGaming31/cde25fbc5b8bc7d5b0e05a8c368770bd Console.log for old and newMember: https://gist.github.com/SkullGaming31/16ee4796294ee1ee79a3e9064f5933ad
Gist
guildMemberUpdate Code
guildMemberUpdate Code. GitHub Gist: instantly share code, notes, and snippets.
Gist
console.log object
GitHub Gist: instantly share code, notes, and snippets.
13 Replies
d.js toolkit
d.js toolkit4mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
mallusrgreat
mallusrgreat4mo ago
do you have GuildPresences intent can u show the client constructor
CanadienDragon
CanadienDragon4mo ago
yes i do have it
constructor() {
super({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildWebhooks,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildPresences
],
partials: [
Partials.Channel,
Partials.GuildMember,
Partials.GuildScheduledEvent,
Partials.Message,
Partials.Reaction,
Partials.ThreadMember,
Partials.User
],
allowedMentions: { parse: ['everyone', 'roles', 'users'] },
makeCache: Options.cacheWithLimits({
...Options.DefaultMakeCacheSettings,
MessageManager: { maxSize: 200 }
}),
presence: { activities: [{ name: 'Im DragonBot', type: ActivityType.Custom, url: 'https://github.com/skullgaming31/DragonBot' }], afk: false, status: 'online' },
});
}
constructor() {
super({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildWebhooks,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildPresences
],
partials: [
Partials.Channel,
Partials.GuildMember,
Partials.GuildScheduledEvent,
Partials.Message,
Partials.Reaction,
Partials.ThreadMember,
Partials.User
],
allowedMentions: { parse: ['everyone', 'roles', 'users'] },
makeCache: Options.cacheWithLimits({
...Options.DefaultMakeCacheSettings,
MessageManager: { maxSize: 200 }
}),
presence: { activities: [{ name: 'Im DragonBot', type: ActivityType.Custom, url: 'https://github.com/skullgaming31/DragonBot' }], afk: false, status: 'online' },
});
}
duck
duck4mo ago
not all properties are enumerable consider logging <GuildMember>.presence directly, or if you're just trying to see what properties are available, consider reading the docs
probablyraging
probablyraging4mo ago
Also <GuildMember>.presense is an object, so having that in your embed won't work as you expect it to. If you're after the custom status of a member you need to look at <Presense>.activities which is an array of activities. A custom status has a type of 4
CanadienDragon
CanadienDragon4mo ago
just finished writing as you sent this
Embed.setDescription(`${newMember.user.globalName} status has changed from \`${oldMember.presence?.activities[0].state}\` to: \`${newMember.presence?.activities[0].state}\``)
Embed.setDescription(`${newMember.user.globalName} status has changed from \`${oldMember.presence?.activities[0].state}\` to: \`${newMember.presence?.activities[0].state}\``)
probablyraging
probablyraging4mo ago
Only issue here is activities[0] might not always be a custom status, could be one of the other types too. You would need to filter for that type
CanadienDragon
CanadienDragon4mo ago
okay, atm i just wanna get it actually posting into discord then i will start refining it down
CanadienDragon
CanadienDragon4mo ago
im not sure why it wont detect a custom status change, the old member and newmember both have the same state but i have changed it so it would trigger an update
probablyraging
probablyraging4mo ago
I think you want the presenceUpdate event
CanadienDragon
CanadienDragon4mo ago
would the setting a presence trigger for the guildMemberUpdate? cause that doesnt get picked up either
probablyraging
probablyraging4mo ago
I guess not, presenceUpdate will though
CanadienDragon
CanadienDragon4mo ago
okay thank you, ill look into that now that has more of what i want Thank You