Voxel-Fox-Ltd / MarriageBot

A Discord bot for fake marriages
GNU Affero General Public License v3.0
82 stars 45 forks source link

Fix error getting user ID from `None` in the abandon command #132

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 M!Abandon 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 "./cogs/parentage.py", line 549, in abandon
    parent_tree.id, ctx.author.id, family_guild_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 "/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'