question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error using .getUser().isBot()

See original GitHub issue

Hello guys ! Until now, I was using this lines :

Member author = event.getMember();
if(!author.getUser().isBot()) {...}

But today, I have this error on the author.getUser().isBot() function :

[Fatal] [JDA]: java.lang.NullPointerException
at MainBot.onGuildMessageReceived(...)

I was on JDA 3.0.0 and seeing that problem I updated to 3.3.0 but the problem still here. Do you know why ? Can you help me ?

Thank a lot 😃

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
natanbccommented, Oct 1, 2017

It could have been an webhook message, as those don’t have members

0reactions
DV8FromTheWorldcommented, Oct 4, 2017

This should instead be:

if (event.getUser().isBot() || event.getMessage().isWebhookMessage()) 
{...}
else
{
    Member author = event.getMember()
    ...
}

Webhook messages do not have Member objects.

Read more comments on GitHub >

github_iconTop Results From Across the Web

getUser() fails immediately after the login redirection - Questions
I'm trying to simply show the username once the user is logged in but i'm facing a strange behavior. If I call getUser()...
Read more >
firebase-admin auth error while calling `getUser`, but work fine ...
My best bet as to what is going wrong is that the private key within the service account key file you are using...
Read more >
isbot - npm
Good bot. Automated programs who visit websites in order to collect useful information. Web crawlers, site scrapers, stress testers, preview ...
Read more >
User Object Cheat Sheet - ServiceNow Guru
getUser(), Returns a reference to the user object for the currently logged-in user. var userObject = gs.getUser();.
Read more >
Get User Profile(v2) - User Not Found
I'm having the error that the user profile cannot be found even though the correct ... Enter the expression item() in get uesr...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found