feat(bot): ✨ Dynamically change the leaderboard's description text.
This commit is contained in:
@@ -483,15 +483,18 @@ class Users(base.Cog):
|
|||||||
users_board_options = ["u", "user", "users"]
|
users_board_options = ["u", "user", "users"]
|
||||||
server_board_options = ["s", "server", "servers", "g", "guild", "guilds"]
|
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(
|
await ctx.send(
|
||||||
f"❌ This leaderboard does not exist. The leaderboards are `servers` and `users`, for example `{ctx.clean_prefix}leaderboard users`."
|
f"❌ This leaderboard does not exist. The leaderboards are `servers` and `users`, for example `{ctx.clean_prefix}leaderboard users`."
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
table = ""
|
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 = (
|
top_users = (
|
||||||
await models.User.filter(leaderboard_position__lte=10)
|
await models.User.filter(leaderboard_position__lte=10)
|
||||||
.prefetch_related("profiles")
|
.prefetch_related("profiles")
|
||||||
@@ -522,9 +525,8 @@ class Users(base.Cog):
|
|||||||
color=constants.EMBED_COLOR,
|
color=constants.EMBED_COLOR,
|
||||||
title=f"Monthly Leaderboard ({datetime.now(timezone.utc).strftime("%B")})",
|
title=f"Monthly Leaderboard ({datetime.now(timezone.utc).strftime("%B")})",
|
||||||
description=(
|
description=(
|
||||||
"Payphone's monthly leaderboard is based on the amount of calls you've "
|
f"Payphone's monthly leaderboard is based on the amount of calls {table_name} "
|
||||||
"participated in with more than 25 messages sent (to prevent spam).\n"
|
"have participated in with more than 25 messages sent (to prevent spam).\n\n"
|
||||||
"\n"
|
|
||||||
)
|
)
|
||||||
+ table,
|
+ table,
|
||||||
author=self.bot.embed_author,
|
author=self.bot.embed_author,
|
||||||
|
|||||||
Reference in New Issue
Block a user