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.

This message event did not happen in a guild on MessageReceivedEvent

See original GitHub issue

General Troubleshooting

  • I have checked for similar issues.
  • I have updated to the latest JDA version.
  • I have checked the branches or the maintainers’ PRs for upcoming bug fixes.

Bug Report

getting error when I call `event#getGuild()` on MessageReceivedEvent

Expected Behavior

it should get where the message comes from because the event have `event#getTextChannel()` also so it should be guild info also

Code Example or Reproduction Steps

N/A

Code for JDABuilder or DefaultShardManagerBuilder Used

N/A

Exception or Error

IllegalStateException : This message event did not happen in a guild

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
OMAR-3OOVcommented, Dec 8, 2021

This has already been fixed in 5.0.0-alpha.2

Duplicate of #1926

bro answer…

0reactions
OMAR-3OOVcommented, Dec 8, 2021

This has already been fixed in 5.0.0-alpha.2

Duplicate of #1926

it’s still… i use 5.0.0-alpha.2 version, also both of getGuildChannel / getGuild throws this error on the event please don’t forget I’m using MessageReceivedEvent

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why i get throw error on MessageReceivedEvent when i use ...
I just use event#getGuild() on MessageReceivedEvent, and get the error IllegalStateException: This message event did not happen in a guild ...
Read more >
Why i don't have GuildMessageReceivedEvent?
GuildMessageReceiveEvent has been removed and replaced by MessageReceivedEvent in JDA 5+. To only handle guild messages you just check event ...
Read more >
net.dv8tion.jda.core.events.message ... - Tabnine
nTo fix this, allow dabBot to " + "`Read Messages` and `Send Messages` in that text channel.\nIf you are not the guild "...
Read more >
MessageReceivedEvent (JDA 4.4.0_352 API)
Can be used to detect that a Message is received in either a guild- or private channel. Providing a MessageChannel and Message. Requirements....
Read more >
CommandEvent
CommandEvent(net.dv8tion.jda.core.events.message.MessageReceivedEvent ... Tests whether or not the User who triggered this event is an owner of the bot.
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