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 the message author id to message reaction events #2499

Merged
merged 2 commits into from
Jul 14, 2023
Merged
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 @@ -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