Skip to content

Commit 4a36251

Browse files
committed
feat: post feed supports LIVE_SHARE
1 parent 90388c1 commit 4a36251

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/command/post/feed.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,25 @@ const viewFeeds = async (opts: FeedOptions) => {
4646
async function renderPost(p: Entity.FollowingUpdate) {
4747
const texts: string[] = []
4848
if (p.type === 'PERSONAL_UPDATE') {
49-
texts.push(`${displayUsers(p.users)} 关注了 ${displayUsers(p.targetUsers)}`)
49+
switch (p.action) {
50+
case 'LIVE_SHARE':
51+
texts.push(
52+
// @ts-expect-error
53+
`${displayUsers(p.users)} ${p.verb}`,
54+
// @ts-expect-error
55+
(await displayImage(p.live.picture.picUrl)).result,
56+
// @ts-expect-error
57+
p.live.title
58+
)
59+
break
60+
case 'USER_FOLLOW':
61+
texts.push(
62+
`${displayUsers(p.users)} 关注了 ${displayUsers(p.targetUsers)}`
63+
)
64+
break
65+
default:
66+
texts.push(`unsupported action: ${p.action}`)
67+
}
5068
} else if (p.type === 'ORIGINAL_POST') {
5169
const link = isMacOS
5270
? logger.colors.gray(
@@ -63,7 +81,7 @@ async function renderPost(p: Entity.FollowingUpdate) {
6381
if (p.pictures && p.pictures.length > 0) {
6482
const images = await Promise.all(
6583
p.pictures.map((p) =>
66-
displayImage(p.middlePicUrl).then(({ result }) => result)
84+
displayImage(p.middlePicUrl).then(({ result }) => `${result}\n`)
6785
)
6886
)
6987
texts.push(...images)

0 commit comments

Comments
 (0)