Voxel-Fox-Ltd / VoxelBotUtils

An extension of the Discord.py library to improve the bot development process.
https://voxelbotutils.readthedocs.io/en/latest/
GNU General Public License v2.0
34 stars 12 forks source link

Add flag in `Menu.create_cog` for whether the command is runnable in DMs or not #134

Closed 4Kaylum closed 3 years ago

4Kaylum commented 3 years ago

The bot hit a Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id' error while running the 'setup command.

Traceback (most recent call last):
  File "/home/kae/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/kae/.local/lib/python3.8/site-packages/voxelbotutils/cogs/utils/menus/menu.py", line 61, in setup
    async def setup(nested_self, ctx):
  File "/home/kae/.local/lib/python3.8/site-packages/voxelbotutils/cogs/utils/menus/menu.py", line 86, in start
    # Set up our base case
  File "/home/kae/.local/lib/python3.8/site-packages/voxelbotutils/cogs/utils/menus/menu.py", line 163, in get_sendable_data
    for i in options:
  File "/home/kae/.local/lib/python3.8/site-packages/voxelbotutils/cogs/utils/menus/mixins.py", line 15, in get_display
    return self.display(ctx)
  File "/home/kae/Cerberus/./cogs/bot_settings.py", line 7, in <lambda>
    display=lambda ctx: f"Remove old roles (currently {ctx.bot.guild_settings[ctx.guild.id]['remove_old_roles']})",
AttributeError: 'NoneType' object has no attribute 'id'

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

Traceback (most recent call last):
  File "/home/kae/.local/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/kae/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/kae/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id'
4Kaylum commented 3 years ago

Closed with 008fd21f61c1afaf8c075c3fae212f196ee2290d.