Skip to content

Commit 5039ca7

Browse files
authored
Merge pull request elizaOS#1475 from ag-wnl/fetch-following-timeline
Fetch timeline for followed accounts via Twitter client methods
2 parents 81be4ff + c7b49ea commit 5039ca7

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/client-twitter/src/base.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,14 @@ export class ClientBase extends EventEmitter {
249249
return homeTimeline.tweets;
250250
}
251251

252-
async fetchHomeTimeline(count: number): Promise<Tweet[]> {
252+
/**
253+
* Fetch timeline for twitter account, optionally only from followed accounts
254+
*/
255+
async fetchHomeTimeline(count: number, following?: boolean): Promise<Tweet[]> {
253256
elizaLogger.debug("fetching home timeline");
254-
const homeTimeline = await this.twitterClient.fetchHomeTimeline(
255-
count,
256-
[]
257-
);
257+
const homeTimeline = following
258+
? await this.twitterClient.fetchFollowingTimeline(count, [])
259+
: await this.twitterClient.fetchHomeTimeline(count, []);
258260

259261
elizaLogger.debug(homeTimeline, { depth: Infinity });
260262
const processedTimeline = homeTimeline

0 commit comments

Comments
 (0)