Skip to content

Commit 9a4e22a

Browse files
Add files via upload
1 parent 30db527 commit 9a4e22a

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

service/src/handlers/twitter.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ interface SyndicationTweet {
6969
aspect_ratio?: [number, number];
7070
};
7171
}>;
72+
quoted_tweet?: {
73+
id_str: string;
74+
text: string;
75+
user: {
76+
name: string;
77+
screen_name: string;
78+
};
79+
};
7280
}
7381

7482
/**
@@ -126,7 +134,26 @@ export const twitterHandler: PlatformHandler = {
126134
const cleanedText = tweet.text
127135
.replace(/https?:\/\/t\.co\/\w+/g, '') // Remove t.co URLs
128136
.trim();
129-
const description = cleanedText ? truncateText(cleanedText, 500) : '';
137+
138+
// Build description including quoted tweet if present
139+
let fullDescription = cleanedText || '';
140+
141+
if (tweet.quoted_tweet) {
142+
const quotedText = tweet.quoted_tweet.text
143+
.replace(/https?:\/\/t\.co\/\w+/g, '') // Remove t.co URLs
144+
.trim();
145+
146+
if (quotedText) {
147+
const quotedHandle = tweet.quoted_tweet.user.screen_name;
148+
// Add separator and quoted tweet content
149+
if (fullDescription) {
150+
fullDescription += '\n\n';
151+
}
152+
fullDescription += `💬 @${quotedHandle}: ${quotedText}`;
153+
}
154+
}
155+
156+
const description = fullDescription ? truncateText(fullDescription, 500) : '';
130157

131158
// Build stats for oEmbed/ActivityPub row
132159
const stats = formatStats({

0 commit comments

Comments
 (0)