ClawSkills logoClawSkills

x-twitter

与 Twitter/X 交互——读取推文、搜索、发布、点赞、转推和管理您的时间线。

介绍

# twitter-openclaw 🐦‍⬛

通过 OpenClaw 与 Twitter/X 的帖子、时间线和用户进行交互。

## 身份验证

需要设置 Twitter API Bearer Token 为 `TWITTER_BEARER_TOKEN`。

可以选择设置 `TWITTER_API_KEY` 和 `TWITTER_API_SECRET` 以执行写入操作(发布、点赞、转推)。

运行 `twclaw auth-check` 以验证凭据。

## 命令

### 读取

```bash twclaw read <tweet-url-or-id> # Read a single tweet with full metadata twclaw thread <tweet-url-or-id> # Read full conversation thread twclaw replies <tweet-url-or-id> -n 20 # List replies to a tweet twclaw user <@handle> # Show user profile info twclaw user-tweets <@handle> -n 20 # User's recent tweets ```

### 时间线

```bash twclaw home -n 20 # Home timeline twclaw mentions -n 10 # Your mentions twclaw likes <@handle> -n 10 # User's liked tweets ```

### 搜索

```bash twclaw search "query" -n 10 # Search tweets twclaw search "from:elonmusk AI" -n 5 # Search with operators twclaw search "#trending" --recent # Recent tweets only twclaw search "query" --popular # Popular tweets only ```

### 趋势

```bash twclaw trending # Trending topics worldwide twclaw trending --woeid 23424977 # Trending in specific location ```

### 发布

```bash twclaw tweet "hello world" # Post a tweet twclaw reply <tweet-url-or-id> "great thread!" # Reply to a tweet twclaw quote <tweet-url-or-id> "interesting take" # Quote tweet twclaw tweet "look at this" --media image.png # Tweet with media ```

### 互动

```bash twclaw like <tweet-url-or-id> # Like a tweet twclaw unlike <tweet-url-or-id> # Unlike a tweet twclaw retweet <tweet-url-or-id> # Retweet twclaw unretweet <tweet-url-or-id> # Undo retweet twclaw bookmark <tweet-url-or-id> # Bookmark a tweet twclaw unbookmark <tweet-url-or-id> # Remove bookmark ```

### 关注

```bash twclaw follow <@handle> # Follow user twclaw unfollow <@handle> # Unfollow user twclaw followers <@handle> -n 20 # List followers twclaw following <@handle> -n 20 # List following ```

### 列表

```bash twclaw lists # Your lists twclaw list-timeline <list-id> -n 20 # Tweets from a list twclaw list-add <list-id> <@handle> # Add user to list twclaw list-remove <list-id> <@handle> # Remove user from list ```

## 输出选项

```bash --json # JSON output --plain # Plain text, no formatting --no-color # Disable ANSI colors -n <count> # Number of results (default: 10) --cursor <val> # Pagination cursor for next page --all # Fetch all pages (use with caution) ```

## OpenClaw 使用指南

- 阅读推文时,始终显示:作者、用户名、文本、时间戳、互动计数。 - 对于推文串,按时间顺序展示推文。 - 搜索时,结合关键指标简明扼要地总结结果。 - 在发布/点赞/转推之前,请与用户确认操作。 - 适用速率限制 —— 请分散执行批量操作。 - 当您需要以编程方式处理输出时,请使用 `--json`。

## 故障排除

### 401 Unauthorized 检查 `TWITTER_BEARER_TOKEN` 是否已设置且有效。

### 429 Rate Limited 请等待并重试。Twitter API 对每 15 分钟的时间窗口有严格的速率限制。

---

**TL;DR**: 阅读、搜索、发布并在 Twitter/X 上进行互动。在执行写入操作前务必确认。

更多产品