Skip to main content
The Twitter bot feature automates content creation and posting for your Twitter accounts. Generate engaging tweets based on your chosen topics and schedule posts throughout the day.

Overview

MoneyPrinter V2’s Twitter automation handles:

Content Generation

AI creates topic-relevant tweets in your specified language

Automated Posting

Publishes tweets directly through browser automation

Post Scheduling

CRON jobs enable 1-3 daily posts on autopilot

History Tracking

View all posted tweets with timestamps

Setup Requirements

Firefox Profile Configuration

You need a Firefox profile authenticated with your Twitter account:
1

Create Firefox Profile

Launch Firefox and create a new profile via about:profiles
2

Login to Twitter

In the new profile, log into your Twitter/X account
3

Note Profile Path

Record the profile directory path (typically ~/.mozilla/firefox/xxxxxxxx.profile-name)
4

Keep Session Active

Don’t log out—the automation uses this authenticated session

Configuration Settings

In config.json, configure Twitter-specific options:
{
  "twitter_language": "English",
  "headless": false
}
twitter_language
string
default:"English"
Language for generated tweet content
headless
boolean
default:"false"
Run browser in headless mode (no visible window)

Account Management

Creating a Twitter Account

From the main menu, select Twitter Bot and create an account:
=> Generated ID: 123e4567-e89b-12d3-a456-426614174000
=> Enter a nickname for this account: TechTweeter
=> Enter the path to the Firefox profile: /home/user/.mozilla/firefox/xyz789.default
=> Enter the account topic: Artificial Intelligence and Machine Learning

Account Properties

nickname
string
required
Human-readable name for identifying the account in menus
topic
string
required
Content focus for AI-generated tweets (e.g., “Productivity Tips”, “Cryptocurrency News”)
firefox_profile
string
required
Path to Firefox profile logged into target Twitter account

Deleting Accounts

From the account selection menu, type d to delete:
Select an account to start (or 'd' to delete): d
Enter account number to delete: 2
Are you sure you want to delete 'TechTweeter'? (Yes/No): Yes
Account removed successfully!

Tweet Generation

How It Works

The AI generates contextually relevant tweets based on your topic:
def generate_post(self) -> str:
    completion = generate_text(
        f"Generate a Twitter post about: {self.topic} in {get_twitter_language()}. "
        "The Limit is 2 sentences. Choose a specific sub-topic of the provided topic."
    )

    if completion is None:
        error("Failed to generate a post. Please try again.")
        sys.exit(1)

    # Apply Regex to remove all *
    completion = re.sub(r"\*", "", completion).replace('"', "")

    if len(completion) >= 260:
        return completion[:257].rsplit(" ", 1)[0] + "..."

    return completion

Content Characteristics

Length Control

Tweets are limited to 2 sentences, automatically truncated at 260 characters with ”…” if needed

Sub-topic Selection

AI chooses specific angles within your broader topic for variety

Clean Formatting

Markdown symbols and quotes are removed for clean Twitter presentation

Manual Posting

Select Post a Tweet from the Twitter menu:
def post(self, text: Optional[str] = None) -> None:
    bot: webdriver.Firefox = self.browser

    bot.get("https://x.com/compose/post")

    post_content: str = text if text is not None else self.generate_post()
    now: datetime = datetime.now()

    print(colored(" => Posting to Twitter:", "blue"), post_content[:30] + "...")
    body = post_content

    text_box = None
    text_box_selectors = [
        (By.CSS_SELECTOR, "div[data-testid='tweetTextarea_0'][role='textbox']"),
        (By.XPATH, "//div[@data-testid='tweetTextarea_0']//div[@role='textbox']"),
        (By.XPATH, "//div[@role='textbox']"),
    ]

    for selector in text_box_selectors:
        try:
            text_box = self.wait.until(EC.element_to_be_clickable(selector))
            text_box.click()
            text_box.send_keys(body)
            break
        except Exception:
            continue

    if text_box is None:
        raise RuntimeError(
            "Could not find tweet text box. Ensure you are logged into X in this Firefox profile."
        )

Posting Process

1

Navigate to Compose

Opens Twitter’s compose screen (https://x.com/compose/post)
2

Generate Content

AI creates a tweet based on your account topic (or uses provided text)
3

Find Text Box

Uses multiple selectors to locate the tweet input field
4

Input Text

Enters the generated content into the text box
5

Click Post

Finds and clicks the Post button using multiple fallback selectors
6

Cache Update

Saves tweet content and timestamp to local cache

CRON Scheduling

Automate posting with scheduled jobs:

Schedule Options

From the Twitter menu, select Setup a CRON Job:

Once Daily

Post one tweet per day

Twice Daily

Post at 10:00 AM and 4:00 PM

Thrice Daily

Post at 8:00 AM, 12:00 PM, and 6:00 PM

Implementation

info("How often do you want to post?")

info("\n============ OPTIONS ============", False)
for idx, cron_option in enumerate(TWITTER_CRON_OPTIONS):
    print(colored(f" {idx + 1}. {cron_option}", "cyan"))

info("=================================\n", False)

user_input = int(question("Select an Option: "))

cron_script_path = os.path.join(ROOT_DIR, "src", "cron.py")
command = ["python", cron_script_path, "twitter", selected_account['id'], get_active_model()]

def job():
    subprocess.run(command)

if user_input == 1:
    # Post Once a day
    schedule.every(1).day.do(job)
    success("Set up CRON Job.")
elif user_input == 2:
    # Post twice a day
    schedule.every().day.at("10:00").do(job)
    schedule.every().day.at("16:00").do(job)
    success("Set up CRON Job.")
elif user_input == 3:
    # Post thrice a day
    schedule.every().day.at("08:00").do(job)
    schedule.every().day.at("12:00").do(job)
    schedule.every().day.at("18:00").do(job)
    success("Set up CRON Job.")
CRON jobs run while the script is active. For persistent automation, consider:
  • Running in a screen or tmux session
  • Setting up a systemd service
  • Using system-level crontab entries

Post History

View all posted tweets by selecting View Posted Tweets:
+----+---------------------+--------------------------------------------------------------+
| ID | Date                | Content                                                      |
+----+---------------------+--------------------------------------------------------------+
| 1  | 03/01/2026, 10:30:15| Machine learning is revolutionizing healthcare diagnosis...  |
| 2  | 03/01/2026, 16:45:33| Neural networks can now predict protein structures with...   |
| 3  | 03/02/2026, 08:12:09| AI-powered code completion is changing how developers...     |
+----+---------------------+--------------------------------------------------------------+

Cache Structure

Post history is stored in .mp/cache/twitter_cache.json:
{
  "accounts": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "nickname": "TechTweeter",
      "firefox_profile": "/path/to/profile",
      "topic": "Artificial Intelligence",
      "posts": [
        {
          "content": "Machine learning is revolutionizing...",
          "date": "03/01/2026, 10:30:15"
        }
      ]
    }
  ]
}

Troubleshooting

Cause: Firefox profile is not properly logged into Twitter, or Twitter’s UI has changed.Solution:
  1. Manually open the Firefox profile and verify you’re logged in
  2. Try visiting https://x.com/compose/post to ensure access
  3. Check if Twitter requires additional verification
Cause: Twitter’s DOM structure changed, or rate limiting is active.Solution:
  1. The code uses multiple fallback selectors—check if all fail
  2. Verify you’re not rate-limited (Twitter has posting limits)
  3. Check verbose logs for specific error messages
Cause: Topic description is too broad or vague.Solution:
  1. Use more specific topics (“Web3 DeFi protocols” vs. “Crypto”)
  2. Include style guidance in the topic (“Educational Python tips”)
  3. Monitor generated content and refine topic wording
Cause: Script terminated or schedule not persistent.Solution:
  1. Keep the script running in a persistent session (screen/tmux)
  2. Check logs for errors during scheduled runs
  3. Verify system time is correct for scheduled times

Best Practices

Topic Specificity

Use narrow, focused topics for better content quality. “React Hooks best practices” > “Web development”

Posting Frequency

Start with 1-2 posts daily. Twitter algorithms favor consistency over volume.

Content Review

Monitor generated tweets initially to ensure quality meets your standards.

Rate Limits

Be aware of Twitter’s posting limits (varies by account age and verification).

Engagement Strategy

Automated posting works best when combined with manual engagement and replies.

Account Diversity

Run multiple accounts with different niches to diversify your reach.

Integration with Other Features

The Twitter bot integrates with:

Affiliate Marketing

Share product pitches through your Twitter accounts:
def share_pitch(self, where: str) -> None:
    if where == "twitter":
        # Initialize the Twitter class
        twitter: Twitter = Twitter(
            self.account_uuid,
            self.account_nickname,
            self._fp_profile_path,
            self.topic,
        )

        # Share the pitch
        twitter.post(self.pitch)
See the Affiliate Marketing docs for details.

Advanced Usage

Custom Tweet Content

Post specific content instead of AI-generated:
twitter = Twitter(account_uuid, nickname, profile_path, topic)
twitter.post(text="Your custom tweet content here")

Programmatic Integration

from classes.Twitter import Twitter

# Initialize bot
bot = Twitter(
    account_uuid="your-uuid",
    account_nickname="MyBot",
    fp_profile_path="/path/to/profile",
    topic="Your Topic"
)

# Post a tweet
bot.post()

# Get post history
posts = bot.get_posts()
for post in posts:
    print(f"{post['date']}: {post['content']}")

Source Code Reference

  • Twitter bot implementation: src/classes/Twitter.py
  • Menu interface: src/main.py:216-352
  • CRON automation: src/cron.py
  • Cache management: src/cache.py

Build docs developers (and LLMs) love