Exemplo n.º 1
0
 def event(self):
     return message_events.DMMessageUpdateEvent(
         app=mock.Mock(),
         message=mock.Mock(
             spec_set=messages.Message, author=mock.Mock(spec_set=users.User, id=snowflakes.Snowflake(8000010662))
         ),
         shard=mock.Mock(),
     )
Exemplo n.º 2
0
    def deserialize_message_update_event(
        self,
        shard: gateway_shard.GatewayShard,
        payload: data_binding.JSONObject,
        *,
        old_message: typing.Optional[messages_models.PartialMessage],
    ) -> message_events.MessageUpdateEvent:
        message = self._app.entity_factory.deserialize_partial_message(payload)

        if message.guild_id is None:
            return message_events.DMMessageUpdateEvent(shard=shard,
                                                       message=message,
                                                       old_message=old_message)

        return message_events.GuildMessageUpdateEvent(shard=shard,
                                                      message=message,
                                                      old_message=old_message)