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