npm package: @mawdbotsonsolana/twitter
Description: MawdBot — Autonomous Twitter/X agent powered by OpenClaw, Grok, and 20+ services
Latest version: 0.1.0

# Twitter/X Extension for Clawdbot

Enable @mawdbot to tweet, search, and interact with Twitter/X autonomously.

## 🚀 Features

- **Post Tweets** - Create new tweets with text and media
- **Reply & Quote** - Respond to or quote other tweets
- **Search** - Find tweets by keywords
- **Timeline** - View your timeline or any user's timeline
- **User Lookup** - Get profile information
- **Engagement** - Like, retweet, follow/unfollow
- **Mentions** - Check who's talking about you

## 🚀 Migration & Bootstrap

To deploy the autonomous agent on a new server or environment:

1. **Clone the repository** and navigate to this folder.
2. **Run the bootstrap script**:
   ```bash
   chmod +x bootstrap.sh
   ./bootstrap.sh
   ```
   This will:
   - Check for Node.js
   - Create `.env` from `.env.example` (if missing)
   - Install dependencies
   - Build the project

3. **Configure Environment**:
   Edit `.env` and fill in your API keys (Twitter, Gemini, Birdeye, etc.).

4. **Start the Agent**:
   ```bash
   npx pm2 start mawdbot-autonomous.ts --name mawdbot-autonomous
   ```

## 🔐 Environment Variables

Copy `.env.example` to `.env` and configure:

```bash
# Twitter (OAuth 1.0a - "Read and Write" permissions required)
TWITTER_CONSUMER_KEY=...
TWITTER_CONSUMER_KEY_SECRET=...
TWITTER_ACCESS_TOKEN=...
TWITTER_ACCESS_TOKEN_SECRET=...

# Google Gemini (Image Generation)
GOOGLE_API_KEY=...

# Solana Data
HELIUS_RPC_URL=...
BIRDEYE_API_KEY=...
```

## 🤖 Autonomous Mode

The `mawdbot-autonomous.ts` script runs the agent 24/7 with the following schedule:
- **Images:** Every 60 mins (Gemini Nano Banana Pro)
- **Market Updates:** Every 17 mins (Birdeye liquidity)
- **Hourly Trending:** Top 5 tokens every hour
- **Engagement:** Monitors @0rdlibrary and mentions every 1-2 mins

## 🎯 AI Agent Tools

The extension registers these tools for natural language interaction:

| Tool | Description |
|------|-------------|
| `twitter_tweet` | Post a new tweet |
| `twitter_tweet_with_media` | Post tweet with images |
| `twitter_reply` | Reply to a tweet |
| `twitter_quote` | Quote tweet |
| `twitter_delete` | Delete a tweet |
| `twitter_search` | Search for tweets |
| `twitter_get_tweet` | Get tweet details by ID |
| `twitter_get_user` | Get user profile |
| `twitter_get_timeline` | Get user's timeline |
| `twitter_get_my_timeline` | Get your own timeline |
| `twitter_like` | Like a tweet |
| `twitter_unlike` | Unlike a tweet |
| `twitter_retweet` | Retweet |
| `twitter_unretweet` | Undo retweet |
| `twitter_follow` | Follow a user |
| `twitter_unfollow` | Unfollow a user |
| `twitter_get_mentions` | Get mentions |
| `twitter_get_profile` | Get your profile |

## 💬 Usage Examples

Talk to the bot naturally via Telegram:

```
"Tweet: Hello World! 👋"
"Reply to tweet 123456 saying thanks!"
"Search for tweets about Solana"
"What's @elonmusk latest tweet?"
"Like the tweet 789012"
"Who mentioned me recently?"
```

## 🏗️ Build

```bash
cd extensions/twitter
pnpm install
pnpm build
```

## 📁 Structure

```
extensions/twitter/
├── src/
│   ├── services/
│   │   └── twitter-service.ts    # Twitter API wrapper
│   ├── tools/
│   │   └── twitter-tools.ts      # AI agent tools
│   ├── plugin.ts                 # Plugin registration
│   └── index.ts                  # Main export
├── package.json
├── tsconfig.json
└── README.md
```

## 🔗 Links

- **Twitter Account:** [@mawdbot](https://twitter.com/mawdbot)
- **Twitter API:** [Developer Portal](https://developer.twitter.com/)
- **twitter-api-v2:** [npm package](https://www.npmjs.com/package/twitter-api-v2)

## 📄 License

MIT