2024-06-25 11:55:26 +01:00
|
|
|
package cc.fascinated.bat.model;
|
2024-06-24 13:56:01 +01:00
|
|
|
|
2024-06-25 12:36:40 +01:00
|
|
|
import cc.fascinated.bat.common.ProfileHolder;
|
2024-06-24 13:56:01 +01:00
|
|
|
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;
|
|
|
|
|
2024-06-25 15:43:36 +01:00
|
|
|
import java.util.Date;
|
2024-06-24 13:56:01 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Fascinated (fascinated7)
|
|
|
|
*/
|
|
|
|
@RequiredArgsConstructor
|
2024-06-28 03:01:21 +01:00
|
|
|
@Getter
|
|
|
|
@Setter
|
2024-06-24 13:56:01 +01:00
|
|
|
@Document(collection = "users")
|
2024-06-27 13:02:55 +01:00
|
|
|
public class BatUser extends ProfileHolder {
|
2024-06-24 13:56:01 +01:00
|
|
|
/**
|
|
|
|
* The ID of the user
|
|
|
|
*/
|
2024-06-28 03:01:21 +01:00
|
|
|
@NonNull
|
|
|
|
@Id
|
|
|
|
private final String id;
|
2024-06-24 13:56:01 +01:00
|
|
|
|
2024-06-25 15:43:36 +01:00
|
|
|
/**
|
|
|
|
* The time this user was created
|
|
|
|
*/
|
|
|
|
private Date createdAt = new Date();
|
|
|
|
|
2024-06-28 03:01:21 +01:00
|
|
|
/**
|
|
|
|
* The name of the user
|
|
|
|
*/
|
|
|
|
public String getName() {
|
|
|
|
return getDiscordUser().getName();
|
|
|
|
}
|
|
|
|
|
2024-06-24 13:56:01 +01:00
|
|
|
/**
|
|
|
|
* Gets the guild as the JDA Guild
|
|
|
|
*
|
|
|
|
* @return the guild
|
|
|
|
*/
|
2024-06-24 14:58:57 +01:00
|
|
|
public User getDiscordUser() {
|
2024-06-24 13:56:01 +01:00
|
|
|
return DiscordService.JDA.getUserById(id);
|
|
|
|
}
|
|
|
|
}
|