Skip to content
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

Closed
wants to merge 2 commits into from
Closed

Conversation

MinnDevelopment
Copy link
Member

@MinnDevelopment MinnDevelopment commented Dec 14, 2021

Pull Request Etiquette

Changes

  • Internal code
  • Library interface (affecting end-user code)
  • Documentation
  • Other: _____

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.

@MinnDevelopment MinnDevelopment added type: enhancement status: documentation needed lacks documentation, either partially or completely labels Dec 14, 2021
Also fix some exception messages
Comment on lines +97 to 98
* <br>If this channel event was not received in a {@link TextChannel TextChannel},
* this will throw an {@link java.lang.IllegalStateException}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* <br>If this channel event was not received in a {@link TextChannel TextChannel},
* this will throw an {@link java.lang.IllegalStateException}.

Comment on lines +124 to +125
* <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}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* <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}.

Comment on lines +144 to +153
@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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs for both

@MinnDevelopment
Copy link
Member Author

Closing in favor of #2138

@MinnDevelopment MinnDevelopment deleted the patch-channel-events branch July 2, 2022 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: documentation needed lacks documentation, either partially or completely type: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants