def deserialize_channel_delete_event( self, shard: gateway_shard.GatewayShard, payload: data_binding.JSONObject ) -> channel_events.ChannelDeleteEvent: channel = self._app.entity_factory.deserialize_channel(payload) if isinstance(channel, channel_models.GuildChannel): return channel_events.GuildChannelDeleteEvent(app=self._app, shard=shard, channel=channel) if isinstance(channel, channel_models.PrivateChannel): raise NotImplementedError("DM channel delete events are undocumented behaviour") raise TypeError(f"Expected GuildChannel or PrivateChannel but received {type(channel).__name__}")
def deserialize_guild_channel_delete_event( self, shard: gateway_shard.GatewayShard, payload: data_binding.JSONObject ) -> channel_events.GuildChannelDeleteEvent: channel = self._app.entity_factory.deserialize_channel(payload) assert isinstance( channel, channel_models.GuildChannel ), "DM channel delete events are undocumented behaviour" return channel_events.GuildChannelDeleteEvent(shard=shard, channel=channel)
def event(self): return channel_events.GuildChannelDeleteEvent(channel=mock.Mock(), shard=None)