Normalized message - #9
Conversation
…mplify slackMentions
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (17)
📝 WalkthroughWalkthroughThe PR normalizes message data into ChangesRaw payload normalization and facade accessors
Sequence Diagram(s)sequenceDiagram
participant "botbooter.DiscordRawEvent" as DR
participant "internal.discord.RawEvent" as IR
participant "botbooter.DiscordSession" as DS
participant "core.AdapterAs[T]" as AA
participant "internal.discord.Session" as IS
DR->>IR: inspect m.Raw
IR-->>DR: *discordgo.MessageCreate, ok
DS->>AA: recover adapter from *core.Bot
AA-->>DS: concrete adapter, ok
DS->>IS: return session or nil
IS-->>DS: *discordgo.Session
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ormalized Message and typed accessors
Move the per-message field and attachment logging out of echoHandler and into loggingMiddleware so it runs for every message, not only those matching "^echo ". Media-only uploads (Slack file shares, captionless Telegram photos) arrive with empty Content and never reached the command handler, so their attachments were never logged. Also print Attachment.ExtraData (Telegram delivers media by FileID, leaving URL empty) and log a startup line naming the bot type.
- delegate each adapter's Attachments to its Raw accessor, so the typed accessor is the single place that knows Raw's concrete type - rename Message.Mentions -> MentionedUserIDs, matching the *ID sibling fields and making the slice's contents self-evident at the use site - fix Slack IsImage prefix "image" -> "image/" to match telegram/cli and avoid matching non-image MIME types - use cmp.Or for the telegram text/caption fallback - document Slack's ts reuse as ID and thread/reply key in toMessage
Adopt main's normalized-message refactor (PR #9) in the WhatsApp adapter and keep both the Telegram and WhatsApp additions across core, the facade and the v1 example. - migrate off the removed core.Message *Data fields to Raw + a whatsapp.RawMessage accessor, re-exported as botbooter.WhatsAppRawEvent - populate ID, Timestamp and AuthorName (contacts-correlated) on inbound messages; carry them on core.WhatsAppMessage - re-export whatsapp.ErrMissingConfig as botbooter.ErrMissingWhatsAppConfig - cap the Send error-body read, set text/plain on the verify handshake, and guard Attachments against a typed-nil Raw - document WhatsApp in README and docs/platforms.md; add adapter, facade and String() tests make all and make test-race green.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation