[AB-11] fixing still considering bots when calculating the star amount

fixes #11
This commit is contained in:
Sheldan
2022-06-21 00:15:47 +02:00
parent 74cee39f1a
commit 1a1fde0800
18 changed files with 88 additions and 17 deletions

View File

@@ -16,6 +16,7 @@ import java.io.Serializable;
public class ServerUser implements Serializable {
private Long serverId;
private Long userId;
private Boolean isBot;
public static ServerUser fromAUserInAServer(AUserInAServer aUserInAServer) {
return ServerUser
@@ -29,6 +30,7 @@ public class ServerUser implements Serializable {
.builder()
.serverId(member.getGuild().getIdLong())
.userId(member.getIdLong())
.isBot(member.getUser().isBot())
.build();
}
}

View File

@@ -31,6 +31,10 @@ public class CachedMessage implements Serializable {
}
public ServerUser getAuthorAsServerUser() {
return ServerUser.builder().serverId(serverId).userId(author.getAuthorId()).build();
return ServerUser
.builder()
.serverId(serverId)
.userId(author.getAuthorId())
.build();
}
}

View File

@@ -18,7 +18,16 @@ public class CachedReactions implements Serializable {
private List<ServerUser> users;
public CachedReaction getReactionForSpecificUser(ServerUser serverUser) {
ServerUser matchingUser = users.stream().filter(serverUser1 -> serverUser1.equals(serverUser)).findAny().orElseThrow(() -> new AbstractoRunTimeException("Server user not found."));
return CachedReaction.builder().self(self).emote(emote).user(matchingUser).build();
ServerUser matchingUser = users
.stream()
.filter(serverUser1 -> serverUser1.equals(serverUser))
.findAny()
.orElseThrow(() -> new AbstractoRunTimeException("Server user not found."));
return CachedReaction
.builder()
.self(self)
.emote(emote)
.user(matchingUser)
.build();
}
}