Skip to content
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

Add restart command #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add restart command #13

wants to merge 1 commit into from

Conversation

ViRb3
Copy link
Contributor

@ViRb3 ViRb3 commented Aug 24, 2023

For when the bot glitches out...

@lucidBrot
Copy link
Member

What can be fixed with this that can not be fixed otherwise?
I'm not opposed, just curious.

@ViRb3
Copy link
Contributor Author

ViRb3 commented Aug 30, 2023

I only ever had the bot "glitch out" once, here are the logs:

AttributeError: 'dict' object has no attribute 'id'
ERROR:discord_slash:An exception has occurred while executing command `chal`:
Traceback (most recent call last):
  File "/root/.cache/pypoetry/virtualenvs/organizers-bot-9TtSrW0h-py3.11/lib/python3.11/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.11/lib/python3.11/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 90, in create_challenge_channel
    await ctfnote.add_task(ctx, created, challenge, category, solved_prefix = "✓-", ctfid = ctfid)
  File "/app/organizers_bot/ctfnote.py", line 564, in add_task
    f"<{config.ctfnote.url}#/ctf/{current_ctf.id}-{slugify(current_ctf.name)}/task/{result.id}-{slugify(result.title)}>"

I never figured out what exactly was wrong, but a restart fixed it. This PR is just in case the bot operator is not available and the players need a quick fix.

@RobinJadoul
Copy link
Member

The glitch may have been when the ctfnote was down or some other issue happened with it, this might already be mitigated more due to some later changes that properly disable the integration

I don't expect just exit(1) will properly restart this, the way we're running it, there's no auto-restart happening atm, since the discord library makes sure everything stays alive.
I furthermore don't really think it would fully resolve underlying issues much more than the regular error handling.

For bot operator being afk, right now several people should have access to the bot server, if they remember they do. (iirc it's me, cyanpencil, nspace and spittfire).

@RobinJadoul
Copy link
Member

If anything, probably the config reload as suggested in #12 could be more useful

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.

3 participants