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..3c78a7f 100644 --- a/commands/user_commands.py +++ b/commands/user_commands.py @@ -253,18 +253,23 @@ 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()) + 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 not limit_reached: + desc = f"{desc}\n{item}" + if count == 200: + desc = f"{desc}\n**And more...**" + limit_reached = True 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 len(followers1) == 1000 or len(followers2) == 1000: + msg.title = ( + f"<:together:1330551758166036500>" + f"{user_1} and {user_2} have over {count} 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( 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, )