@elizaos/plugin-twitter 1.2.3 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _elizaos_core from '@elizaos/core';
2
- import { Service, IAgentRuntime, Memory, UUID, State, ChannelType } from '@elizaos/core';
2
+ import { IAgentRuntime, Memory, UUID, State, ChannelType, Service } from '@elizaos/core';
3
3
  import * as twitter_api_v2 from 'twitter-api-v2';
4
4
  import { TwitterApi, PollV2, TTweetv2Expansion, TTweetv2TweetField, TTweetv2PollField, TTweetv2MediaField, TTweetv2UserField, TTweetv2PlaceField } from 'twitter-api-v2';
5
5
 
@@ -762,16 +762,6 @@ declare class Client {
762
762
  fetchQuotedTweetsPage(tweetId: string, maxQuotes?: number, cursor?: string): Promise<QueryTweetsResponse>;
763
763
  }
764
764
 
765
- declare class TwitterService extends Service {
766
- static serviceType: string;
767
- capabilityDescription: string;
768
- private static instance;
769
- constructor(runtime?: IAgentRuntime);
770
- static getInstance(): TwitterService;
771
- static start(runtime: IAgentRuntime): Promise<TwitterService>;
772
- stop(): Promise<void>;
773
- }
774
-
775
765
  /**
776
766
  * Class representing a Twitter post client for generating and posting tweets.
777
767
  */
@@ -817,13 +807,11 @@ declare class TwitterPostClient {
817
807
  * @property {ClientBase} client - The base client for Twitter operations.
818
808
  * @property {TwitterPostClient} post - The client for managing Twitter posts.
819
809
  * @property {TwitterInteractionClient} interaction - The client for managing Twitter interactions.
820
- * @property {TwitterService} service - The main Twitter service instance.
821
810
  */
822
811
  interface ITwitterClient {
823
812
  client: ClientBase;
824
813
  post: TwitterPostClient;
825
814
  interaction: TwitterInteractionClient;
826
- service: TwitterService;
827
815
  }
828
816
  /**
829
817
  * Twitter-specific tweet type
@@ -1200,6 +1188,14 @@ declare class TwitterDiscoveryClient {
1200
1188
  private delay;
1201
1189
  }
1202
1190
 
1191
+ declare class TwitterService extends Service {
1192
+ static serviceType: string;
1193
+ capabilityDescription: string;
1194
+ constructor();
1195
+ static start(runtime: IAgentRuntime): Promise<TwitterService>;
1196
+ stop(): Promise<void>;
1197
+ }
1198
+
1203
1199
  /**
1204
1200
  * A manager that orchestrates all specialized Twitter logic:
1205
1201
  * - client: base operations (login, timeline caching, etc.)
@@ -1214,7 +1210,6 @@ declare class TwitterClientInstance implements ITwitterClient {
1214
1210
  interaction: TwitterInteractionClient;
1215
1211
  timeline?: TwitterTimelineClient;
1216
1212
  discovery?: TwitterDiscoveryClient;
1217
- service: TwitterService;
1218
1213
  constructor(runtime: IAgentRuntime, state: any);
1219
1214
  }
1220
1215
  declare function startTwitterClient(runtime: IAgentRuntime): Promise<void>;
package/dist/index.js CHANGED
@@ -6078,7 +6078,13 @@ function getTargetUsers(targetUsersConfig) {
6078
6078
  return users.filter((u) => u !== "*");
6079
6079
  }
6080
6080
  function getSetting(runtime, key, defaultValue) {
6081
- return runtime.getSetting(key) ?? process.env[key] ?? defaultValue;
6081
+ if (runtime && typeof runtime.getSetting === "function") {
6082
+ const value = runtime.getSetting(key);
6083
+ if (value !== void 0 && value !== null) {
6084
+ return String(value);
6085
+ }
6086
+ }
6087
+ return process.env[key] ?? defaultValue;
6082
6088
  }
6083
6089
  async function validateTwitterConfig(runtime, config = {}) {
6084
6090
  try {
@@ -6117,6 +6123,17 @@ async function validateTwitterConfig(runtime, config = {}) {
6117
6123
  }
6118
6124
  }
6119
6125
 
6126
+ // src/utils/settings.ts
6127
+ function getSetting2(runtime, key, defaultValue) {
6128
+ if (runtime && typeof runtime.getSetting === "function") {
6129
+ const value = runtime.getSetting(key);
6130
+ if (value !== void 0 && value !== null) {
6131
+ return String(value);
6132
+ }
6133
+ }
6134
+ return process.env[key] ?? defaultValue;
6135
+ }
6136
+
6120
6137
  // src/interactions.ts
6121
6138
  var TwitterInteractionClient = class {
6122
6139
  /**
@@ -6132,7 +6149,7 @@ var TwitterInteractionClient = class {
6132
6149
  this.client = client;
6133
6150
  this.runtime = runtime;
6134
6151
  this.state = state;
6135
- const dryRunSetting = this.state?.TWITTER_DRY_RUN ?? this.runtime.getSetting("TWITTER_DRY_RUN") ?? process.env.TWITTER_DRY_RUN;
6152
+ const dryRunSetting = this.state?.TWITTER_DRY_RUN ?? getSetting2(this.runtime, "TWITTER_DRY_RUN") ?? process.env.TWITTER_DRY_RUN;
6136
6153
  this.isDryRun = dryRunSetting === true || dryRunSetting === "true" || typeof dryRunSetting === "string" && dryRunSetting.toLowerCase() === "true";
6137
6154
  }
6138
6155
  /**
@@ -6147,7 +6164,7 @@ var TwitterInteractionClient = class {
6147
6164
  return;
6148
6165
  }
6149
6166
  const engagementIntervalMinutes = parseInt(
6150
- this.state?.TWITTER_ENGAGEMENT_INTERVAL || this.runtime.getSetting("TWITTER_ENGAGEMENT_INTERVAL") || process.env.TWITTER_ENGAGEMENT_INTERVAL || "30"
6167
+ this.state?.TWITTER_ENGAGEMENT_INTERVAL || getSetting2(this.runtime, "TWITTER_ENGAGEMENT_INTERVAL") || process.env.TWITTER_ENGAGEMENT_INTERVAL || "30"
6151
6168
  );
6152
6169
  const interactionInterval = engagementIntervalMinutes * 60 * 1e3;
6153
6170
  logger3.info(`Twitter interaction client will check every ${engagementIntervalMinutes} minutes`);
@@ -6172,11 +6189,11 @@ var TwitterInteractionClient = class {
6172
6189
  logger3.log("Checking Twitter interactions");
6173
6190
  const twitterUsername = this.client.profile?.username;
6174
6191
  try {
6175
- const repliesEnabled = (this.runtime.getSetting("TWITTER_ENABLE_REPLIES") ?? process.env.TWITTER_ENABLE_REPLIES) !== "false";
6192
+ const repliesEnabled = (getSetting2(this.runtime, "TWITTER_ENABLE_REPLIES") ?? process.env.TWITTER_ENABLE_REPLIES) !== "false";
6176
6193
  if (repliesEnabled) {
6177
6194
  await this.handleMentions(twitterUsername);
6178
6195
  }
6179
- const targetUsersConfig = (this.runtime.getSetting("TWITTER_TARGET_USERS") ?? process.env.TWITTER_TARGET_USERS) || "";
6196
+ const targetUsersConfig = (getSetting2(this.runtime, "TWITTER_TARGET_USERS") ?? process.env.TWITTER_TARGET_USERS) || "";
6180
6197
  if (targetUsersConfig?.trim()) {
6181
6198
  await this.handleTargetUserPosts(targetUsersConfig);
6182
6199
  }
@@ -6250,7 +6267,7 @@ var TwitterInteractionClient = class {
6250
6267
  */
6251
6268
  async processTargetUserTweets(tweets, username) {
6252
6269
  const maxEngagementsPerRun = parseInt(
6253
- this.runtime.getSetting("TWITTER_MAX_ENGAGEMENTS_PER_RUN") || process.env.TWITTER_MAX_ENGAGEMENTS_PER_RUN || "10"
6270
+ getSetting2(this.runtime, "TWITTER_MAX_ENGAGEMENTS_PER_RUN") || process.env.TWITTER_MAX_ENGAGEMENTS_PER_RUN || "10"
6254
6271
  );
6255
6272
  let engagementCount = 0;
6256
6273
  for (const tweet of tweets) {
@@ -6446,7 +6463,7 @@ Response (YES/NO):`;
6446
6463
  );
6447
6464
  let uniqueTweetCandidates = [...mentionCandidates];
6448
6465
  uniqueTweetCandidates = uniqueTweetCandidates.sort((a, b) => a.id.localeCompare(b.id)).filter((tweet) => tweet.userId !== this.client.profile.id);
6449
- const targetUsersConfig = (this.runtime.getSetting("TWITTER_TARGET_USERS") ?? process.env.TWITTER_TARGET_USERS) || "";
6466
+ const targetUsersConfig = (getSetting2(this.runtime, "TWITTER_TARGET_USERS") ?? process.env.TWITTER_TARGET_USERS) || "";
6450
6467
  if (targetUsersConfig?.trim()) {
6451
6468
  uniqueTweetCandidates = uniqueTweetCandidates.filter((tweet) => {
6452
6469
  const shouldTarget = shouldTargetUser(
@@ -6462,7 +6479,7 @@ Response (YES/NO):`;
6462
6479
  });
6463
6480
  }
6464
6481
  const maxInteractionsPerRun = parseInt(
6465
- this.runtime.getSetting("TWITTER_MAX_ENGAGEMENTS_PER_RUN") || process.env.TWITTER_MAX_ENGAGEMENTS_PER_RUN || "10"
6482
+ getSetting2(this.runtime, "TWITTER_MAX_ENGAGEMENTS_PER_RUN") || process.env.TWITTER_MAX_ENGAGEMENTS_PER_RUN || "10"
6466
6483
  );
6467
6484
  const tweetsToProcess = uniqueTweetCandidates.slice(0, maxInteractionsPerRun);
6468
6485
  logger3.info(`Processing ${tweetsToProcess.length} of ${uniqueTweetCandidates.length} mention tweets (max: ${maxInteractionsPerRun})`);
@@ -6821,14 +6838,14 @@ var TwitterPostClient = class {
6821
6838
  this.client = client;
6822
6839
  this.state = state;
6823
6840
  this.runtime = runtime;
6824
- const dryRunSetting = this.state?.TWITTER_DRY_RUN ?? this.runtime.getSetting("TWITTER_DRY_RUN") ?? process.env.TWITTER_DRY_RUN;
6841
+ const dryRunSetting = this.state?.TWITTER_DRY_RUN ?? getSetting2(this.runtime, "TWITTER_DRY_RUN") ?? process.env.TWITTER_DRY_RUN;
6825
6842
  this.isDryRun = dryRunSetting === true || dryRunSetting === "true" || typeof dryRunSetting === "string" && dryRunSetting.toLowerCase() === "true";
6826
6843
  logger4.log("Twitter Post Client Configuration:");
6827
6844
  logger4.log(`- Dry Run Mode: ${this.isDryRun ? "Enabled" : "Disabled"}`);
6828
- const postInterval = parseInt(
6829
- this.state?.TWITTER_POST_INTERVAL || this.runtime.getSetting("TWITTER_POST_INTERVAL") || process.env.TWITTER_POST_INTERVAL || "120"
6845
+ const postIntervalMinutes = parseInt(
6846
+ this.state?.TWITTER_POST_INTERVAL || getSetting2(this.runtime, "TWITTER_POST_INTERVAL") || process.env.TWITTER_POST_INTERVAL || "120"
6830
6847
  );
6831
- logger4.log(`- Post Interval: ${postInterval} minutes`);
6848
+ logger4.log(`- Post Interval: ${postIntervalMinutes} minutes`);
6832
6849
  }
6833
6850
  /**
6834
6851
  * Stops the Twitter post client
@@ -6849,7 +6866,7 @@ var TwitterPostClient = class {
6849
6866
  return;
6850
6867
  }
6851
6868
  const postIntervalMinutes = parseInt(
6852
- this.state?.TWITTER_POST_INTERVAL || this.runtime.getSetting("TWITTER_POST_INTERVAL") || process.env.TWITTER_POST_INTERVAL || "120"
6869
+ this.state?.TWITTER_POST_INTERVAL || getSetting2(this.runtime, "TWITTER_POST_INTERVAL") || process.env.TWITTER_POST_INTERVAL || "120"
6853
6870
  );
6854
6871
  const interval = postIntervalMinutes * 60 * 1e3;
6855
6872
  logger4.info(`Next tweet scheduled in ${postIntervalMinutes} minutes`);
@@ -6860,7 +6877,7 @@ var TwitterPostClient = class {
6860
6877
  };
6861
6878
  await new Promise((resolve) => setTimeout(resolve, 1e3));
6862
6879
  const postImmediately = parseInt(
6863
- this.state?.TWITTER_POST_INTERVAL || this.runtime.getSetting("TWITTER_POST_INTERVAL") || process.env.TWITTER_POST_INTERVAL || "120"
6880
+ this.state?.TWITTER_POST_INTERVAL || getSetting2(this.runtime, "TWITTER_POST_INTERVAL") || process.env.TWITTER_POST_INTERVAL || "120"
6864
6881
  ) === 0;
6865
6882
  if (postImmediately) {
6866
6883
  logger4.info("TWITTER_POST_IMMEDIATELY is true, generating initial tweet now");
@@ -7076,9 +7093,10 @@ var TwitterTimelineClient = class {
7076
7093
  this.twitterClient = client.twitterClient;
7077
7094
  this.runtime = runtime;
7078
7095
  this.state = state;
7079
- const dryRunSetting = this.state?.TWITTER_DRY_RUN ?? this.runtime.getSetting("TWITTER_DRY_RUN") ?? process.env.TWITTER_DRY_RUN;
7096
+ const dryRunSetting = this.state?.TWITTER_DRY_RUN ?? getSetting2(this.runtime, "TWITTER_DRY_RUN") ?? process.env.TWITTER_DRY_RUN;
7080
7097
  this.isDryRun = dryRunSetting === true || dryRunSetting === "true" || typeof dryRunSetting === "string" && dryRunSetting.toLowerCase() === "true";
7081
- this.timelineType = (this.runtime.getSetting("TWITTER_TIMELINE_MODE") ?? process.env.TWITTER_TIMELINE_MODE) || "foryou" /* ForYou */;
7098
+ const timelineMode = getSetting2(this.runtime, "TWITTER_TIMELINE_MODE") ?? process.env.TWITTER_TIMELINE_MODE;
7099
+ this.timelineType = timelineMode === "following" /* Following */ ? "following" /* Following */ : "foryou" /* ForYou */;
7082
7100
  }
7083
7101
  async start() {
7084
7102
  logger5.info("Starting Twitter timeline client...");
@@ -7089,7 +7107,7 @@ var TwitterTimelineClient = class {
7089
7107
  return;
7090
7108
  }
7091
7109
  const engagementIntervalMinutes = parseInt(
7092
- this.state?.TWITTER_ENGAGEMENT_INTERVAL || this.runtime.getSetting("TWITTER_ENGAGEMENT_INTERVAL") || process.env.TWITTER_ENGAGEMENT_INTERVAL || "30"
7110
+ this.state?.TWITTER_ENGAGEMENT_INTERVAL || getSetting2(this.runtime, "TWITTER_ENGAGEMENT_INTERVAL") || process.env.TWITTER_ENGAGEMENT_INTERVAL || "30"
7093
7111
  );
7094
7112
  const actionInterval = engagementIntervalMinutes * 60 * 1e3;
7095
7113
  logger5.info(`Timeline client will check every ${engagementIntervalMinutes} minutes`);
@@ -7135,7 +7153,7 @@ var TwitterTimelineClient = class {
7135
7153
  const tweets = await this.getTimeline(20);
7136
7154
  logger5.info(`Fetched ${tweets.length} tweets from timeline`);
7137
7155
  const maxActionsPerCycle = parseInt(
7138
- this.runtime.getSetting("TWITTER_MAX_ENGAGEMENTS_PER_RUN") || process.env.TWITTER_MAX_ENGAGEMENTS_PER_RUN || "10"
7156
+ getSetting2(this.runtime, "TWITTER_MAX_ENGAGEMENTS_PER_RUN") || process.env.TWITTER_MAX_ENGAGEMENTS_PER_RUN || "10"
7139
7157
  );
7140
7158
  const tweetDecisions = [];
7141
7159
  for (const tweet of tweets) {
@@ -7433,7 +7451,7 @@ var TwitterDiscoveryClient = class {
7433
7451
  this.client = client;
7434
7452
  this.twitterClient = client.twitterClient;
7435
7453
  this.runtime = runtime;
7436
- const dryRunSetting = state?.TWITTER_DRY_RUN ?? this.runtime.getSetting("TWITTER_DRY_RUN") ?? process.env.TWITTER_DRY_RUN;
7454
+ const dryRunSetting = state?.TWITTER_DRY_RUN ?? getSetting2(this.runtime, "TWITTER_DRY_RUN") ?? process.env.TWITTER_DRY_RUN;
7437
7455
  this.isDryRun = dryRunSetting === true || dryRunSetting === "true" || typeof dryRunSetting === "string" && dryRunSetting.toLowerCase() === "true";
7438
7456
  this.config = this.buildDiscoveryConfig();
7439
7457
  logger6.info("Twitter Discovery Config:", {
@@ -7450,13 +7468,13 @@ var TwitterDiscoveryClient = class {
7450
7468
  return {
7451
7469
  topics,
7452
7470
  minFollowerCount: parseInt(
7453
- this.runtime.getSetting("TWITTER_MIN_FOLLOWER_COUNT") || process.env.TWITTER_MIN_FOLLOWER_COUNT || "100"
7471
+ getSetting2(this.runtime, "TWITTER_MIN_FOLLOWER_COUNT") || process.env.TWITTER_MIN_FOLLOWER_COUNT || "100"
7454
7472
  ),
7455
7473
  maxFollowsPerCycle: parseInt(
7456
- this.runtime.getSetting("TWITTER_MAX_FOLLOWS_PER_CYCLE") || process.env.TWITTER_MAX_FOLLOWS_PER_CYCLE || "5"
7474
+ getSetting2(this.runtime, "TWITTER_MAX_FOLLOWS_PER_CYCLE") || process.env.TWITTER_MAX_FOLLOWS_PER_CYCLE || "5"
7457
7475
  ),
7458
7476
  maxEngagementsPerCycle: parseInt(
7459
- this.runtime.getSetting("TWITTER_MAX_ENGAGEMENTS_PER_RUN") || process.env.TWITTER_MAX_ENGAGEMENTS_PER_RUN || "10"
7477
+ getSetting2(this.runtime, "TWITTER_MAX_ENGAGEMENTS_PER_RUN") || process.env.TWITTER_MAX_ENGAGEMENTS_PER_RUN || "10"
7460
7478
  ),
7461
7479
  likeThreshold: 0.6,
7462
7480
  replyThreshold: 0.8,
@@ -7482,7 +7500,7 @@ var TwitterDiscoveryClient = class {
7482
7500
  logger6.error("Discovery cycle error:", error);
7483
7501
  }
7484
7502
  const baseInterval = parseInt(
7485
- this.runtime.getSetting("TWITTER_DISCOVERY_INTERVAL") || process.env.TWITTER_DISCOVERY_INTERVAL || "30"
7503
+ getSetting2(this.runtime, "TWITTER_DISCOVERY_INTERVAL") || process.env.TWITTER_DISCOVERY_INTERVAL || "30"
7486
7504
  );
7487
7505
  const variance = Math.random() * 20 - 10;
7488
7506
  const nextInterval = (baseInterval + variance) * 60 * 1e3;
@@ -7974,7 +7992,7 @@ var _ClientBase = class _ClientBase {
7974
7992
  this.callback = null;
7975
7993
  this.runtime = runtime;
7976
7994
  this.state = state;
7977
- const apiKey = state?.TWITTER_API_KEY || runtime.getSetting("TWITTER_API_KEY") || process.env.TWITTER_API_KEY;
7995
+ const apiKey = state?.TWITTER_API_KEY || (runtime && typeof runtime.getSetting === "function" ? runtime.getSetting("TWITTER_API_KEY") : null) || process.env.TWITTER_API_KEY;
7978
7996
  if (apiKey && _ClientBase._twitterClients[apiKey]) {
7979
7997
  this.twitterClient = _ClientBase._twitterClients[apiKey];
7980
7998
  } else {
@@ -8038,10 +8056,10 @@ var _ClientBase = class _ClientBase {
8038
8056
  throw new Error("Not implemented in base class, please call from subclass");
8039
8057
  }
8040
8058
  async init() {
8041
- const apiKey = this.state?.TWITTER_API_KEY || this.runtime.getSetting("TWITTER_API_KEY") || process.env.TWITTER_API_KEY;
8042
- const apiSecretKey = this.state?.TWITTER_API_SECRET_KEY || this.runtime.getSetting("TWITTER_API_SECRET_KEY") || process.env.TWITTER_API_SECRET_KEY;
8043
- const accessToken = this.state?.TWITTER_ACCESS_TOKEN || this.runtime.getSetting("TWITTER_ACCESS_TOKEN") || process.env.TWITTER_ACCESS_TOKEN;
8044
- const accessTokenSecret = this.state?.TWITTER_ACCESS_TOKEN_SECRET || this.runtime.getSetting("TWITTER_ACCESS_TOKEN_SECRET") || process.env.TWITTER_ACCESS_TOKEN_SECRET;
8059
+ const apiKey = this.state?.TWITTER_API_KEY || (this.runtime && typeof this.runtime.getSetting === "function" ? this.runtime.getSetting("TWITTER_API_KEY") : null) || process.env.TWITTER_API_KEY;
8060
+ const apiSecretKey = this.state?.TWITTER_API_SECRET_KEY || (this.runtime && typeof this.runtime.getSetting === "function" ? this.runtime.getSetting("TWITTER_API_SECRET_KEY") : null) || process.env.TWITTER_API_SECRET_KEY;
8061
+ const accessToken = this.state?.TWITTER_ACCESS_TOKEN || (this.runtime && typeof this.runtime.getSetting === "function" ? this.runtime.getSetting("TWITTER_ACCESS_TOKEN") : null) || process.env.TWITTER_ACCESS_TOKEN;
8062
+ const accessTokenSecret = this.state?.TWITTER_ACCESS_TOKEN_SECRET || (this.runtime && typeof this.runtime.getSetting === "function" ? this.runtime.getSetting("TWITTER_ACCESS_TOKEN_SECRET") : null) || process.env.TWITTER_ACCESS_TOKEN_SECRET;
8045
8063
  if (!apiKey || !apiSecretKey || !accessToken || !accessTokenSecret) {
8046
8064
  const missing = [];
8047
8065
  if (!apiKey) missing.push("TWITTER_API_KEY");
@@ -8455,21 +8473,15 @@ var ClientBase = _ClientBase;
8455
8473
  // src/services/twitter.service.ts
8456
8474
  import { Service } from "@elizaos/core";
8457
8475
  var _TwitterService = class _TwitterService extends Service {
8458
- constructor(runtime) {
8459
- super(runtime);
8476
+ constructor() {
8477
+ super();
8460
8478
  // Add the required abstract property
8461
8479
  this.capabilityDescription = "The agent is able to send and receive messages on Twitter";
8462
8480
  }
8463
- static getInstance() {
8464
- if (!_TwitterService.instance) {
8465
- _TwitterService.instance = new _TwitterService();
8466
- }
8467
- return _TwitterService.instance;
8468
- }
8469
8481
  static async start(runtime) {
8470
- const instance = _TwitterService.getInstance();
8471
- instance.runtime = runtime;
8472
- return instance;
8482
+ const service = new _TwitterService();
8483
+ service.runtime = runtime;
8484
+ return service;
8473
8485
  }
8474
8486
  async stop() {
8475
8487
  }
@@ -8636,7 +8648,13 @@ View it here: ${tweetUrl}`,
8636
8648
  var TwitterClientInstance = class {
8637
8649
  constructor(runtime, state) {
8638
8650
  this.client = new ClientBase(runtime, state);
8639
- const postEnabledSetting = runtime.getSetting("TWITTER_ENABLE_POST") ?? process.env.TWITTER_ENABLE_POST;
8651
+ const getSetting3 = (key) => {
8652
+ if (runtime && typeof runtime.getSetting === "function") {
8653
+ return runtime.getSetting(key);
8654
+ }
8655
+ return void 0;
8656
+ };
8657
+ const postEnabledSetting = getSetting3("TWITTER_ENABLE_POST") ?? process.env.TWITTER_ENABLE_POST;
8640
8658
  logger9.debug(`TWITTER_ENABLE_POST setting value: ${JSON.stringify(postEnabledSetting)}, type: ${typeof postEnabledSetting}`);
8641
8659
  const postEnabled = postEnabledSetting === "true" || postEnabledSetting === true;
8642
8660
  if (postEnabled) {
@@ -8645,7 +8663,7 @@ var TwitterClientInstance = class {
8645
8663
  } else {
8646
8664
  logger9.info("Twitter posting is DISABLED - set TWITTER_ENABLE_POST=true to enable automatic posting");
8647
8665
  }
8648
- const repliesEnabled = (runtime.getSetting("TWITTER_ENABLE_REPLIES") ?? process.env.TWITTER_ENABLE_REPLIES) !== "false";
8666
+ const repliesEnabled = (getSetting3("TWITTER_ENABLE_REPLIES") ?? process.env.TWITTER_ENABLE_REPLIES) !== "false";
8649
8667
  if (repliesEnabled) {
8650
8668
  logger9.info("Twitter replies/interactions are ENABLED");
8651
8669
  this.interaction = new TwitterInteractionClient(
@@ -8656,21 +8674,20 @@ var TwitterClientInstance = class {
8656
8674
  } else {
8657
8675
  logger9.info("Twitter replies/interactions are DISABLED");
8658
8676
  }
8659
- const actionsEnabled = (runtime.getSetting("TWITTER_ENABLE_ACTIONS") ?? process.env.TWITTER_ENABLE_ACTIONS) === "true";
8677
+ const actionsEnabled = (getSetting3("TWITTER_ENABLE_ACTIONS") ?? process.env.TWITTER_ENABLE_ACTIONS) === "true";
8660
8678
  if (actionsEnabled) {
8661
8679
  logger9.info("Twitter timeline actions are ENABLED");
8662
8680
  this.timeline = new TwitterTimelineClient(this.client, runtime, state);
8663
8681
  } else {
8664
8682
  logger9.info("Twitter timeline actions are DISABLED");
8665
8683
  }
8666
- const discoveryEnabled = (runtime.getSetting("TWITTER_ENABLE_DISCOVERY") ?? process.env.TWITTER_ENABLE_DISCOVERY) === "true" || actionsEnabled && (runtime.getSetting("TWITTER_ENABLE_DISCOVERY") ?? process.env.TWITTER_ENABLE_DISCOVERY) !== "false";
8684
+ const discoveryEnabled = (getSetting3("TWITTER_ENABLE_DISCOVERY") ?? process.env.TWITTER_ENABLE_DISCOVERY) === "true" || actionsEnabled && (getSetting3("TWITTER_ENABLE_DISCOVERY") ?? process.env.TWITTER_ENABLE_DISCOVERY) !== "false";
8667
8685
  if (discoveryEnabled) {
8668
8686
  logger9.info("Twitter discovery service is ENABLED");
8669
8687
  this.discovery = new TwitterDiscoveryClient(this.client, runtime, state);
8670
8688
  } else {
8671
8689
  logger9.info("Twitter discovery service is DISABLED - set TWITTER_ENABLE_DISCOVERY=true to enable");
8672
8690
  }
8673
- this.service = TwitterService.getInstance();
8674
8691
  }
8675
8692
  };
8676
8693
  async function startTwitterClient(runtime) {
@@ -8680,7 +8697,7 @@ async function startTwitterClient(runtime) {
8680
8697
  logger9.log("\u2705 Twitter configuration validated successfully");
8681
8698
  const twitterClient = new TwitterClientInstance(runtime, {});
8682
8699
  await twitterClient.client.init();
8683
- runtime.registerService(TwitterService);
8700
+ await runtime.registerService(TwitterService);
8684
8701
  if (twitterClient.post) {
8685
8702
  logger9.log("\u{1F4EE} Starting Twitter post client...");
8686
8703
  await twitterClient.post.start();