feat: chat state commands (archive, pin, mute, mark-read)#46
Open
decodiver22 wants to merge 1 commit intosteipete:mainfrom
Open
feat: chat state commands (archive, pin, mute, mark-read)#46decodiver22 wants to merge 1 commit intosteipete:mainfrom
decodiver22 wants to merge 1 commit intosteipete:mainfrom
Conversation
Add read + write support for chat-level states: archived, pinned, muted, and unread. States sync bidirectionally — inbound via WhatsApp app-state events during bootstrap and live follow, outbound via new CLI subcommands that send app-state patches through whatsmeow. Store: migration v4 adds 4 columns to chats table. ListChats gains filter struct with --archived/--pinned/--muted/--unread flags and sorts pinned chats first. GetChat/show display all state fields. Commands: archive/unarchive, pin/unpin, mute/unmute (with optional --duration), mark-read/mark-unread — all via DRY factory pattern. Tested against live WhatsApp account with cross-device verification. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
chats archive/unarchive,pin/unpin,mute/unmute(with--duration),mark-read/mark-unreadchats listgains filter flags:--archived,--pinned,--muted,--unread(and--no-*negations), plus a FLAGS column and pinned-first sort orderchats showdisplays state fields: Archived, Pinned, Muted, Unreadevents.Archive/Pin/Mute/MarkChatAsReadduring bootstrap and live follow; outbound via whatsmeowSendAppState+ builder functionsChanges
migrations.go,types.go,chats_contacts_groups.goChatListFilterstruct,ListChats/GetChatextended, 4 setter methods,Muted()helperappstate.go(new)app.go,chat_state.go(new),sync.go,fake_wa_test.gochats.go,chats_state.go(new)store_test.go,sync_test.goMuted()method, list filters, migration idempotency, sync event handlingspec.md,CHANGELOG.mdTest plan
go build ./...— compilesgo vet ./...— cleango test ./...— all pass (new tests:TestChatStateColumns,TestChatMutedMethod,TestListChatsFilters,TestMigrationIdempotent,TestSyncChatStateEvents)chats list --limit 5— FLAGS column visiblechats list --json— all 4 fields presentchats show --jid <jid>— state lines displayed--archived,--pinned,--muted,--unread,--no-*)--archived --no-archived)--duration 1h→ mute forever → unmute🤖 Generated with Claude Code