I'm looking for a method to estimate of a server member's original join date.
The problem with just getting member.joined_at is that if a member leaves and rejoins, it resets this date. So the best alternative seems to be getting the date of the oldest message sent by a member.
However, member.history(limit=1, oldest_first=True) seems to just return the oldest message in the member's DM.
Is there any way in the api to find a member's oldest message in a server? This seems to be something only available to users via the search bar.
Unfortunately discord is channel-based - which mean, you have to search for messages in a certain channel such as DMChannel or a TextChannel.
In this case you will need to loop over all visible TextChannel in your server and do a search since the beginning of the channel, which is resourcefully costly.
Discord API does not allow you to search via its search functionalities so that will be your only way. I believe bigger bot simply has a database that store the first time it sees someone joins the server to avoid this problem altogether.
discord.py find first message of a member in a guild