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 toolkit10mo 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
mallusrgreat10mo ago
do you have GuildPresences intent can u show the client constructor
SkullGamingHQ
SkullGamingHQOP10mo 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
duck10mo 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
zevnda
zevnda10mo 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
SkullGamingHQ
SkullGamingHQOP10mo 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}\``)
zevnda
zevnda10mo 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
SkullGamingHQ
SkullGamingHQOP10mo ago
okay, atm i just wanna get it actually posting into discord then i will start refining it down
SkullGamingHQ
SkullGamingHQOP10mo 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
zevnda
zevnda10mo ago
I think you want the presenceUpdate event
SkullGamingHQ
SkullGamingHQOP10mo ago
would the setting a presence trigger for the guildMemberUpdate? cause that doesnt get picked up either
zevnda
zevnda10mo ago
I guess not, presenceUpdate will though
SkullGamingHQ
SkullGamingHQOP10mo ago
okay thank you, ill look into that now that has more of what i want Thank You
Want results from more Discord servers?
Add your server