matridge.reactions
==================

.. py:module:: matridge.reactions


Classes
-------

.. autoapisummary::

   matridge.reactions.ReactionCache


Functions
---------

.. autoapisummary::

   matridge.reactions.purge_old_messages


Module Contents
---------------

.. py:class:: ReactionCache(client)

   To avoid fetching history on each matrix reaction event, we store the
   "reaction state" per message.

   This is because matrix reaction events are atomic, unlike XMPP reactions
   which contain the full state in each event.


   .. py:attribute:: matrix


   .. py:attribute:: log


   .. py:method:: session()


   .. py:method:: _fetch_if_needed(session, target)
      :async:



   .. py:method:: _fetch(room, event_id)
      :async:



   .. py:method:: add(session, room, msg, sender, emoji, reaction_event)
      :async:



   .. py:method:: get(session: sqlalchemy.orm.Session, room: str, msg: str, sender: str, with_event_ids: Literal[False]) -> set[str]
                  get(session: sqlalchemy.orm.Session, room: str, msg: str, sender: str) -> set[str]
                  get(session: sqlalchemy.orm.Session, room: str, msg: str, sender: str, with_event_ids: Literal[True]) -> dict[str, str]
      :async:



   .. py:method:: remove(session, room_id, event_id)
      :staticmethod:



.. py:function:: purge_old_messages(limit)

