Closed caiocinel closed 3 years ago
verified
isn't guaranteed to be in the initial user data. This could potentially produce more problems.
After some testing, the correct (and fastest) solution would be to change store_user()
to this:
def store_user(self, data):
# This way is 300% faster than `dict.setdefault`.
user_id = int(data['id'])
try:
user = self._users[user_id]
# We use the data available to us since we
# might not have events for that user.
# However, the data may only have an ID.
if user_id != self.self_id:
try:
user._update(data)
except KeyError:
pass
return user
except KeyError:
user = User(state=self, data=data)
if user.discriminator != '0000':
self._users[user_id] = user
return user
What causes the problem is that the state coming from a guild overwrites the one already defined in the startup, with that private information is lost.
Fix #77