How to display a custom message under a Discord bot's avatar using JDA?

I’m working on a Discord bot with JDA and I want to show a custom message right below the bot’s avatar. You know, like how users can set their own status messages.

I’ve tried using setActivity like this:

bot.getPresence().setActivity(Activity.playing("Some game"));

But that always adds “Playing” or “Listening to” before my message. I want to get rid of those prefixes.

Is there a way to just show a plain text status for my bot? I’ve seen other bots do it, but I can’t figure out how. I’ve looked through the JDA docs and searched online, but no luck so far.

Any ideas on how to make this work? It’d be great if someone could point me in the right direction!

I’ve actually run into this exact issue before when building my own Discord bot. The key is to use the setActivity() method with the Activity.customStatus() option instead of Activity.playing(). Here’s the code snippet that worked for me:

bot.getPresence().setActivity(Activity.customStatus("Your custom message here"));

This lets you set a plain text status without any prefixes. Just remember that custom statuses are limited to 128 characters, so keep it concise.

One quirk I noticed is that sometimes it takes a few minutes for the status to update across all servers. So don’t panic if you don’t see it change immediately.

Hope this helps you out! Let me know if you run into any other snags with implementation.

hey, i think i can help! try using Activity.watching() instead. it’ll show up as “Watching [your message]” which looks better than “Playing”. like this:

bot.getPresence().setActivity(Activity.watching("your servers"));

it’s not perfect but works for me. goodluck!

While the previous suggestions are valid, there’s actually a more straightforward approach to achieve what you’re looking for. JDA provides a method specifically for setting a custom status without any prefixes. Here’s how you can do it:

bot.getPresence().setActivity(Activity.of(Activity.ActivityType.CUSTOM_STATUS, "Your message here"));

This method allows you to set a pure text status without any ‘Playing’ or ‘Watching’ prefix. It’s worth noting that this feature might be subject to Discord’s rate limiting, so avoid changing it too frequently.

Additionally, ensure your bot has the necessary permissions to change its presence. If you’re still facing issues, double-check your bot’s OAuth2 scopes and make sure ‘bot’ and ‘applications.commands’ are included.