feat(bot): ✨ Dynamically change the leaderboard's description text.

This commit is contained in:
Nyeki.py
2024-10-19 00:49:52 -03:00
parent b06db39074
commit debb242c35
+7 -5
View File
@@ -483,15 +483,18 @@ class Users(base.Cog):
users_board_options = ["u", "user", "users"]
server_board_options = ["s", "server", "servers", "g", "guild", "guilds"]
if board.lower() not in users_board_options + server_board_options:
board = board.lower()
if board not in users_board_options + server_board_options:
await ctx.send(
f"❌ This leaderboard does not exist. The leaderboards are `servers` and `users`, for example `{ctx.clean_prefix}leaderboard users`."
)
return
table = ""
table_name = "users" if board in users_board_options else "servers"
if board.lower() in users_board_options:
if board in users_board_options:
top_users = (
await models.User.filter(leaderboard_position__lte=10)
.prefetch_related("profiles")
@@ -522,9 +525,8 @@ class Users(base.Cog):
color=constants.EMBED_COLOR,
title=f"Monthly Leaderboard ({datetime.now(timezone.utc).strftime("%B")})",
description=(
"Payphone's monthly leaderboard is based on the amount of calls you've "
"participated in with more than 25 messages sent (to prevent spam).\n"
"\n"
f"Payphone's monthly leaderboard is based on the amount of calls {table_name} "
"have participated in with more than 25 messages sent (to prevent spam).\n\n"
)
+ table,
author=self.bot.embed_author,