I'm trying to write a discord bot using JDA, and while I can get the presence of the bot fairly easily, I cannot get the presence of a selected user. An example use case for this might be the user typing in a command like !game and then the bot sends a message telling the user what game they're playing. As far as I know, the bot cannot get the user's game activity without getting the user's presence, and I do not see a way to do so. If I missed it in the documentation, please link the method/class.
Get a user's presence - discord JDA library
1k Views Asked by Mike At
1
There are 1 best solutions below
Related Questions in JAVA
- I need the BIRT.war that is compatible with Java 17 and Tomcat 10
- Creating global Class holder
- No method found for class java.lang.String in Kafka
- Issue edit a jtable with a pictures
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- Does the && (logical AND) operator have a higher precedence than || (logical OR) operator in Java?
- Mixed color rendering in a JTable
- HTTPS configuration in Spring Boot, server returning timeout
- How to use Layout to create textfields which dont increase in size?
- Function for making the code wait in javafx
- How to create beans of the same class for multiple template parameters in Spring
- How could you print a specific String from an array with the values of an array from a double array on the same line, using iteration to print all?
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Accessing Secret Variables in Classic Pipelines through Java app in Azure DevOps
- Postgres && statement Error in Mybatis Mapper?
Related Questions in DISCORD
- discord.py - Oauth2 - join user to guild
- My unban and ban commands arent showing when i put the slash
- discord.py discord-slash import
- Bot.load_Extension is returning this error for disnake and discord.py library both
- Why aren't my member variables filled when I use discord.utils.get()?
- "If" condition with numbers doesnt working
- Discordbot(Python) who should start bat file(Minecraft server) can't find user_jvm_args.txt file
- Discord.js not playing sound
- How do i make a slash command that dms a user in discord.js
- discord music bot is connecting and accepting the url but its giving me no audio
- Java music bot not playing music
- Why does this error keep showing, what am i missing? await message.channel.send(f"Answer: {bot_response}") IndentationError: unexpected indent
- JDA Lavaplayer bot doesn't work without changing .jar file
- bot = commands.Bot(command_prefix="!") TypeError: BotBase.__init__() missing 1 required keyword-only argument: 'intents'
- Discord bot can't send messages from the server but sends messages from dm
Related Questions in DISCORD-JDA
- JDA getGuildById() returning null
- Discord JDA getManager().setName() is reverting back immidiately
- How can I find out who invited the user using JDA?
- Minecraft plugin: JDA library conflict with Kotlin causing issues
- how can I log out of the jda-discord voice channel
- How can I mention a user via JDA-discord?
- JDA Send message in Cyrillic results in a bunch of gibberish
- Can I change a user's nickname based on their ID?
- How to get username by message id
- how to make JDA take user messages and not the bot
- JDA Reply multiple times at once
- JoinEvent discord JDA
- Discord Java JDA - Tebex - Request.delete block and does not execute the code that follows the method
- JDA Discord Bot: INTEGER Option Range
- Sending embeds with JDA
Related Questions in USER-PRESENCE
- How can I stop codelenses from breaking up indent guides in VS Code?
- Migrosoft Teams mgraph REQUEST 401 SSL errror
- Connection disconnected Server returned an error on close: Connection closed with an error. ArgumentNullException Value cannot be null (Parameter key)
- Get Teams Call state
- Laravel 9 presence channels for all users (guests and logged)
- How can I get what a user is playing on discord?
- How to retrieve online presence status in Outlook using VBA
- Users Presence Monitoring Using Firebase Realtime DB Rest API
- Managing user presence in real time database using Flutter
- Facings issues in fetching Multiple users Subscription for Presence MS Graph API (For Microsoft Teams)
- onDisconnect fires when client reconnects
- Cloud Firestore for Presence notifications
- Firebase Realtime onDisconnect does not work when same app is running location service in the background(location.enableBackgroundMode(enable: true);)
- presence update not working discord.js v12
- How do I send Presence update after my phone goes back from sleep with PubNub?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
After a bunch of digging and documentation reading, I have come to a solution. There is no way to get a presence like I was thinking, but since my original intent was to get the game activity, this solution works. First, the bot must have guild presence permissions granted through the developer portal. Then we need to include the line
jdaBuilder.enableIntents(GatewayIntent.GUILD_PRESENCES);before we call the build method in our main method. Finally, to get member activities, we need to includejdaBuilder.enableCache(CacheFlag.ACTIVITY);. This lets us use themember.getActivities()method. Generally speaking, getting data associated with specific users requires enabling guild presences.