Skip to content

Commit

Permalink
Replace user_id with the user object in interaction metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
freya022 committed Apr 23, 2024
1 parent 5905e63 commit d2d8463
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/main/java/net/dv8tion/jda/api/entities/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -3062,17 +3062,17 @@ class InteractionMetadata implements ISnowflake
{
private final long id;
private final int type;
private final UserSnowflake userId;
private final User user;
private final IntegrationOwners integrationOwners;
private final Long originalResponseMessageId;
private final Long interactedMessageId;
private final InteractionMetadata triggeringInteraction;

public InteractionMetadata(long id, int type, UserSnowflake userId, IntegrationOwners integrationOwners, Long originalResponseMessageId, Long interactedMessageId, InteractionMetadata triggeringInteraction)
public InteractionMetadata(long id, int type, User user, IntegrationOwners integrationOwners, Long originalResponseMessageId, Long interactedMessageId, InteractionMetadata triggeringInteraction)
{
this.id = id;
this.type = type;
this.userId = userId;
this.user = user;
this.integrationOwners = integrationOwners;
this.originalResponseMessageId = originalResponseMessageId;
this.interactedMessageId = interactedMessageId;
Expand Down Expand Up @@ -3108,14 +3108,14 @@ public InteractionType getType()
}

/**
* The id of the user who caused this interaction.
* The {@link User} who caused this interaction.
*
* @return The {@link UserSnowflake}
* @return The {@link User}
*/
@Nonnull
public UserSnowflake getUserId()
public User getUser()
{
return userId;
return user;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1985,15 +1985,15 @@ public Message.InteractionMetadata createMessageInteractionMetadata(DataObject c
{
final long id = content.getLong("id");
final int type = content.getInt("type");
final long userId = content.getLong("user_id");
final User user = createUser(content.getObject("user"));
final IntegrationOwners integrationOwners = new IntegrationOwnersImpl(content.getObject("authorizing_integration_owners"));
final Long originalResponseMessageId = content.isNull("original_response_message_id") ? null : content.getLong("original_response_message_id");
final Long interactedMessageId = content.isNull("interacted_message_id") ? null : content.getLong("interacted_message_id");
final Message.InteractionMetadata triggeringInteraction = content.optObject("triggering_interaction_metadata")
.map(this::createMessageInteractionMetadata)
.orElse(null);

return new Message.InteractionMetadata(id, type, UserSnowflake.fromId(userId), integrationOwners, originalResponseMessageId, interactedMessageId, triggeringInteraction);
return new Message.InteractionMetadata(id, type, user, integrationOwners, originalResponseMessageId, interactedMessageId, triggeringInteraction);
}

@Nullable
Expand Down

0 comments on commit d2d8463

Please sign in to comment.