Skip to content

Add chall solves #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Add chall solves #52

wants to merge 5 commits into from

Conversation

F1OOw
Copy link

@F1OOw F1OOw commented Jun 21, 2025

Created "/ctf showsolvers" command.
Optional option: name

Description:

  • This command shows the list of the teams that solved a particular challenge.
  • If the option name is provided, it will be used to set the challenge.
  • Else if the command is run from a thread of a certain challenge, that will be the one to be selected.

Comment on lines 1435 to 1439
embed.add_field(
name=name,
value=f"{time_since(solver.solved_at)}",
inline=False,
)
Copy link
Owner

@hfz1337 hfz1337 Jun 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of introducing a new helper function for this, it would be cleaner and more efficient to use Discord's built-in relative timestamp format (<t:${timestamp}:R>). It automatically shows the relative time and updates in real time, so there's no need to handle that manually.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -37,6 +38,7 @@
get_ctf_info,
sanitize_channel_name,
strip_url_components,
time_since,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
time_since,

Comment on lines +1358 to +1360
"""
Show the list of solvers for the provided/current challenge.
"""
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""
Show the list of solvers for the provided/current challenge.
"""
"""Show the list of solvers for a given challenge.
Args:
interaction: The interaction that triggered this command.
name: The challenge name (default: current thread's challenge).
"""

Comment on lines +1362 to +1384
async def followup(content: str, ephemeral=True, **kwargs) -> None:
if not interaction:
return
await interaction.followup.send(content, ephemeral=ephemeral, **kwargs)

await interaction.response.defer()

if name is None:
challenge = get_challenge_info(thread=interaction.channel_id)
if challenge is None:
await followup(
(
"Run this command from within a challenge thread, "
"or provide the name of the challenge you wish to stop "
"working on."
)
)
return
else:
challenge = get_challenge_info(name=name)
if challenge is None:
await followup("No such challenge.")
return
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The followup function is not needed since interaction will never be None.

return

solvers = []

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change


embed = None
num_fields = 0

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment on lines +1413 to +1414
# If we reached Discord's maximum number of fields per
# embed, we send the previous one and create a new one.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maximum line length in this project is 88 chars

Suggested change
# If we reached Discord's maximum number of fields per
# embed, we send the previous one and create a new one.
# If we reached Discord's maximum number of fields per embed, we send the
# previous one and create a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants