Skip to content

Commit c50549e

Browse files
committed
clean code
1 parent 1ea3020 commit c50549e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/client-twitter/src/base.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ export class ClientBase extends EventEmitter {
323323
const agentUsername = this.twitterConfig.TWITTER_USERNAME;
324324
const homeTimeline = await this.twitterClient.fetchHomeTimeline(20, []);
325325

326-
const processedTweets = homeTimeline
326+
return homeTimeline
327327
.map((tweet) => ({
328328
id: tweet.rest_id,
329329
name: tweet.core?.user_results?.result?.legacy?.name,
@@ -351,10 +351,8 @@ export class ClientBase extends EventEmitter {
351351
(media) => media.type === "video"
352352
) || [],
353353
}))
354-
.filter((tweet) => tweet.username !== agentUsername); // do not perform action on self-tweets
355-
356-
const shuffledTweets = processedTweets.sort(() => Math.random() - 0.5);
357-
return shuffledTweets;
354+
.filter((tweet) => tweet.username !== agentUsername) // do not perform action on self-tweets
355+
.sort(() => Math.random() - 0.5);
358356
}
359357

360358
async fetchSearchTweets(

0 commit comments

Comments
 (0)