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

[BUG]: the bot is unresponsive to the command ?help #3328

Open
zephyr-developer opened this issue Jan 27, 2024 · 4 comments
Open

[BUG]: the bot is unresponsive to the command ?help #3328

zephyr-developer opened this issue Jan 27, 2024 · 4 comments
Assignees
Labels
bug This is a confirmed bug

Comments

@zephyr-developer
Copy link

Bot Version

latest

How are you hosting Modmail?

Other

Error Logs

Traceback (most recent call last): File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/core.py", line 235, in wrapped ret = await coro(*args, **kwargs) File "/home/container/modmail/cogs/utility.py", line 52, in command_callback return await super().command_callback(ctx, command=command) File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/help.py", line 951, in command_callback return await self.send_bot_help(mapping) File "/home/container/modmail/cogs/utility.py", line 123, in send_bot_help embeds.extend(await self.format_cog_help(cog)) File "/home/container/modmail/cogs/utility.py", line 60, in format_cog_help cog.get_commands() if not no_cog else cog, AttributeError: 'NoneType' object has no attribute 'get_commands' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 1350, in invoke await ctx.command.invoke(ctx) File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/core.py", line 1029, in invoke await injected(*ctx.args, **ctx.kwargs) # type: ignore File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/core.py", line 244, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'get_commands'

Screenshots

Traceback (most recent call last):
File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/core.py", line 235, in wrapped
ret = await coro(*args, **kwargs)
File "/home/container/modmail/cogs/utility.py", line 52, in command_callback
return await super().command_callback(ctx, command=command)
File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/help.py", line 951, in command_callback
return await self.send_bot_help(mapping)
File "/home/container/modmail/cogs/utility.py", line 123, in send_bot_help
embeds.extend(await self.format_cog_help(cog))
File "/home/container/modmail/cogs/utility.py", line 60, in format_cog_help
cog.get_commands() if not no_cog else cog,
AttributeError: 'NoneType' object has no attribute 'get_commands'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
await ctx.command.invoke(ctx)
File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/core.py", line 1029, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/core.py", line 244, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'get_commands'

Additional Information

No response

@zephyr-developer zephyr-developer added the maybe: bug An unconfirmed bug label Jan 27, 2024
@martinbndr
Copy link
Contributor

martinbndr commented Jan 27, 2024

Are you sure you have a correct configuration of the .env file and the bot also connects without any issues?
Cannot replicate this issue for now.

Also what happens if you use ?help all. Does it also raise this error?

@zephyr-developer
Copy link
Author

zephyr-developer commented Jan 28, 2024

Yes, the log my bot started and running all cmd without error.
The error with the command ?help all:

Traceback (most recent call last):
  File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/core.py", line 235, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/container/modmail/cogs/utility.py", line 52, in command_callback
    return await super().command_callback(ctx, command=command)
  File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/help.py", line 951, in command_callback
    return await self.send_bot_help(mapping)
  File "/home/container/modmail/cogs/utility.py", line 123, in send_bot_help
    embeds.extend(await self.format_cog_help(cog))
  File "/home/container/modmail/cogs/utility.py", line 60, in format_cog_help
    cog.get_commands() if not no_cog else cog,
AttributeError: 'NoneType' object has no attribute 'get_commands'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
    await ctx.command.invoke(ctx)
  File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/core.py", line 1029, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/core.py", line 244, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'get_commands'

@zephyr-developer
Copy link
Author

EDIT: I just noticed there is an error when starting up the bot. After Shard ID x have connected to gateway, it gives: Failed to load cogs.plugins

  File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 947, in _load_from_module_spec
    await setup(self)
  File "/home/container/modmail/cogs/plugins.py", line 760, in setup
    await bot.add_cog(Plugins(bot))
  File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 783, in add_cog
    cog = await cog._inject(self, override=override, guild=guild, guilds=guilds)
  File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/cog.py", line 684, in _inject
    await maybe_coroutine(self.cog_load)
  File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/utils.py", line 693, in maybe_coroutine
    return await value
  File "/home/container/modmail/cogs/plugins.py", line 127, in cog_load
    await self.populate_registry()
  File "/home/container/modmail/cogs/plugins.py", line 135, in populate_registry
    async with self.bot.session.get(url) as resp:
  File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/aiohttp/client.py", line 1187, in __aenter__
    self._resp = await self._coro
  File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/aiohttp/client.py", line 678, in _request
    break
  File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/aiohttp/helpers.py", line 735, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/container/modmail/bot.py", line 181, in load_extensions
    await self.load_extension(cog)
  File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 1013, in load_extension
    await self._load_from_module_spec(spec, name)
  File "/home/container/.local/share/virtualenvs/modmail-wrCiwdJy/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 952, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.plugins' raised an error: TimeoutError: ```

@StephenDaDev
Copy link
Member

Confirmed to be a bug with an open PR to resolve

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

No branches or pull requests

4 participants