diff --git a/.env.example b/.env.example index fefab24223..b9a808d756 100644 --- a/.env.example +++ b/.env.example @@ -34,6 +34,7 @@ TWITTER_PASSWORD= # Account password TWITTER_EMAIL= # Account email TWITTER_2FA_SECRET= TWITTER_COOKIES= # Account cookies +TWITTER_POLL_INTERVAL=120 # How often (in seconds) the bot should check for interactions X_SERVER_URL= XAI_API_KEY= XAI_MODEL= diff --git a/packages/client-twitter/src/base.ts b/packages/client-twitter/src/base.ts index 336759b5fa..c7f75de260 100644 --- a/packages/client-twitter/src/base.ts +++ b/packages/client-twitter/src/base.ts @@ -178,7 +178,7 @@ export class ClientBase extends EventEmitter { username, this.runtime.getSetting("TWITTER_PASSWORD"), this.runtime.getSetting("TWITTER_EMAIL"), - this.runtime.getSetting("TWITTER_2FA_SECRET") + this.runtime.getSetting("TWITTER_2FA_SECRET") || undefined ); if (await this.twitterClient.isLoggedIn()) { diff --git a/packages/client-twitter/src/interactions.ts b/packages/client-twitter/src/interactions.ts index f723b613ba..55814ebc89 100644 --- a/packages/client-twitter/src/interactions.ts +++ b/packages/client-twitter/src/interactions.ts @@ -96,8 +96,10 @@ export class TwitterInteractionClient { this.handleTwitterInteractions(); setTimeout( handleTwitterInteractionsLoop, - (Math.floor(Math.random() * (5 - 2 + 1)) + 2) * 60 * 1000 - ); // Random interval between 2-5 minutes + Number( + this.runtime.getSetting("TWITTER_POLL_INTERVAL") || 120 + ) * 1000 // Default to 2 minutes + ); }; handleTwitterInteractionsLoop(); }