Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions cogs/economy.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,35 @@ async def balance(self, ctx: ApplicationContext, user=None):
async def treasury(self, ctx: ApplicationContext):
localembed = discord.Embed(description="There are currently {currency['treasury']} coins in the isobot treasury.")
await ctx.respond(embed=localembed)

@commands.slash_command(
name="leaderboard_nw",
description="View the global leaderboard for net worth."
)
async def leaderboard_nw(self, ctx: ApplicationContext):
nw_dict = dict()
for person in currency:
nw_dict[str(person)] = int(currency["wallet"][str(person)]) + int(currency["bank"][str(person)])
undicted_leaderboard = sorted(nw_dict.items(), key=lambda x:x[1], reverse=True)
dicted_leaderboard = dict(undicted_leaderboard)
parsed_output = str()
y = 1
for i in dicted_leaderboard:
if y < 5:
try:
if nw_dict[i] != 0:
user_context = await commands.fetch_user(i)
if not user_context.bot:
print(i, nw_dict[i])
if y == 1: yf = ":first_place:"
elif y == 2: yf = ":second_place:"
elif y == 3: yf = ":third_place:"
else: yf = f"#{y}"
parsed_output += f"{yf} **{user_context.name}:** {nw_dict[i]} coins\n"
y += 1
except discord.errors.NotFound: continue
localembed = discord.Embed(title="Global net worth leaderboard", description=parsed_output, color=color)
await ctx.respond(embed=localembed)

# Initialization
def setup(bot):
Expand Down
4 changes: 2 additions & 2 deletions cogs/levelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ async def edit_xp(self, ctx: ApplicationContext, user:discord.User, new_xp:int):
except KeyError: return await ctx.respond("That user isn't indexed yet.", ephemeral=True)

@commands.slash_command(
name="leaderboard",
name="leaderboard_levels",
description="View the global leaderboard for user levelling ranks."
)
async def leaderboard(self, ctx: ApplicationContext):
async def leaderboard_levels(self, ctx: ApplicationContext):
levels_dict = dict()
for person in levels:
levels_dict[str(person)] = levels[str(person)]["level"]
Expand Down
15 changes: 12 additions & 3 deletions config/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,8 @@
"usable_by": "everyone",
"disabled": false,
"bugged": false
}
,
"leaderboard": {
},
"leaderboard_levels": {
"name": "Levelling Leaderboard",
"description": "See the global leaderboard for user levels.",
"type": "levelling",
Expand All @@ -649,5 +648,15 @@
"usable_by": "everyone",
"disabled": false,
"bugged": false
},
"leaderboard_nw": {
"name": "Net Worth Leaderboard",
"description": "See the global leaderboard for user net worth.",
"type": "economy",
"cooldown": null,
"args": null,
"usable_by": "everyone",
"disabled": false,
"bugged": false
}
}
18 changes: 9 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ class plugins:
# isobank = framework.isobank.manager.IsoBankManager(f"{wdir}/database/isobank/accounts.json", f"{wdir}/database/isobank/auth.json")
isobankauth = framework.isobank.authorize.IsobankAuth(f"{wdir}/database/isobank/auth.json", f"{wdir}/database/isobank/accounts.json")

#Theme Loader
with open("themes/halloween.theme.json", 'r', encoding="utf-8") as f:
theme = json.load(f)
try:
color_loaded = theme["theme"]["embed_color"]
color = int(color_loaded, 16)
except KeyError:
print(f"{colors.red}The theme file being loaded might be broken. Rolling back to default configuration...{colors.end}")
color = discord.Color.random()
# Theme Loader
#with open("themes/halloween.theme.json", 'r', encoding="utf-8") as f:
# theme = json.load(f)
# try:
# color_loaded = theme["theme"]["embed_color"]
# color = int(color_loaded, 16)
# except KeyError:
# print(f"{colors.red}The theme file being loaded might be broken. Rolling back to default configuration...{colors.end}")
# color = discord.Color.random()

#Events
@client.event
Expand Down