Pure reducer that derives higher-level side-effect events from group stub messages.
Baileys' processMessage (process-message.ts, lines 513-614) translates stub
message types into events like group-participants.update, groups.update,
group.join-request, and chat readOnly flips. This module ports that logic
as a stateless function: given a stub payload, return a list of side-effect
tuples that the caller can emit through the EventEmitter.
Input
A map with the following keys:
:stub_type- atom stub type (e.g.,:GROUP_PARTICIPANT_ADD):stub_parameters- list of string parameters (JSON-encoded participants, etc.):group_jid- the group's JID string:author- the JID of the action author (participant attribute):author_pn- the PN (phone number) alternative for the author:me_id- the current user's JID, used forreadOnlyflip detection
Output
A list of tagged tuples:
{:group_participants_update, payload}— participant action event{:groups_update, [update]}— group metadata change event{:group_join_request, payload}— join request event{:chats_update, [update]}— chat read-only flip
Summary
Functions
Derive side-effect events from a group stub message payload.
Types
Functions
@spec derive(stub_input()) :: [side_effect()]
Derive side-effect events from a group stub message payload.
Returns a list of side-effect tuples that should be emitted via EventEmitter. Returns an empty list for unrecognized or nil stub types.