关于 interacting-with-x
通过 API 凭据让 Agent 与 X 互动的技能,借助脚本发布内容、读取时间线和提及,并执行互动操作。
主要功能
- 01发布推文和串文
- 02为帖子附加媒体
- 03读取时间线和提及
- 04读取用户帖子
- 05点赞、转发和关注
适用场景
- 01让 Agent 发布动态
- 02读取账号时间线或提及
- 03将 Bluesky 内容同步发布到 X
- 04点赞、转发或关注账号
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ just-cameron/ central --skill interacting-with-x安装后在 Claude Code 中输入/interacting-with-x确认已加载。
详细介绍
与 X 互动
使 Agent 能够全面地与 X(Twitter)进行交互。
设置
添加到 .env:
X_API_KEY=your_api_key
X_API_SECRET=your_api_secret
X_ACCESS_TOKEN=your_access_token
X_ACCESS_TOKEN_SECRET=your_access_token_secret
X_BEARER_TOKEN=your_bearer_token
从 https://developer.x.com/en/portal/dashboard 获取凭据
操作
发布推文
# Simple tweet
uv run python .skills/interacting-with-x/scripts/post.py "Hello from Central"
# Thread (multiple tweets chained)
uv run python .skills/interacting-with-x/scripts/post.py --thread "First tweet" "Second tweet" "Third tweet"
# With media
uv run python .skills/interacting-with-x/scripts/post.py --media image.png "Tweet with image"
# Reply to existing tweet
uv run python .skills/interacting-with-x/scripts/post.py --reply-to 1234567890 "Reply text"
读取时间线/提及
# Home timeline
uv run python .skills/interacting-with-x/scripts/read.py timeline
# Mentions
uv run python .skills/interacting-with-x/scripts/read.py mentions
# User's tweets
uv run python .skills/interacting-with-x/scripts/read.py user elonmusk
# Search
uv run python .skills/interacting-with-x/scripts/read.py search "AI agents"
互动
# Like
uv run python .skills/interacting-with-x/scripts/engage.py like 1234567890
# Retweet
uv run python .skills/interacting-with-x/scripts/engage.py retweet 1234567890
# Follow/unfollow
uv run python .skills/interacting-with-x/scripts/engage.py follow username
uv run python .skills/interacting-with-x/scripts/engage.py unfollow username
速率限制
X API 有严格的速率限制。Pro 版有所帮助,但仍受以下限制:
- 发布:100 次/24 小时(Pro:500 次/24 小时)
- 读取:100 次请求/15 分钟
- 点赞:50 次/24 小时
脚本会自动处理速率限制。详情请参阅 references/api-reference.md。
字符数限制
- 标准版:280 个字符
- Pro 版:25,000 个字符
脚本会自动检测账号类型并进行相应处理。
从 ATProto 跨平台发布
要将 Bluesky 内容镜像到 X:
# In your code
from .skills.interacting_with_x.scripts import post
# After posting to Bluesky, cross-post to X
post.create_tweet(text) # or post.create_thread(texts) for threads
Facet(提及、链接)会自动转换为 X 格式。
评论
支持 Markdown