modmail-dev / Modmail

A Discord bot that functions as a shared inbox between staff and members, similar to Reddit's Modmail.
https://docs.modmail.dev
GNU Affero General Public License v3.0
1.57k stars 4.59k forks source link

[BUG] ERROR when closing group conversation (dev-version). #3052

Closed Jerrie-Aries closed 3 years ago

Jerrie-Aries commented 3 years ago

Describe the bug Error raised when closing group conversation and the thread channel is not getting deleted.

Bot Info Bot version (check with @modmail about): -v3.10.0-dev3 Host method (Heroku, self-host, etc): -Self-host

To Reproduce Steps to reproduce the behavior:

  1. Who can reproduce (ex. anyone, owners)? Supporters
  2. Where can it be reproduced (ex. in thread channels, recipient DM's)? Thread channel
  3. Done what to cause the error? Close the thread using ?close command.
  4. Any recently made changes to your bot? No
  5. Errored

Error Logs

06/24/21 21:45:37 __main__[1562] - ERROR: Unexpected exception:
Traceback (most recent call last):
  File "C:\Users\Username\.virtualenvs\Modmail-Y9MQGjgg\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\Username\Projects\Modmail\cogs\modmail.py", line 421, in close
    await thread.close(closer=ctx.author, after=close_after, message=message, silent=silent)
  File "C:\Users\Username\Projects\Modmail\core\thread.py", line 408, in close
    await self._close(closer, silent, delete_channel, message)
  File "C:\Users\Username\Projects\Modmail\core\thread.py", line 505, in _close
    message = self.bot.formatter.format(
  File "C:\Users\Username\AppData\Local\Programs\Python\Python38-32\lib\string.py", line 163, in format
    return self.vformat(format_string, args, kwargs)
  File "C:\Users\Username\AppData\Local\Programs\Python\Python38-32\lib\string.py", line 167, in vformat
    result, _ = self._vformat(format_string, args, kwargs, used_args, 2)
  File "C:\Users\Username\AppData\Local\Programs\Python\Python38-32\lib\string.py", line 177, in _vformat
    self.parse(format_string):
  File "C:\Users\Username\AppData\Local\Programs\Python\Python38-32\lib\string.py", line 261, in parse
    return _string.formatter_parser(format_string)
TypeError: expected str, got NoneType

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

Traceback (most recent call last):
  File "C:\Users\Username\.virtualenvs\Modmail-Y9MQGjgg\lib\site-packages\discord\ext\commands\bot.py", line 902, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Username\.virtualenvs\Modmail-Y9MQGjgg\lib\site-packages\discord\ext\commands\core.py", line 864, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Username\.virtualenvs\Modmail-Y9MQGjgg\lib\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: TypeError: expected str, got NoneType
C:\Users\Username\AppData\Local\Programs\Python\Python38-32\lib\asyncio\events.py:81: RuntimeWarning: coroutine 'Messageable.send' was never awaited
  self._context.run(self._callback, *self._args)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
C:\Users\Username\AppData\Local\Programs\Python\Python38-32\lib\asyncio\events.py:81: RuntimeWarning: coroutine 'ConfigManager.update' was never awaited
  self._context.run(self._callback, *self._args)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Additional context I believe the error was raised from here: https://github.com/kyb3r/modmail/blob/e79432525fde5efe69550fa7d70bf01eb2be80d3/core/thread.py#L505-L507 when the message was None.

fourjr commented 3 years ago

Resolved in v3.10.0-dev4