Add Object.type to Objects where a type can be determined

This commit is contained in:
z03h
2022-08-09 05:18:58 -07:00
committed by GitHub
parent 57efb5a5a0
commit dc81ff76c4
4 changed files with 57 additions and 33 deletions

View File

@ -1885,8 +1885,8 @@ class Client:
else:
# the factory can't be a DMChannel or GroupChannel here
guild_id = int(data['guild_id']) # type: ignore
guild = self.get_guild(guild_id) or Object(id=guild_id)
# GuildChannels expect a Guild, we may be passing an Object
guild = self._connection._get_or_create_unavailable_guild(guild_id)
# the factory should be a GuildChannel or Thread
channel = factory(guild=guild, state=self._connection, data=data) # type: ignore
return channel