Esempio n. 1
0
 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__}")
Esempio n. 2
0
 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)
Esempio n. 3
0
 def event(self):
     return channel_events.GuildChannelCreateEvent(channel=mock.Mock(),
                                                   shard=None)