Update minimum credits threshold in Leaderboard cog from 10,000 to 500, adjusting related error messages and embed descriptions for improved user accessibility and experience.
Some checks are pending
Run pre-commit / Run pre-commit (push) Waiting to run
Some checks are pending
Run pre-commit / Run pre-commit (push) Waiting to run
This commit is contained in:
parent
749f0df17c
commit
f1c5eef019
1 changed files with 6 additions and 6 deletions
|
@ -119,7 +119,7 @@ class Leaderboard(commands.Cog):
|
||||||
async def get_all_balances(self) -> List[dict]:
|
async def get_all_balances(self) -> List[dict]:
|
||||||
"""Get all users' credit balances across all servers."""
|
"""Get all users' credit balances across all servers."""
|
||||||
all_users = {}
|
all_users = {}
|
||||||
min_credits = 10000 # Minimum credits to show on leaderboard
|
min_credits = 500 # Minimum credits to show on leaderboard
|
||||||
|
|
||||||
# Collect all unique members and sum their balances across all guilds
|
# Collect all unique members and sum their balances across all guilds
|
||||||
for guild in self.bot.guilds:
|
for guild in self.bot.guilds:
|
||||||
|
@ -194,20 +194,20 @@ class Leaderboard(commands.Cog):
|
||||||
leaderboard_data = await self.get_all_balances()
|
leaderboard_data = await self.get_all_balances()
|
||||||
|
|
||||||
if not leaderboard_data:
|
if not leaderboard_data:
|
||||||
return await ctx.send("No users have 10,000 or more credits!")
|
return await ctx.send("No users have 500 or more credits!")
|
||||||
|
|
||||||
items_per_page = 10
|
items_per_page = 10
|
||||||
chunks = [leaderboard_data[i:i + items_per_page]
|
chunks = [leaderboard_data[i:i + items_per_page]
|
||||||
for i in range(0, len(leaderboard_data), items_per_page)]
|
for i in range(0, len(leaderboard_data), items_per_page)]
|
||||||
|
|
||||||
if not chunks:
|
if not chunks:
|
||||||
return await ctx.send("No users have 10,000 or more credits!")
|
return await ctx.send("No users have 500 or more credits!")
|
||||||
|
|
||||||
embeds = []
|
embeds = []
|
||||||
for page_num, entries in enumerate(chunks, 1):
|
for page_num, entries in enumerate(chunks, 1):
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title="🏆 Global Credits Leaderboard",
|
title="🏆 Global Credits Leaderboard",
|
||||||
description="*Only showing users with 10,000+ credits*",
|
description="*Only showing users with 500+ credits*",
|
||||||
color=await ctx.embed_color()
|
color=await ctx.embed_color()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ class Leaderboard(commands.Cog):
|
||||||
color=await ctx.embed_color()
|
color=await ctx.embed_color()
|
||||||
)
|
)
|
||||||
|
|
||||||
if credits >= 10000:
|
if credits >= 500:
|
||||||
embed.description = (
|
embed.description = (
|
||||||
f"**User:** <@{member.id}>\n"
|
f"**User:** <@{member.id}>\n"
|
||||||
f"**Credits:** {humanize_number(credits)}\n"
|
f"**Credits:** {humanize_number(credits)}\n"
|
||||||
|
@ -292,7 +292,7 @@ class Leaderboard(commands.Cog):
|
||||||
f"**ID:** {member.id}"
|
f"**ID:** {member.id}"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
embed.description = f"<@{member.id}> has less than 10,000 credits."
|
embed.description = f"<@{member.id}> has less than 500 credits."
|
||||||
|
|
||||||
embed.set_thumbnail(url=member.display_avatar.url)
|
embed.set_thumbnail(url=member.display_avatar.url)
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
Loading…
Add table
Reference in a new issue