-
-
Notifications
You must be signed in to change notification settings - Fork 734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve channel getters on events #1950
Conversation
Also fix some exception messages
* <br>If this channel event was not received in a {@link TextChannel TextChannel}, | ||
* this will throw an {@link java.lang.IllegalStateException}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* <br>If this channel event was not received in a {@link TextChannel TextChannel}, | |
* this will throw an {@link java.lang.IllegalStateException}. |
* <br>If this event was not received from a {@link net.dv8tion.jda.api.entities.Guild Guild}, | ||
* this will throw an {@link java.lang.IllegalStateException}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* <br>If this event was not received from a {@link net.dv8tion.jda.api.entities.Guild Guild}, | |
* this will throw an {@link java.lang.IllegalStateException}. |
@Nonnull | ||
public MessageChannel getMessageChannel() | ||
{ | ||
if (!getChannelType().isMessage()) | ||
throw new IllegalStateException("This event did not happen for a message channel"); | ||
return (MessageChannel) channel; | ||
} | ||
|
||
@Nonnull | ||
public GuildMessageChannel getGuildMessageChannel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs for both
Closing in favor of #2138 |
Pull Request Etiquette
Changes
Closes Issue: NaN
Description
This adds all the remaining getters for channel related events. I intentionally did not update any interaction events because that will be addressed by the rework there.