Modmail icon indicating copy to clipboard operation
Modmail copied to clipboard

Fixes Persistent not not sending

Open martinbndr opened this issue 1 year ago • 1 comments

This PR fixes persistent notes not sending on thread creation.

This error raised:

Task exception was never retrieved
future: <Task finished name='Task-86' coro=<Thread.setup() done, defined at c:\Users\MA\Documents\modmail-dev\devmodmail\core\thread.py:160> exception=TypeError("Thread.setup.<locals>.send_persistent_notes.<locals>.State.store_user() got an unexpected keyword argument 'cache'")>
Traceback (most recent call last):
  File "c:\Users\MA\Documents\modmail-dev\devmodmail\core\thread.py", line 291, in setup
    await asyncio.gather(
  File "c:\Users\MA\Documents\modmail-dev\devmodmail\core\thread.py", line 277, in send_persistent_notes
    message = discord.Message(state=State(), channel=self.channel, data=data)
  File "c:\Users\MA\Documents\modmail-dev\devmodmail\venv\lib\site-packages\discord\message.py", line 1687, in __init__
    getattr(self, f'_handle_{handler}')(data[handler])
  File "c:\Users\MA\Documents\modmail-dev\devmodmail\venv\lib\site-packages\discord\message.py", line 1811, in _handle_author       
    self.author = self._state.store_user(author, cache=self.webhook_id is None)
TypeError: Thread.setup.<locals>.send_persistent_notes.<locals>.State.store_user() got an unexpected keyword argument 'cache'

Maybe not ideal solution but adding the cache arg to the store_user() funtion at line 253 fixes it.

martinbndr avatar Dec 27 '23 13:12 martinbndr