Fallback to an unavailable guild instead of an Object in interactions

This commit is contained in:
Rapptz
2022-05-14 06:50:15 -04:00
parent 781b297ac9
commit 573bb32a1e
4 changed files with 10 additions and 6 deletions

View File

@@ -452,6 +452,10 @@ class Guild(Hashable):
return role
@classmethod
def _create_unavailable(cls, *, state: ConnectionState, guild_id: int) -> Guild:
return cls(state=state, data={'id': guild_id, 'unavailable': True}) # type: ignore
def _from_data(self, guild: GuildPayload) -> None:
try:
self._member_count = guild['member_count']