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

Add missing retrieveMessage methods to ReactionEvents #2604

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
package net.dv8tion.jda.api.events.message.react;

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.events.message.GenericMessageEvent;
import net.dv8tion.jda.api.requests.RestAction;

import javax.annotation.CheckReturnValue;
import javax.annotation.Nonnull;

/**
Expand All @@ -41,4 +44,21 @@ public MessageReactionRemoveAllEvent(@Nonnull JDA api, long responseNumber, long
{
super(api, responseNumber, messageId, channel);
}

/**
* Retrieves the message for this reaction event.
* <br>Simple shortcut for {@code getChannel().retrieveMessageById(getMessageId())}.
*
* <p>The {@link Message#getMember() Message.getMember()} method will always return null for the resulting message.
* To retrieve the member you can use {@code getGuild().retrieveMember(message.getAuthor())}.
*
* @return {@link RestAction} - Type: {@link Message}
*
*/
@Nonnull
@CheckReturnValue
public RestAction<Message> retrieveMessage()
{
return getChannel().retrieveMessageById(getMessageId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@
package net.dv8tion.jda.api.events.message.react;

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageReaction;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.entities.emoji.Emoji;
import net.dv8tion.jda.api.entities.emoji.EmojiUnion;
import net.dv8tion.jda.api.events.message.GenericMessageEvent;
import net.dv8tion.jda.api.requests.RestAction;

import javax.annotation.CheckReturnValue;
import javax.annotation.Nonnull;

/**
Expand Down Expand Up @@ -70,4 +73,21 @@ public EmojiUnion getEmoji()
{
return reaction.getEmoji();
}

/**
* Retrieves the message for this reaction event.
* <br>Simple shortcut for {@code getChannel().retrieveMessageById(getMessageId())}.
*
* <p>The {@link Message#getMember() Message.getMember()} method will always return null for the resulting message.
* To retrieve the member you can use {@code getGuild().retrieveMember(message.getAuthor())}.
*
* @return {@link RestAction} - Type: {@link Message}
*
*/
@Nonnull
@CheckReturnValue
public RestAction<Message> retrieveMessage()
{
return getChannel().retrieveMessageById(getMessageId());
}
}
Loading