Discord.py: Random error not from bot code AttributeError: 'User' object has no attribute 'joined_at'

Created on 25 Jul 2019  路  6Comments  路  Source: Rapptz/discord.py

Summary

My bot have issue AttributeError: 'User' object has no attribute 'joined_at'
however it doesn't seems issue from my code itself.

Reproduction Steps

My bot staying for some time, after that randomly crashes

Expected Results

Nothing

Actual Results

Traceback (most recent call last):
  File "C:\Python\Python37\lib\site-packages\discord\message.py", line 403, in _handle_member
    if author.joined_at is None:
AttributeError: 'User' object has no attribute 'joined_at'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run.py", line 3206, in <module>
    bot.run(token, bot = False)
  File "C:\Python\Python37\lib\site-packages\discord\client.py", line 598, in run
    return future.result()
  File "C:\Python\Python37\lib\site-packages\discord\client.py", line 579, in runner
    await self.start(*args, **kwargs)
  File "C:\Python\Python37\lib\site-packages\discord\client.py", line 543, in start
    await self.connect(reconnect=reconnect)
  File "C:\Python\Python37\lib\site-packages\discord\client.py", line 457, in connect
    await self._connect()
  File "C:\Python\Python37\lib\site-packages\discord\client.py", line 421, in _connect
    await self.ws.poll_event()
  File "C:\Python\Python37\lib\site-packages\discord\gateway.py", line 469, in poll_event
    await self.received_message(msg)
  File "C:\Python\Python37\lib\site-packages\discord\gateway.py", line 423, in received_message
    func(data)
  File "C:\Python\Python37\lib\site-packages\discord\state.py", line 399, in parse_message_update
    message._update(data)
  File "C:\Python\Python37\lib\site-packages\discord\message.py", line 348, in _update
    handler(self, value)
  File "C:\Python\Python37\lib\site-packages\discord\message.py", line 406, in _handle_member
    self.author = Member._from_message(message=self, data=member)
  File "C:\Python\Python37\lib\site-packages\discord\member.py", line 197, in _from_message
    return cls(data=data, guild=message.guild, state=message._state)
  File "C:\Python\Python37\lib\site-packages\discord\member.py", line 162, in __init__
    self._user = state.store_user(data['user'])
  File "C:\Python\Python37\lib\site-packages\discord\state.py", line 170, in store_user
    user_id = int(data['id'])
KeyError: 'id'

Checklist

  • [x] I have searched the open issues for duplicates.
  • [x] I have shown the entire traceback, if possible.
  • [x] I have removed my token from display, if visible.

System Information

python -m discord -v
- Python v3.7.2-final
- discord.py v1.2.3-final
- aiohttp v3.4.4
- websockets v6.0
- system info: Windows 10 10.0.17134

All 6 comments

Duplicate of #2265. I forget what causes this but it's fixed on the most recent version of discord.py

The lines where error occurred have this note:
py def _handle_member(self, member): # The gateway now gives us full Member objects sometimes with the following keys # deaf, mute, joined_at, roles # For the sake of performance I'm going to assume that the only # field that needs *updating* would be the joined_at field. # If there is no Member object (for some strange reason), then we can upgrade # ourselves to a more "partial" member object. author = self.author try: if author.joined_at is None: author.joined_at = utils.parse_time(member.get('joined_at')) except AttributeError: self.author = Member._from_message(message=self, data=member)

Ok, seems issue are fixed, but not in pypi

hellow how do i create a webhook using bot event upon joining a Guild (Server)?

Please don't necrobump issues. That's also not related to this issue at all.
For questions like this, you should join either the official discord.py server or the Discord API server for help, as the README also links.

Ok, seems issue are fixed, but not in pypi

how did u fix? i cant fix the same problem u are having

Was this page helpful?
0 / 5 - 0 ratings

Related issues

reuscam picture reuscam  路  3Comments

jzburda picture jzburda  路  3Comments

PicklesJars picture PicklesJars  路  3Comments

Nicba1010 picture Nicba1010  路  3Comments

TunaHobby picture TunaHobby  路  3Comments