From f4c2a5e55105b56bb5d4498c77318825f845cf2a Mon Sep 17 00:00:00 2001 From: Kaktushose <42280757+Kaktushose@users.noreply.github.com> Date: Wed, 10 Jan 2024 16:02:10 +0100 Subject: [PATCH] add missing retrieveMessage methods to ReactionEvents --- .../react/MessageReactionRemoveAllEvent.java | 20 +++++++++++++++++++ .../MessageReactionRemoveEmojiEvent.java | 20 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveAllEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveAllEvent.java index 9837cfbefb..5f56ba020f 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveAllEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveAllEvent.java @@ -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; /** @@ -41,4 +44,21 @@ public MessageReactionRemoveAllEvent(@Nonnull JDA api, long responseNumber, long { super(api, responseNumber, messageId, channel); } + + /** + * Retrieves the message for this reaction event. + *
Simple shortcut for {@code getChannel().retrieveMessageById(getMessageId())}. + * + *

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 retrieveMessage() + { + return getChannel().retrieveMessageById(getMessageId()); + } } diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEmojiEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEmojiEvent.java index e69e90cd09..a0182c040d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEmojiEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEmojiEvent.java @@ -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; /** @@ -70,4 +73,21 @@ public EmojiUnion getEmoji() { return reaction.getEmoji(); } + + /** + * Retrieves the message for this reaction event. + *
Simple shortcut for {@code getChannel().retrieveMessageById(getMessageId())}. + * + *

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 retrieveMessage() + { + return getChannel().retrieveMessageById(getMessageId()); + } }