#Why am i getting null type, details? How should i know witch intent or partials my projects miss?

11 messages · Page 1 of 1 (latest)

verbal plinth
#

const Client = new Discord.Client({
intents: [
Discord.GatewayIntentBits.GuildPresences,
Discord.GatewayIntentBits.GuildMembers,
Discord.GatewayIntentBits.GuildMessages,
Discord.GatewayIntentBits.DirectMessages,
Discord.GatewayIntentBits.MessageContent,
Discord.GatewayIntentBits.Guilds
], partials: [
Discord.Partials.Message,
Discord.Partials.Channel,
Discord.Partials.GuildMember,
Discord.Partials.User,
Discord.Partials.GuildScheduledEvent
]
});
Activity {
name: 'Cities: Skylines - Windows 10 Edition',
type: 0,
url: null,
details: null,
state: null,
applicationId: '438122941302046720',
timestamps: { start: 2023-02-09T23:17:44.837Z, end: null },
party: null,
assets: null,
flags: ActivityFlagsBitField { bitfield: 0 },
emoji: null,
buttons: [],
createdTimestamp: 1675984664899
}

autumn fog
#

• 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.

verbal plinth
#

My node version 16.16.0

#

Client.on('messageCreate', async (message) => {
const { content, author } = message;
if (!message.author.bot && !message.author.system) {
if (content.toLowerCase().includes('teste')) {
const listaDeMembros = await message.guild.members.fetch();
listaDeMembros.forEach((member) => {
// console.log(member.displayName);
// console.log(member.presence);
if (!member.presence) return
if (!member.presence.activities || member.presence.activities.length === 0) return
const activity = member.presence.activities[0];
console.log(Type: ${activity.type});
console.log(Name: ${activity.name});
console.log(Details: ${activity.details});
console.log(State: ${activity.state});
// console.log(member.user);

        });
    }
}

});

hard widget
#

you are getting null because not all activities have all the properties available, that activity in specific probably only has the name and the timestamp of when it started, nothing else. No picture, no details, because that data is not being provided by the application

#

can you send a picture of this activity, how it shows in the discord client

verbal plinth
#

Thanks for the help!

#

i think thats all, rookie mystake...

hard widget
#

yep thats pretty much it

#

if you try reading an activity such as spotify you will get a lot more information