Do not follow this link

~robin_jadoul/organizers-bot

Merge pull request #8 from 0rganizers/feature/stats

Add stats command
Bump some dependencies
Enable ctfnote registration even without active ctf
dd8ef638 — Leonardo Galli 2 years ago
Add stats command (only semi tested lol)
8c038895 — Matteo Rizzo 2 years ago
Don't recreate the S3 client for every file
7aa82e44 — Matteo Rizzo 2 years ago
Don't use a persistent client for S3 (fixes broken exports)
5d52660a — LucidBrot 2 years ago
Replace datetime with dateutil for isostring parsing of datetime.

I tested my changes, had a few typos but now everything seems to run solidly. However, I got this
```
RROR:discord_slash:An exception has occurred while executing command `chal`:
Traceback (most recent call last):
  File "/root/.cache/pypoetry/virtualenvs/organizers-bot-9TtSrW0h-py3.9/lib/python3.9/site-packages/discord_slash/client.py", line 872, in invoke_command
    await func.invoke(ctx, args)
  File "/root/.cache/pypoetry/virtualenvs/organizers-bot-9TtSrW0h-py3.9/lib/python3.9/site-packages/discord_slash/model.py", line 168, in invoke
    return await coro
  File "/app/organizers_bot/bot.py", line 31, in wrapper
    return await f(ctx, *args, **kw)
  File "/app/organizers_bot/bot.py", line 88, in create_challenge_channel
    await ctfnote.add_task(ctx, created, challenge, category, solved_prefix = "✓-", ctfid = ctfid)
  File "/app/organizers_bot/ctfnote.py", line 592, in add_task
    current_ctf = await refresh_ctf(ctx, ctfid = ctfid)
  File "/app/organizers_bot/ctfnote.py", line 516, in refresh_ctf
    current_ctfs = await ctfnote.getActiveCtfs()
  File "/app/organizers_bot/ctfnote.py", line 438, in getActiveCtfs
    ctfs = list(filter(lambda ctf:
  File "/app/organizers_bot/ctfnote.py", line 439, in <lambda>
    datetime.fromisoformat(ctf["startTime"]) < now and
ValueError: Invalid isoformat string: '2022-07-04T17:44:11.17+00:00'

```
and I'm not sure why that would happen. Because the string looks to me like it matches the format they specify in https://docs.python.org/3.9/library/datetime.html#datetime.datetime.fromisoformat

But the docs say
> A more full-featured ISO 8601 parser, dateutil.parser.isoparse is available in the third-party package dateutil.
So I'm replacing that code with this.
7ddfa0a8 — LucidBrot 2 years ago
Fix Typos. Tested:

assigning player to chall creates ctfnote account if not yet exists. If exists, no creation happens. The creation message is now hidden if the user assigned themselves - so only they see it.

Spaces, Dashes, Caps, in challenge names used to be a problem because discord channels don't have these. So the channel name does not map directly to the ctfnote name. Fixed by saving the ctfnote ctfid in the pinned message and using that as an identifier instead.

When there is exactly one current ctf, it is used (if there is no pinned message or optional argument overriding that choice). When there are multiple, none are used and the fixup command has to be used with the optional argument.

Users can now register themselves on ctfnote with a command and get a hidden response. The password can be specified or autogenerated. Both code paths tested.
87053d4e — LucidBrot 2 years ago
untested: a command to register more easily to ctfnote - no more preshared secret required for people with the CTFPlayer role
fbe97728 — LucidBrot 2 years ago
Hide password of created ctfnote account when a user assigns himself
3a593f82 — LucidBrot 2 years ago
Hopefully, this fixes the issue that some challenges were not found with /solved and /assign.

We now use the pinned message to retrieve the challenge id instead of filtering by name and hoping the channel name matches the ctfnote task name.
f015ce5e — LucidBrot 2 years ago
Hopefully, this fixes the issue we had that the bot did not automatically choose the only active CTF
a56f27bd — LucidBrot 2 years ago
better messages
ad9e7f51 — LucidBrot 2 years ago
minor description improvement
40f080ad — LucidBrot 2 years ago
the Fixup command
dc35159f — LucidBrot 2 years ago
this is working pretty robustly
cd3ef052 — LucidBrot 2 years ago
that's enough for today
7a471269 — LucidBrot 2 years ago
upgrade dependencies

this fixes the command-double-called bug.

also, importing a ctftime ctf is almost working... I am just not receiving the query reply like I want to
7045e2a3 — LucidBrot 2 years ago
change a few interactions to be clearer / less clutter
Next
Do not follow this link