feat(view): expose messageLayout for sticker+text combo bodies (v0.8.16)
Add pearcord-message-layout dependency and messageLayoutKind() so each message in view() carries messageLayout: text | sticker-only | combo | hub. Combo rows keep displayContent for caption text while sticker-only and hub mirrors still clear displayContent for legacy render paths. Depends on [email protected] for classifyMessageLayout(). Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -76,11 +76,23 @@ const {
|
||||
isAnnouncementChannel,
|
||||
sortForumPosts
|
||||
} = require('pearcord-threads')
|
||||
const {
|
||||
classifyMessageLayout,
|
||||
LAYOUT
|
||||
} = require('pearcord-message-layout')
|
||||
const {
|
||||
COLLECTIONS, USER_STATUS, PERMISSION, roleHasPermission, canModifyMessage,
|
||||
resolveMentionedUserIds, extractFirstUrl, id, now
|
||||
} = require('pearcord-shared')
|
||||
|
||||
function messageLayoutKind (m) {
|
||||
const layout = classifyMessageLayout(m)
|
||||
if (layout === LAYOUT.HUB) return 'hub'
|
||||
if (layout === LAYOUT.COMBO) return 'combo'
|
||||
if (layout === LAYOUT.STICKER_ONLY) return 'sticker-only'
|
||||
return 'text'
|
||||
}
|
||||
|
||||
function enrichMessageStickerNames (m) {
|
||||
if (!m) return m
|
||||
if ((m.stickerNames || []).length) return m
|
||||
@@ -3515,6 +3527,7 @@ class PearcordPlatform extends EventEmitter {
|
||||
const hubOnly = enriched.hubMirror && !stickerOnly
|
||||
return {
|
||||
...enriched,
|
||||
messageLayout: messageLayoutKind(enriched),
|
||||
displayContent: stickerOnly || hubOnly ? '' : this._messagePlaintext(enriched),
|
||||
previewPlaintext: this._messagePlaintext(enriched)
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"pearcord-identity": "file:../pearcord-identity",
|
||||
"pearcord-guild": "file:../pearcord-guild",
|
||||
"pearcord-message": "file:../pearcord-message",
|
||||
"pearcord-message-layout": "file:../pearcord-message-layout",
|
||||
"pearcord-presence": "file:../pearcord-presence",
|
||||
"pearcord-invite": "file:../pearcord-invite",
|
||||
"pearcord-dm": "file:../pearcord-dm",
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
/Users/raven/dev/pearcord/modules/pearcord-platform
|
||||
Reference in New Issue
Block a user