iScsc / RootPythia

A Root-Me discord bot to notify on new solves, display charts...

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Root-pythia bot misses a `help` command

FireFrozen94 opened this issue · comments

here's the logs :

2023-06-14 16:34:02 INFO     discord.client logging in using static token
2023-06-14 16:34:03 INFO     discord.gateway Shard ID None has connected to Gateway (Session ID: b2f534bb9df48eb4c670f3d6cbd32209).
2023-06-14 16:34:05 INFO     api.rate_limiter Starting rate_limiter task...
2023-06-14 16:34:06 INFO     bot.root_pythia_cogs Checking for new solves...
2023-06-14 16:34:16 INFO     bot.root_pythia_cogs Checking for new solves...
2023-06-14 16:34:26 INFO     bot.root_pythia_cogs Checking for new solves...
2023-06-14 16:34:36 INFO     bot.root_pythia_cogs Checking for new solves...
2023-06-14 16:34:46 INFO     bot.root_pythia_cogs Checking for new solves...
2023-06-14 16:34:50 ERROR    bot.root_pythia_cogs 'help' command failed
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 229, in wrapped
    ret = await coro(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/help.py", line 948, in command_callback
    return await self.send_bot_help(mapping)
  File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/help.py", line 1257, in send_bot_help
    note = self.get_ending_note()
  File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/help.py", line 1070, in get_ending_note
    f'Type {self.context.clean_prefix}{command_name} command for more info on a command.\n'
  File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/context.py", line 422, in clean_prefix
    pattern = re.compile(r"<@!?%s>" % user.id)
AttributeError: 'NoneType' object has no attribute 'id'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/root-pythia/src/bot/root_pythia_cogs.py", line 40, in on_command_error
    raise error
  File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
    await ctx.command.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1023, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 238, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id'
2023-06-14 16:34:56 INFO     bot.root_pythia_cogs Checking for new solves...
2023-06-14 16:35:06 INFO     bot.root_pythia_cogs Checking for new solves...

[...]

2023-06-14 16:49:06 INFO     bot.root_pythia_cogs Checking for new solves...
2023-06-14 16:49:16 INFO     bot.root_pythia_cogs Checking for new solves...
2023-06-14 16:49:16 WARNING  api.rate_limiter Request : GET https://api.www.root-me.org//auteurs/706764 + {'api_key': 'CENSORED XD'} failed with response code 429
2023-06-14 16:49:18 ERROR    asyncio Task exception was never retrieved
future: <Task finished name='Task-10' coro=<RateLimiter.handle_requests() done, defined at /opt/root-pythia/src/api/rate_limiter.py:43> exception=ValueError('task_done() called too many times')>
Traceback (most recent call last):
  File "/opt/root-pythia/src/api/rate_limiter.py", line 108, in handle_requests
    self.queue.task_done()
  File "/usr/local/lib/python3.10/asyncio/queues.py", line 202, in task_done
    raise ValueError('task_done() called too many times')
ValueError: task_done() called too many times
2023-06-14 16:49:26 INFO     bot.root_pythia_cogs Checking for new solves...

The first error comes from the !help command.
We tried to print the help menu but because it isn't implemented yet, it produced this error.
The second one looks like we made too many requests 🤔

the second one is linked to #18 I think and the 1st one is bad I should check it out, in my expereince the help command always exists but I might be wrong here

#18 has been merged so this issue should be renamed

Should we implement a help command then ? It should close this issue right ?

@J3y0 absolutely yes!

I am looking at the bug, and for what I have seen so far, the bug is due to some Intents the bot misses. The next step is to identify them, but init Intents with the default ones and adding intent.message_content solve the problem for a defaultHelpCommand ! :)

Now, it would be fun to do a fancier one ;) Or at least, modify the default one to add some logs at the command