def deserialize_guild_channel_update_event( self, shard: gateway_shard.GatewayShard, payload: data_binding.JSONObject, *, old_channel: typing.Optional[channel_models.GuildChannel], ) -> channel_events.GuildChannelUpdateEvent: channel = self._app.entity_factory.deserialize_channel(payload) assert isinstance( channel, channel_models.GuildChannel ), "DM channel update events are undocumented behaviour" return channel_events.GuildChannelUpdateEvent(shard=shard, channel=channel, old_channel=old_channel)
def deserialize_channel_update_event( self, shard: gateway_shard.GatewayShard, payload: data_binding.JSONObject, *, old_channel: typing.Optional[channel_models.GuildChannel], ) -> channel_events.ChannelUpdateEvent: channel = self._app.entity_factory.deserialize_channel(payload) if isinstance(channel, channel_models.GuildChannel): return channel_events.GuildChannelUpdateEvent( app=self._app, shard=shard, channel=channel, old_channel=old_channel ) if isinstance(channel, channel_models.PrivateChannel): raise NotImplementedError("DM channel update events are undocumented behaviour") raise TypeError(f"Expected GuildChannel or PrivateChannel but received {type(channel).__name__}")
def deserialize_channel_update_event( self, shard: gateway_shard.GatewayShard, payload: data_binding.JSONObject ) -> channel_events.ChannelUpdateEvent: channel = self._app.entity_factory.deserialize_channel(payload) if isinstance(channel, channel_models.GuildChannel): return channel_events.GuildChannelUpdateEvent(app=self._app, shard=shard, channel=channel) if isinstance(channel, channel_models.PrivateChannel): return channel_events.PrivateChannelUpdateEvent(app=self._app, shard=shard, channel=channel) raise TypeError( f"Expected GuildChannel or PrivateChannel but received {type(channel).__name__}" )
def event(self): return channel_events.GuildChannelUpdateEvent(channel=mock.Mock(), old_channel=mock.Mock(), shard=None)