Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions characters/crypto.character.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,8 @@
"Technical Analysis: BTC forming a classic accumulation pattern at key support. Fundamentals remain strong with hash rate at ATH. 📈"
],
"topics": [
"blockchain technology",
"DeFi innovations",
"market analysis",
"institutional adoption",
"regulatory developments",
"technical infrastructure",
"security practices",
"scaling solutions",
"tokenomics",
"sustainable blockchain",
"privacy technologies",
"smart contracts",
"market cycles",
"on-chain metrics",
"crypto education"
"ai",
"artificial intelligence"
],
"style": {
"all": [
Expand Down
7 changes: 7 additions & 0 deletions packages/client-twitter/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const twitterEnvSchema = z.object({
TWITTER_EMAIL: z.string().email("Valid X/Twitter email is required"),
MAX_TWEET_LENGTH: z.number().int().default(DEFAULT_MAX_TWEET_LENGTH),
TWITTER_SEARCH_ENABLE: z.boolean().default(false),
TWITTER_SUMMARIZE_ENABLE: z.boolean().default(false),
TWITTER_2FA_SECRET: z.string(),
TWITTER_RETRY_LIMIT: z.number().int(),
TWITTER_POLL_INTERVAL: z.number().int(),
Expand Down Expand Up @@ -133,6 +134,12 @@ export async function validateTwitterConfig(
process.env.TWITTER_SEARCH_ENABLE
) ?? false,

TWITTER_SUMMARIZE_ENABLE:
parseBooleanFromText(
runtime.getSetting("TWITTER_SUMMARIZE_ENABLE") ||
process.env.TWITTER_SUMMARIZE_ENABLE
) ?? false,

// string passthru
TWITTER_2FA_SECRET:
runtime.getSetting("TWITTER_2FA_SECRET") ||
Expand Down
20 changes: 18 additions & 2 deletions packages/client-twitter/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { TwitterInteractionClient } from "./interactions.ts";
import { TwitterPostClient } from "./post.ts";
import { TwitterSearchClient } from "./search.ts";
import { TwitterSpaceClient } from "./spaces.ts";
import { TwitterSummarizeClient } from "./summarize.ts";

/**
* A manager that orchestrates all specialized Twitter logic:
Expand All @@ -21,6 +22,7 @@ import { TwitterSpaceClient } from "./spaces.ts";
class TwitterManager {
client: ClientBase;
post: TwitterPostClient;
summarize: TwitterSummarizeClient;
search: TwitterSearchClient;
interaction: TwitterInteractionClient;
space?: TwitterSpaceClient;
Expand All @@ -30,7 +32,14 @@ class TwitterManager {
this.client = new ClientBase(runtime, twitterConfig);

// Posting logic
this.post = new TwitterPostClient(this.client, runtime);
if (!twitterConfig.TWITTER_SUMMARIZE_ENABLE) {
this.post = new TwitterPostClient(this.client, runtime);
}

// Summarize and post logic
if (twitterConfig.TWITTER_SUMMARIZE_ENABLE) {
this.summarize = new TwitterSummarizeClient(this.client, runtime);
}

// Optional search logic (enabled if TWITTER_SEARCH_ENABLE is true)
if (twitterConfig.TWITTER_SEARCH_ENABLE) {
Expand Down Expand Up @@ -64,7 +73,14 @@ export const TwitterClientInterface: Client = {
await manager.client.init();

// Start the posting loop
await manager.post.start();
if (!manager.summarize) {
await manager.post.start();
}

// Start the summarize loop
if (manager.summarize) {
await manager.summarize.start();
}

// Start the search logic if it exists
if (manager.search) {
Expand Down
Loading
Loading