From debb242c35ec8df85dae73592d9fe214b71545c9 Mon Sep 17 00:00:00 2001 From: "Nyeki.py" <84998222+Nekidev@users.noreply.github.com> Date: Sat, 19 Oct 2024 00:49:52 -0300 Subject: [PATCH] feat(bot): :sparkles: Dynamically change the leaderboard's description text. --- payphone/cogs/users/cog.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/payphone/cogs/users/cog.py b/payphone/cogs/users/cog.py index 48019aa..f00425e 100644 --- a/payphone/cogs/users/cog.py +++ b/payphone/cogs/users/cog.py @@ -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,