Skip to content

Commit

Permalink
Add the message author id to message reaction events (#2499)
Browse files Browse the repository at this point in the history
  • Loading branch information
MinnDevelopment authored Jul 14, 2023
1 parent 1b6281c commit ec41b86
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,36 @@
*/
public class MessageReactionAddEvent extends GenericMessageReactionEvent
{
private final long messageAuthorId;

public MessageReactionAddEvent(@Nonnull JDA api, long responseNumber, @Nullable User user,
@Nullable Member member, @Nonnull MessageReaction reaction, long userId)
@Nullable Member member, @Nonnull MessageReaction reaction, long userId, long messageAuthorId)
{
super(api, responseNumber, user, member, reaction, userId);
this.messageAuthorId = messageAuthorId;
}

/**
* The user id of the original message author.
* <br>This might be 0 for webhook messages.
*
* @return The user id of the original message author.
*/
@Nonnull
public String getMessageAuthorId()
{
return Long.toUnsignedString(messageAuthorId);
}


/**
* The user id of the original message author.
* <br>This might be 0 for webhook messages.
*
* @return The user id of the original message author.
*/
public long getMessageAuthorIdLong()
{
return messageAuthorId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ protected Long handleInternally(DataObject content)
api.handleEvent(
new MessageReactionAddEvent(
api, responseNumber,
user, member, reaction, userId));
user, member, reaction, userId, content.getUnsignedLong("message_author_id", 0L)));
}
else
{
Expand Down

0 comments on commit ec41b86

Please sign in to comment.