discord.py - mention through ID doesn't show name

957 Views Asked by At

I'm using rewrite and gspread to update a 'top 16' leaderboard by storing the user ID and score. The formula to create/update the leaderboard places the ID of a user in a cell by referencing their position depending on their score. So each cell is structured like so:

 1st place: <"@230579325375837234">

I'm then pulling the entire column out to edit an existing embed:

lb = sheet13.col_values(9)

This all works fine - my issue is that the edited embed does not always convert the ID to a name. Some are converted to names and others are mentioned versions of the ID, opposed to mentioning the username. Leading to an embed that looks like:

 1st place: @adisplayname
 2st place: <@230579325375837234>
 3rd place: @anotherdisplayname
 4th place: <@573856332907428873>
 5th place: <@230579325375837234>
 6th place: @thirddisplayname

Is there a way to assure that user/display_names are mentioned, and not the IDs?

I'm thinking of pulling the individual cells that are used to update the embed rather than the entire column and defining them as individual variables to mention the user by display_name; rather than trying to mention the raw ID itself, although I'm not sure this solution is the cleanest?

1

There are 1 best solutions below

0
On

Thanks to derw, I ran a whois command to check that the members were definitely in the server and the reply included an ! in front of the ID. This appears to have fixed my issue.

1st place: <@!23057932537583723>

All mentions are now working :)