Modmail icon indicating copy to clipboard operation
Modmail copied to clipboard

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

Open zephyr-developer opened this issue 2 years ago • 4 comments

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 avatar Jan 27 '24 11:01 zephyr-developer

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?

martinbndr avatar Jan 27 '24 12:01 martinbndr

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 avatar Jan 28 '24 08:01 zephyr-developer

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: ```

zephyr-developer avatar Jan 28 '24 08:01 zephyr-developer

Confirmed to be a bug with an open PR to resolve

StephenDaDev avatar Feb 01 '24 00:02 StephenDaDev