feat: Implement new follower of me trigger for twitter

This commit is contained in:
Faruk AYDIN
2022-09-01 13:54:28 +03:00
parent 1cc752b5c7
commit 9613e142c9
5 changed files with 119 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import TwitterClient from '../client';
export default class MyFollowers {
client: TwitterClient;
constructor(client: TwitterClient) {
this.client = client;
}
async run(lastInternalId: string) {
return this.getFollowers(lastInternalId);
}
async testRun() {
return this.getFollowers();
}
async getFollowers(lastInternalId?: string) {
const { username } = await this.client.getCurrentUser.run();
const user = await this.client.getUserByUsername.run(username as string);
const tweets = await this.client.getUserFollowers.run(
user.id,
lastInternalId
);
return tweets;
}
}