Skip to content
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
1 change: 1 addition & 0 deletions commands/project_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions commands/search_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
33 changes: 23 additions & 10 deletions commands/user_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
Expand All @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down
Loading