From 8400337b506d83e17cbc22c8a050d24c8ee03cb7 Mon Sep 17 00:00:00 2001 From: cyanogus <120003982+cyanogus@users.noreply.github.com> Date: Thu, 6 Apr 2023 12:21:36 +0530 Subject: [PATCH 1/4] Add section for isobot features documentation, and improve some grammar --- README.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2044e6d7..b18e32f8 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,17 @@ Isobot is a simple discord.py-based Python Discord bot made by the [NKA Development Team](https://github.com/PyBotDevs), to represent the original [Heckerbot](https://github.com/notsniped/heckerbot) in an even more efficient, fast, contributable, community-focused and enhanced way. -This open-source project was supposed to represent what the next-generation of Heckerbot will look like, and here it is in full-swing. - -## Why a new project? -At that time, I wanted to make brand new, cutting-edge features for the old isobot codebase. But in the process, I ran into some codeblocks which prevented me from doing so efficiently. This is why I decided to completely rewrite isobot as codename 'lazer' which is meant to be more future-proof. And it sure was. +This open-source project was supposed to represent what the next-generation of Heckerbot will look like, and here it is in full-swing, since 2020. + +## Why isobot? +We think isobot can help a multi-purpose economy Discord bot for your server. Apart from the economy system, you also get features for +* moderation +* levelling +* automod +* server verification (soon) +* maths commands +* fun commands +* and reddit media commands ## How can I help? ***PLEASE SUBMIT ISSUES AND PULL REQUESTS TO THE REPOSITORY!*** It helps us make our work easier c: From 5e5f11fe272bcae5a9a44d6e4bf5cc8f89b88fa9 Mon Sep 17 00:00:00 2001 From: Sabi <120003982+cyanogus@users.noreply.github.com> Date: Thu, 6 Apr 2023 12:46:22 +0530 Subject: [PATCH 2/4] Add level ranking `/leaderboard` for top 10 users --- cogs/levelling.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/cogs/levelling.py b/cogs/levelling.py index 31410db2..9a384e93 100644 --- a/cogs/levelling.py +++ b/cogs/levelling.py @@ -69,5 +69,34 @@ async def edit_xp(self, ctx: ApplicationContext, user:discord.User, new_xp:int): await ctx.respond(f"{user.display_name}\'s XP count successfully edited. `New XP: {levels[str(user.id)]['xp']}`") except KeyError: return await ctx.respond("That user isn't indexed yet.", ephemeral=True) +@special_event.command( + name="leaderboard", + description="View the global leaderboard for the special in-game event." +) +async def leaderboard(ctx: ApplicationContext): + levels_dict = dict() + for person in levels: + levels_dict[str(person)] = levels[str(person)]["level"] + undicted_leaderboard = sorted(levels_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 < 10: + try: + if levels_dict[i] != 0: + user_context = await client.fetch_user(i) + if not user_context.bot and levels_dict[i] != 0: + print(i, levels_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}:** level {levels_dict[i]}\n" + y += 1 + except discord.errors.NotFound: continue + localembed = discord.Embed(title="Global levelling leaderboard", description=parsed_output, color=color) + await ctx.respond(embed=localembed) + def setup(bot): bot.add_cog(Levelling(bot)) From df4206c9c1225b96a7791fbb4bdc29f897c98b74 Mon Sep 17 00:00:00 2001 From: Sabi <120003982+cyanogus@users.noreply.github.com> Date: Thu, 6 Apr 2023 12:48:59 +0530 Subject: [PATCH 3/4] Add `/leaderboard` command to commands db --- config/commands.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/config/commands.json b/config/commands.json index 97a6e4fc..3f77d03f 100644 --- a/config/commands.json +++ b/config/commands.json @@ -639,4 +639,15 @@ "disabled": false, "bugged": false } + , + "leaderboard": { + "name": "Levelling Leaderboard", + "description": "See the global leaderboard for user levels.", + "type": "levelling", + "cooldown": null, + "args": null, + "usable_by": "everyone", + "disabled": false, + "bugged": false + } } From ab56dcd687c396f3dc8c0c5ebbb898d204befc9e Mon Sep 17 00:00:00 2001 From: Sabi <120003982+cyanogus@users.noreply.github.com> Date: Thu, 6 Apr 2023 12:50:21 +0530 Subject: [PATCH 4/4] Fix command description for `/leaderboard` --- cogs/levelling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/levelling.py b/cogs/levelling.py index 9a384e93..1ec8bad1 100644 --- a/cogs/levelling.py +++ b/cogs/levelling.py @@ -71,7 +71,7 @@ async def edit_xp(self, ctx: ApplicationContext, user:discord.User, new_xp:int): @special_event.command( name="leaderboard", - description="View the global leaderboard for the special in-game event." + description="View the global leaderboard for user levelling ranks." ) async def leaderboard(ctx: ApplicationContext): levels_dict = dict()