storyclaw-x-manager
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseX Manager - Twitter/X Account Management
X 管理器 - Twitter/X 账号管理
Manage X (formerly Twitter) accounts: posting, engagement, timeline, and analytics.
管理X(原Twitter)账号:发布内容、互动、查看时间线及数据分析。
Multi-User Architecture
多用户架构
Each user's credentials are stored in :
credentials/{USER_ID}.jsonjson
{
"twitter": {
"api_key": "",
"api_secret": "",
"access_token": "",
"access_token_secret": "",
"bearer_token": ""
}
}If user has no Twitter credentials configured, prompt them to bind their X account first.
Or set env vars: , , , , .
TWITTER_API_KEYTWITTER_API_SECRETTWITTER_ACCESS_TOKENTWITTER_ACCESS_TOKEN_SECRETTWITTER_BEARER_TOKEN每个用户的凭证存储在中:
credentials/{USER_ID}.jsonjson
{
"twitter": {
"api_key": "",
"api_secret": "",
"access_token": "",
"access_token_secret": "",
"bearer_token": ""
}
}如果用户未配置Twitter凭证,会提示用户先绑定X账号。
也可设置环境变量:、、、、。
TWITTER_API_KEYTWITTER_API_SECRETTWITTER_ACCESS_TOKENTWITTER_ACCESS_TOKEN_SECRETTWITTER_BEARER_TOKENSupported Operations
支持的操作
1. Post Tweet
1. 发布推文
bash
python3 {baseDir}/scripts/post_tweet.py <USER_ID> "<tweet content>" [--media <image_path>]Max 280 characters. Longer tweets auto-split for Premium/Enterprise accounts.
bash
python3 {baseDir}/scripts/post_tweet.py <USER_ID> "<tweet content>" [--media <image_path>]最多280个字符。对于Premium/Enterprise账户,过长的推文会自动拆分。
2. Engagement
2. 互动操作
Like:
bash
python3 {baseDir}/scripts/like_tweet.py <USER_ID> <tweet_id>Reply:
bash
python3 {baseDir}/scripts/reply_tweet.py <USER_ID> <tweet_id> "<reply content>"Retweet:
bash
python3 {baseDir}/scripts/retweet.py <USER_ID> <tweet_id>点赞:
bash
python3 {baseDir}/scripts/like_tweet.py <USER_ID> <tweet_id>回复:
bash
python3 {baseDir}/scripts/reply_tweet.py <USER_ID> <tweet_id> "<reply content>"转发:
bash
python3 {baseDir}/scripts/retweet.py <USER_ID> <tweet_id>3. Data Retrieval
3. 数据获取
User tweets:
bash
python3 {baseDir}/scripts/get_user_tweets.py <USER_ID> <twitter_handle> [--count <n>]Timeline:
bash
python3 {baseDir}/scripts/get_timeline.py <USER_ID> [--count <n>]Search:
bash
python3 {baseDir}/scripts/search_tweets.py <USER_ID> "<keywords>" [--count <n>]用户推文:
bash
python3 {baseDir}/scripts/get_user_tweets.py <USER_ID> <twitter_handle> [--count <n>]时间线:
bash
python3 {baseDir}/scripts/get_timeline.py <USER_ID> [--count <n>]搜索:
bash
python3 {baseDir}/scripts/search_tweets.py <USER_ID> "<keywords>" [--count <n>]Auto-Interaction Workflow
自动互动工作流
Configure in :
state/{USER_ID}.jsonjson
{
"auto_reply": {
"enabled": true,
"keywords": ["keyword1", "keyword2"],
"reply_template": "Thanks {username} for {keyword}!"
}
}在中配置:
state/{USER_ID}.jsonjson
{
"auto_reply": {
"enabled": true,
"keywords": ["keyword1", "keyword2"],
"reply_template": "Thanks {username} for {keyword}!"
}
}Error Handling
错误处理
- API rate limit: prompt user to wait and retry
- Auth failure: prompt user to rebind X account
- Tweet too long: auto-split or prompt user to shorten
- API调用限制:提示用户等待并重试
- 认证失败:提示用户重新绑定X账号
- 推文过长:自动拆分或提示用户缩短
Twitter API Tiers
Twitter API 层级
- Free: read only, no posting
- Premium ($100/month): post + analytics
- Enterprise: higher limits
- 免费版:仅可读,无法发布
- 高级版(100美元/月):可发布+分析
- 企业版:更高限额