I need to check if the account is new when interacting with the bot.
I was able to get information about the time the user joined the guild, but this information is not enough.
member.getJoinTime();
I tried to get the user object, but I didn't find any suitable methods.
Discord uses snowflakes for IDs that contain information about the timestamp meaning the timestamp of the ID can be extracted from anything that has an ID.
In Discord4j, you can use User#getId
to get the ID from the member as a Snowflake
object. You can then use the Snowflake#getTimestamp
method to convert it to an Instant
representing the timestamp.
Member member = ...;
Instant accountCreationTimestamp = member.getId().getTimestamp();
OffsetDateTime accountCreationDateTime = accountCreationTimestamp.atOffset(ZoneOffset.UTC);