refactor(chat): unify message rendering as components#198
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the chat message system by replacing the legacy SystemMessage + MessageContext rendering path with an EventMessage model that renders channel/system events via dedicated Svelte components. This unifies “system/event” rendering with the existing component-based message approach and simplifies handler/command code paths.
Changes:
- Replace
SystemMessage/MessageContextwithEventMessage+ per-event Svelte components undercomponents/message/events/*. - Update
Chat’s API to a unifiedadd(message: Message)plus helpers (event(),notice(),component()), and migrate all call sites. - Update chat UI rendering to display event messages via a new
Event.sveltewrapper.
Reviewed changes
Copilot reviewed 64 out of 64 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/models/message/user-message.ts | Adjusts UserMessage tagging and text fallback to align with the new message-type identification approach. |
| src/lib/models/message/textual-message.svelte.ts | Updates MessageData union to include EventMessageData (replacing system-message data). |
| src/lib/models/message/system-message.ts | Removes the legacy SystemMessage implementation. |
| src/lib/models/message/message.ts | Replaces isSystem() with isEvent() and updates related type imports. |
| src/lib/models/message/event-message.ts | Introduces EventMessage as the new internally-constructed textual event message type. |
| src/lib/models/message/context.ts | Removes the legacy MessageContext type hierarchy. |
| src/lib/models/message/component-message.ts | Tightens ComponentMessage overrides and makes props required for consistent component rendering. |
| src/lib/models/chat.svelte.ts | Replaces addMessage/addSystemMessage with unified add() + event()/notice() helpers and updates insertion logic. |
| src/lib/handlers/seventv/user-update.ts | Migrates 7TV user-update notifications to component-based event rendering. |
| src/lib/handlers/seventv/emote-set-update.ts | Migrates emote set update notifications to EventMessage component rendering. |
| src/lib/handlers/irc/usernotice.ts | Switches message insertion to channel.chat.add(message). |
| src/lib/handlers/irc/privmsg.ts | Switches message insertion to channel.chat.add(message). |
| src/lib/handlers/irc/notice.ts | Converts IRC notices from SystemMessage text/context to notice()/event() calls. |
| src/lib/handlers/irc/join.ts | Converts join event from addSystemMessage to chat.event(Join, …). |
| src/lib/handlers/irc/clearmsg.ts | Converts delete-message event to chat.event(Delete, …) with metadata forwarding. |
| src/lib/handlers/irc/clearchat.ts | Converts clear/ban/timeout handling to specific event components. |
| src/lib/handlers/eventsub/stream-online.ts | Converts stream online notification to StreamStatus event component. |
| src/lib/handlers/eventsub/stream-offline.ts | Converts stream offline notification to StreamStatus event component. |
| src/lib/handlers/eventsub/channel-warning-acknowledge.ts | Converts warn-ack to WarnAck event component. |
| src/lib/handlers/eventsub/channel-unban-request-resolve.ts | Converts unban request resolve to UnbanRequest event component. |
| src/lib/handlers/eventsub/channel-unban-request-create.ts | Converts unban request create to UnbanRequest event component. |
| src/lib/handlers/eventsub/channel-suspicious-user-update.ts | Converts suspicious-user status messages to SuspicionStatus event component. |
| src/lib/handlers/eventsub/channel-suspicious-user-message.ts | Switches message insertion to channel.chat.add(message). |
| src/lib/handlers/eventsub/channel-subscription-end.ts | Converts subscription-end system text to chat.notice(). |
| src/lib/handlers/eventsub/channel-moderate.ts | Converts moderation action messages to specific event components (delete/timeout/ban/etc.). |
| src/lib/handlers/eventsub/channel-chat-user-message-update.ts | Converts moderation update notice to chat.notice(). |
| src/lib/handlers/eventsub/channel-chat-user-message-hold.ts | Switches message insertion to channel.chat.add(message). |
| src/lib/handlers/eventsub/automod-message-update.ts | Converts automod updates to AutoMod event component. |
| src/lib/handlers/eventsub/automod-message-hold.ts | Switches message insertion to channel.chat.add(message). |
| src/lib/components/message/SystemMessage.svelte | Removes the monolithic system-message renderer. |
| src/lib/components/message/events/WarnAck.svelte | Adds dedicated renderer for warn acknowledgements. |
| src/lib/components/message/events/Warn.svelte | Adds dedicated renderer for moderator warnings. |
| src/lib/components/message/events/Untimeout.svelte | Adds dedicated renderer for untimeout events. |
| src/lib/components/message/events/Unraid.svelte | Adds dedicated renderer for unraid events. |
| src/lib/components/message/events/UnbanRequest.svelte | Adds dedicated renderer for unban request create/resolve events. |
| src/lib/components/message/events/Timeout.svelte | Adds dedicated renderer for timeout events. |
| src/lib/components/message/events/Term.svelte | Adds dedicated renderer for AutoMod term list changes. |
| src/lib/components/message/events/SuspicionStatus.svelte | Adds dedicated renderer for suspicious-user status changes. |
| src/lib/components/message/events/StreamStatus.svelte | Adds dedicated renderer for stream online/offline transitions. |
| src/lib/components/message/events/RoleStatus.svelte | Adds dedicated renderer for VIP/mod role changes. |
| src/lib/components/message/events/Raid.svelte | Adds dedicated renderer for raid events. |
| src/lib/components/message/events/Notice.svelte | Adds dedicated renderer for plain text notices. |
| src/lib/components/message/events/Mode.svelte | Adds dedicated renderer for chat mode changes. |
| src/lib/components/message/events/Join.svelte | Adds dedicated renderer for join events. |
| src/lib/components/message/events/EmoteSetUpdate.svelte | Adds dedicated renderer for emote set updates. |
| src/lib/components/message/events/EmoteSetChange.svelte | Adds dedicated renderer for emote set changes. |
| src/lib/components/message/events/Delete.svelte | Adds dedicated renderer for message deletions. |
| src/lib/components/message/events/Clear.svelte | Adds dedicated renderer for chat clears. |
| src/lib/components/message/events/BlockStatus.svelte | Adds dedicated renderer for block/unblock status events. |
| src/lib/components/message/events/BanStatus.svelte | Adds dedicated renderer for ban/unban status events. |
| src/lib/components/message/events/Banned.svelte | Adds dedicated renderer for “you are banned” events. |
| src/lib/components/message/events/AutoMod.svelte | Adds dedicated renderer for AutoMod message status updates. |
| src/lib/components/message/Event.svelte | Adds a generic wrapper to render EventMessage instances in chat UI. |
| src/lib/components/chat/Chat.svelte | Switches system-message rendering to event-message rendering via Event.svelte. |
| src/lib/commands/twitch/vips.ts | Converts output to chat.notice() instead of constructing a SystemMessage. |
| src/lib/commands/twitch/unblock.ts | Converts block-status feedback to BlockStatus event component. |
| src/lib/commands/twitch/mods.ts | Converts output to chat.notice() instead of constructing a SystemMessage. |
| src/lib/commands/twitch/marker.ts | Converts output to chat.notice(). |
| src/lib/commands/twitch/block.ts | Converts block-status feedback to BlockStatus event component. |
| src/lib/commands/built-in/reload-theme.ts | Converts output to chat.notice(). |
| src/lib/commands/built-in/reload-emotes.ts | Converts output to chat.notice(). |
| src/lib/commands/built-in/reload-cheermotes.ts | Converts output to chat.notice(). |
| src/lib/commands/built-in/reload-badges.ts | Converts output to chat.notice(). |
| src/lib/commands/built-in/founders.ts | Converts output to chat.notice() instead of constructing a SystemMessage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.