hcoopmeetbotlogic.meeting
=========================

.. py:module:: hcoopmeetbotlogic.meeting

.. autoapi-nested-parse::

   Meeting state.





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

.. py:class:: EventType

   Bases: :py:obj:`str`, :py:obj:`enum.Enum`


   Legal event types for TrackedEvent.


   .. py:attribute:: START_MEETING
      :value: 'START_MEETING'



   .. py:attribute:: END_MEETING
      :value: 'END_MEETING'



   .. py:attribute:: ATTENDEE
      :value: 'ATTENDEE'



   .. py:attribute:: MEETING_NAME
      :value: 'MEETING_NAME'



   .. py:attribute:: TOPIC
      :value: 'TOPIC'



   .. py:attribute:: ADD_CHAIR
      :value: 'ADD_CHAIR'



   .. py:attribute:: REMOVE_CHAIR
      :value: 'REMOVE_CHAIR'



   .. py:attribute:: TRACK_NICK
      :value: 'TRACK_NICK'



   .. py:attribute:: UNDO
      :value: 'UNDO'



   .. py:attribute:: SAVE_MEETING
      :value: 'SAVE_MEETING'



   .. py:attribute:: MOTION
      :value: 'MOTION'



   .. py:attribute:: VOTE
      :value: 'VOTE'



   .. py:attribute:: ACCEPTED
      :value: 'ACCEPTED'



   .. py:attribute:: INCONCLUSIVE
      :value: 'INCONCLUSIVE'



   .. py:attribute:: FAILED
      :value: 'FAILED'



   .. py:attribute:: ACTION
      :value: 'ACTION'



   .. py:attribute:: INFO
      :value: 'INFO'



   .. py:attribute:: IDEA
      :value: 'IDEA'



   .. py:attribute:: HELP
      :value: 'HELP'



   .. py:attribute:: LINK
      :value: 'LINK'



.. py:class:: VotingAction

   Bases: :py:obj:`str`, :py:obj:`enum.Enum`


   Voting actions


   .. py:attribute:: IN_FAVOR
      :value: '+1'



   .. py:attribute:: OPPOSED
      :value: '-1'



.. py:class:: TrackedMessage

   A message tracked as part of a meeting.

   .. attribute:: id

      Message identifier

      :type: str

   .. attribute:: sender

      IRC nick of the sender

      :type: str

   .. attribute:: payload

      Payload of the message

      :type: str

   .. attribute:: action

      Whether this is an ACTION message

      :type: bool

   .. attribute:: timestamp

      Message timestamp in UTC

      :type: datetime


   .. py:attribute:: id
      :type:  str


   .. py:attribute:: sender
      :type:  str


   .. py:attribute:: payload
      :type:  str


   .. py:attribute:: action
      :type:  bool


   .. py:attribute:: timestamp
      :type:  datetime.datetime


   .. py:method:: display_name() -> str

      Get the message display name.



.. py:class:: TrackedEvent

   An event tracked as part of a meeting, always tied to a specific message.

   .. attribute:: id

      The event identifier

      :type: str

   .. attribute:: event_type

      Type of the event

      :type: EventType

   .. attribute:: timestamp

      Event timestamp in UTC

      :type: datetime

   .. attribute:: message

      The message associated with the event

      :type: TrackedMessage

   .. attribute:: operand

      The operand (remainder of the payload after the command)

      :type: Optional[str]


   .. py:attribute:: event_type
      :type:  EventType


   .. py:attribute:: message
      :type:  TrackedMessage


   .. py:attribute:: operand
      :type:  Any | None


   .. py:attribute:: id
      :type:  str


   .. py:attribute:: timestamp
      :type:  datetime.datetime


   .. py:method:: display_name() -> str

      Get the event display name.



.. py:class:: Meeting

   A meeting on a particular IRC channel.

   The meeting can be serialized and deserialized to and from JSON.  This is the mechanism we use
   to persist the raw log to disk.  If you round trip the JSON (generate JSON and then use that
   JSON to create a new meeting), the resulting object contains data that is equivalent, but not
   exactly identical to, the original object.  Each tracked event has an associated message.  In
   the original object, the tracked event always refers to one of the message objects that is
   already in the messages list.  When you deserialize from JSON, the object in the message list
   will be different than the one on the tracked event, although they will be equivalent by value.
   So, if you deserialize from JSON, it's best to treat the resulting object as a read-only copy.
   The copy won't always work exactly like a meeting that was created at runtime based on actual
   IRC traffic.

   .. attribute:: id

      Unique identifier for the meeting

      :type: str

   .. attribute:: name

      The name of the meeting, which defaults to the channel name

      :type: str

   .. attribute:: founder

      IRC nick of the meeting founder, always a member of chairs

      :type: str

   .. attribute:: channel

      Channel the meeting is running on

      :type: str

   .. attribute:: network

      Network associated with the channel

      :type: str

   .. attribute:: chair

      IRC nick of primary meeting chair, always a member of chairs

      :type: str

   .. attribute:: chairs

      IRC nick of all meeting chairs, including the primary

      :type: List[str]

   .. attribute:: nicks

      IRC nick of anyone who contributed to the meeting or was explicitly called out

      :type: List[str]

   .. attribute:: start_time

      Start time of the meeting in UTC

      :type: datetime

   .. attribute:: end_time

      End time of the meeting in UTC, possibly None

      :type: Optional[datetime]

   .. attribute:: original_topic

      The original topic assigned to the channel prior to starting the meeting

      :type: Optional[str]

   .. attribute:: current_topic

      The current topic, assigned by a chair

      :type: Optional[str]

   .. attribute:: messages

      List of all messages tracked as part of the meeting

      :type: List[TrackedMessage]

   .. attribute:: events

      List of all events tracked as part of the meeting

      :type: List[TrackedEvent]

   .. attribute:: aliases

      Dictionary mapping attendee IRC nick to optional alias

      :type: Dict[str, Optional[str]

   .. attribute:: vote_in_progress

      Whether voting is in progress

      :type: bool

   .. attribute:: motion_index

      Index into events for the current motion, when voting is in progress

      :type: int


   .. py:attribute:: founder
      :type:  str


   .. py:attribute:: channel
      :type:  str


   .. py:attribute:: network
      :type:  str


   .. py:attribute:: id
      :type:  str


   .. py:attribute:: name
      :type:  str


   .. py:attribute:: chair
      :type:  str


   .. py:attribute:: chairs
      :type:  list[str]


   .. py:attribute:: nicks
      :type:  dict[str, int]


   .. py:attribute:: start_time
      :type:  datetime.datetime


   .. py:attribute:: end_time
      :type:  datetime.datetime | None
      :value: None



   .. py:attribute:: active
      :type:  bool
      :value: False



   .. py:attribute:: original_topic
      :type:  str | None
      :value: None



   .. py:attribute:: current_topic
      :type:  str | None
      :value: None



   .. py:attribute:: messages
      :type:  list[TrackedMessage]


   .. py:attribute:: events
      :type:  list[TrackedEvent]


   .. py:attribute:: aliases
      :type:  dict[str, str | None]


   .. py:attribute:: vote_in_progress
      :type:  bool
      :value: False



   .. py:attribute:: motion_index
      :type:  int | None
      :value: None



   .. py:method:: meeting_key(channel: str, network: str) -> str
      :staticmethod:


      Build the dict key for a network and channel.



   .. py:method:: to_json() -> str

      Serialize a meeting to JSON.



   .. py:method:: from_json(data: str) -> Meeting
      :staticmethod:


      Deserialize a meeting from JSON.



   .. py:method:: key() -> str


   .. py:method:: display_name() -> str

      Get the meeting display name.



   .. py:method:: add_chair(nick: str, *, primary: bool = True) -> None

      Add a chair to a meeting, potentially making it the primary chair.



   .. py:method:: remove_chair(nick: str) -> None

      Remove a chair from a meeting, ignoring requests to remove the founder.



   .. py:method:: is_chair(nick: str) -> bool

      Whether a nickname is a chair for the meeting



   .. py:method:: track_attendee(nick: str, alias: str | None = None) -> None

      Track an IRC nick as a meeting attendee, optionally assigning an alias.



   .. py:method:: track_nick(nick: str, messages: int = 1) -> None

      Track an IRC nick, incrementing its count of messages as indicated



   .. py:method:: track_message(message: hcoopmeetbotlogic.interface.Message) -> TrackedMessage

      Track a message associated with the meeting.



   .. py:method:: track_event(event_type: EventType, message: TrackedMessage, operand: Any | None = None) -> TrackedEvent

      Track an event associated with a meeting.



   .. py:method:: pop_event() -> TrackedEvent | None

      Pop the last tracked event off the list of events, if possible, returning the event.



