From 021803a951c83b452e39183d1c44e37e7f90d01e Mon Sep 17 00:00:00 2001 From: Fluffyscratch Date: Sat, 5 Sep 2026 16:39:10 +0200 Subject: [PATCH 1/4] fix typos in config.py --- config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index 7952dc5..e2696b9 100644 --- a/config.py +++ b/config.py @@ -25,14 +25,14 @@ ] ) -# The bot's theme colours (plain hex integers — interactions.py accepts these directly) +# The bot's theme colours scratch_orange = 0xF6AB3C scratch_gold = 0xFFBE00 scratch_blue = 0x4E97FE # Embed for experimental commands betaembed = interactions.Embed( - title="Sorry, this command is still in beta ! You cannot use it yet.", + title="Sorry, this command is still in beta! You cannot use it yet.", color=0xFF0000, ) From 19722fe4e9d217b91e83e9e47aa88f233d92dab5 Mon Sep 17 00:00:00 2001 From: Fluffyscratch Date: Sat, 5 Sep 2026 16:55:33 +0200 Subject: [PATCH 2/4] implement command limits to avoid crashes --- commands/project_commands.py | 1 + commands/search_commands.py | 1 + commands/user_commands.py | 27 ++++++++++++++++++++------- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/commands/project_commands.py b/commands/project_commands.py index addbc13..b4eab12 100644 --- a/commands/project_commands.py +++ b/commands/project_commands.py @@ -172,6 +172,7 @@ async def trendscore(self, ctx: interactions.SlashContext, project: str): description="How many trending projects to check", opt_type=interactions.OptionType.INTEGER, required=True, + max_value=520, ) async def ontrend( self, diff --git a/commands/search_commands.py b/commands/search_commands.py index 3b4ad36..fde8bf4 100644 --- a/commands/search_commands.py +++ b/commands/search_commands.py @@ -25,6 +25,7 @@ class SearchCommands(interactions.Extension): description="How many random projects to return", opt_type=interactions.OptionType.INTEGER, required=True, + max_value=20, ) async def randomprojects(self, ctx: interactions.SlashContext, number: int): await ctx.defer() diff --git a/commands/user_commands.py b/commands/user_commands.py index 67941cd..d83ae1c 100644 --- a/commands/user_commands.py +++ b/commands/user_commands.py @@ -253,6 +253,7 @@ async def mutualfollowers( msg = interactions.Embed() count = 0 desc = "" + limit_reached = False followers1 = scratch.get_user(user_1).follower_names( limit=int(scratch.get_user(user_1).follower_count()) @@ -265,6 +266,10 @@ async def mutualfollowers( if item in followers2: count += 1 desc = f"{desc}\n{item}" + if count > 100: + desc = f"{desc}\n**And more...**" + limit_reached = True + break if count == 0: await ctx.send( @@ -274,11 +279,18 @@ async def mutualfollowers( ) ) else: - msg.title = ( - f"<:together:1330551758166036500>" - f"{user_1} and {user_2} have {count} mutual followers" - f"<:together:1330551758166036500> :" - ) + if limit_reached: + msg.title = ( + f"<:together:1330551758166036500>" + f"{user_1} and {user_2} have over 100 mutual followers" + f"<:together:1330551758166036500> :" + ) + else: + msg.title = ( + f"<:together:1330551758166036500>" + f"{user_1} and {user_2} have {count} mutual followers" + f"<:together:1330551758166036500> :" + ) msg.description = desc msg.color = scratch_orange await ctx.send(embed=msg) @@ -296,10 +308,11 @@ async def mutualfollowers( @interactions.slash_option( name="limit", description="Number of activities to show", - opt_type=interactions.OptionType.STRING, + opt_type=interactions.OptionType.INTEGER, required=True, + max_value=50, ) - async def activity(self, ctx: interactions.SlashContext, user: str, limit: str): + async def activity(self, ctx: interactions.SlashContext, user: str, limit: int): await ctx.defer() msg = interactions.Embed( From b5ab84eb8af5e729c797da4f356ff06352f86e5b Mon Sep 17 00:00:00 2001 From: Fluffyscratch Date: Sun, 6 Sep 2026 11:31:51 +0200 Subject: [PATCH 3/4] Fix /mutualfollowers limit --- commands/user_commands.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/commands/user_commands.py b/commands/user_commands.py index d83ae1c..cf3ab69 100644 --- a/commands/user_commands.py +++ b/commands/user_commands.py @@ -256,20 +256,20 @@ async def mutualfollowers( limit_reached = False followers1 = scratch.get_user(user_1).follower_names( - limit=int(scratch.get_user(user_1).follower_count()) + limit=min(1000, int(scratch.get_user(user_1).follower_count())) ) followers2 = scratch.get_user(user_2).follower_names( - limit=int(scratch.get_user(user_2).follower_count()) + limit=min(1000, int(scratch.get_user(user_2).follower_count())) ) for item in followers1: if item in followers2: count += 1 - desc = f"{desc}\n{item}" - if count > 100: + if not limit_reached: + desc = f"{desc}\n{item}" + if count == 200: desc = f"{desc}\n**And more...**" limit_reached = True - break if count == 0: await ctx.send( @@ -279,10 +279,10 @@ async def mutualfollowers( ) ) else: - if limit_reached: + if len(followers1) > 1000 or len(followers2) > 1000: msg.title = ( f"<:together:1330551758166036500>" - f"{user_1} and {user_2} have over 100 mutual followers" + f"{user_1} and {user_2} have over {count} mutual followers" f"<:together:1330551758166036500> :" ) else: From 52f8f84ba8c7225433274ac968dfd10f96220d83 Mon Sep 17 00:00:00 2001 From: Fluffyscratch Date: Sun, 6 Sep 2026 11:46:06 +0200 Subject: [PATCH 4/4] Fix /mutualfollowers count not shown right when fetching limit is reached --- commands/user_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/user_commands.py b/commands/user_commands.py index cf3ab69..3c78a7f 100644 --- a/commands/user_commands.py +++ b/commands/user_commands.py @@ -279,7 +279,7 @@ async def mutualfollowers( ) ) else: - if len(followers1) > 1000 or len(followers2) > 1000: + if len(followers1) == 1000 or len(followers2) == 1000: msg.title = ( f"<:together:1330551758166036500>" f"{user_1} and {user_2} have over {count} mutual followers"