Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

🐛 APIObject require _client & _http everytime, leading to bugs #361

@Sigmanificient

Description

@Sigmanificient

Describe the bug

This is just a example cause there is tons of others

       channel = await self.get_channel(thread_id)
       msg = await channel.send('ping')
       await msg.delete()
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-4' coro=<Bot.keep_them_all_alive() done, defined at /Users/fpierfed/workspace/keepalive/./bot.py:58> exception=AttributeError("'NoneType' object has no attribute 'delete'")>
Traceback (most recent call last):
  File "/Users/fpierfed/workspace/keepalive/./bot.py", line 64, in keep_them_all_alive
    await self.keep_alive(thread_id)
  File "/Users/fpierfed/workspace/keepalive/./bot.py", line 72, in keep_alive
    await msg.delete()
  File "/Users/fpierfed/python_venvs/keepalive/lib/python3.9/site-packages/pincer/objects/message/user_message.py", line 583, in delete
    await self._http.delete(
AttributeError: 'NoneType' object has no attribute 'delete'

the fix for it is to add

.         channel = await self.get_channel(thread_id)
.         msg = await channel.send('ping')
+         msg._client = self
+         msg._http = self.http
.         await msg.delete()

Pincer Version used

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions