Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

258
Views
How to get user activities from interaction in Discord.js v13?

How can I get the activities from interaction.options? If I use interaction.options.getUser, I receive the following error:

cannot read properties of undefined (reading 'activities')

Here is my code:

const user = interaction.options.getUser('target');

const activity = user.presence.activities.type;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Users don't have a presence property, only GuildMembers have. What you can do is to fetch the member by its ID first:

const user = interaction.options.getUser('target');
const member = await interaction.guild.members.fetch(user);

And then, you can get the activities:

const activities = member.presence?.activities;

activities returns an array of Activity, so you'll need to grab the first one for example to log its type:

console.log(activities[0]?.type)

Please note that you'll need to have the GUILDS, GUILD_MEMBERS, and GUILD_PRESENCES intents enabled!

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!