Skip to content

Commit

Permalink
Merge pull request #480 from silvanathecat/master
Browse files Browse the repository at this point in the history
Updated levels to mention the user in the leaderboard rather than link to their profile.
  • Loading branch information
tweirtx authored Dec 26, 2024
2 parents 294a2d0 + 06465a9 commit b373400
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# -- Project information -----------------------------------------------------

project = 'Dozer'
copyright = '2021, Dozer Development Team'
copyright = '2024, Dozer Development Team'
author = 'Dozer Development Team'

# -- General configuration ---------------------------------------------------
Expand Down
8 changes: 3 additions & 5 deletions dozer/cogs/levels.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,8 @@ def _ensure_sync_running(self):
def _fmt_member(self, guild: discord.Guild, user_id: int):
member = guild.get_member(user_id)
if member:
if member.status == discord.Status.offline:
return f"[{escape_markdown(member.display_name)}](https://discordapp.com/users/{member.id})"
else:
return str(member.mention) # This only works if presence intents are enabled
return f"{escape_markdown(member.display_name)} {(member.mention)}"

else: # Still try to see if the bot can find the user to get their name
user = self.bot.get_user(user_id)
if user:
Expand Down Expand Up @@ -719,7 +717,7 @@ async def levels(self, ctx: DozerContext, start: typing.Optional[discord.Member]
embeds = []
for page_num, page in enumerate(chunk(records, 10)):
embed = discord.Embed(title=f"Rankings for {ctx.guild}", color=discord.Color.blue())
embed.description = '\n'.join(f"#{rank}: {(self._fmt_member(ctx.guild, user_id))}"
embed.description = '\n'.join(f"#{rank}: {(self._fmt_member(ctx.guild, user_id))} |"
f" (lvl {self.level_for_total_xp(total_xp)}, {total_xp} XP)"
for (user_id, total_xp, rank) in page)
embed.set_footer(text=f"Page {page_num + 1} of {math.ceil(len(records) / 10)}")
Expand Down

0 comments on commit b373400

Please sign in to comment.