refactor: Restructure twitter app with beforeRequest hook
This commit is contained in:
@@ -6,6 +6,7 @@ export default defineTrigger({
|
||||
key: 'myFollowers',
|
||||
pollInterval: 15,
|
||||
description: 'Will be triggered when you have a new follower.',
|
||||
dedupeStrategy: 'unique',
|
||||
substeps: [
|
||||
{
|
||||
key: 'chooseConnection',
|
||||
@@ -18,6 +19,6 @@ export default defineTrigger({
|
||||
],
|
||||
|
||||
async run($) {
|
||||
return await myFollowers($, $.flow.lastInternalId);
|
||||
return await myFollowers($);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -3,13 +3,12 @@ import getCurrentUser from '../../common/get-current-user';
|
||||
import getUserByUsername from '../../common/get-user-by-username';
|
||||
import getUserFollowers from '../../common/get-user-followers';
|
||||
|
||||
const myFollowers = async ($: IGlobalVariable, lastInternalId?: string) => {
|
||||
const myFollowers = async ($: IGlobalVariable) => {
|
||||
const { username } = await getCurrentUser($);
|
||||
const user = await getUserByUsername($, username as string);
|
||||
|
||||
const tweets = await getUserFollowers($, {
|
||||
userId: user.id,
|
||||
lastInternalId,
|
||||
});
|
||||
return tweets;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user