package cc.fascinated.bat.model; import cc.fascinated.bat.common.ProfileHolder; import cc.fascinated.bat.features.namehistory.profile.user.NameHistoryProfile; import cc.fascinated.bat.features.scoresaber.profile.user.ScoreSaberProfile; import cc.fascinated.bat.service.DiscordService; import lombok.Getter; import lombok.NonNull; import lombok.RequiredArgsConstructor; import lombok.Setter; import net.dv8tion.jda.api.entities.User; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; import java.util.Date; /** * @author Fascinated (fascinated7) */ @RequiredArgsConstructor @Getter @Setter @Document(collection = "users") public class BatUser extends ProfileHolder { /** * The ID of the user */ @NonNull @Id private final String id; /** * The time this user was created */ private Date createdAt = new Date(); /** * The name of the user */ public String getName() { return getDiscordUser().getEffectiveName(); } /** * Gets the guild as the JDA Guild * * @return the guild */ public User getDiscordUser() { return DiscordService.JDA.getUserById(id); } /** * Gets the user's ScoreSaber profile * * @return the user's ScoreSaber profile */ public ScoreSaberProfile getScoreSaberProfile() { return getProfile(ScoreSaberProfile.class); } /** * Gets the user's name history profile * * @return the user's name history profile */ public NameHistoryProfile getNameHistoryProfile() { return getProfile(NameHistoryProfile.class); } }