Skip to content

配置说明

配置文件支持 yamljsontoml 格式,按顺序查找 config.yaml > config.yml > config.toml > config.json

顶层字段

字段类型说明
usersUserConfig[]监控的 Twitter 用户列表
discordDiscordConfigDiscord 机器人配置
telegramTelegramConfigTelegram 机器人配置
twitterTwitterConfigTwitter API 认证配置
webuiWebUIConfigWeb 管理界面配置
enableApprovalboolean是否启用审批机制
sendAsImageboolean是否将推文渲染为图片发送
xToImageApiUrlstring推文转图片 API 地址
xToImageApiTokenstring推文转图片 API Token
xToImageApiThemestring图片主题: light / dim / dark
imageCacheTtlMinutesnumber图片缓存时间(分钟)
pollIntervalMinutesnumber轮询间隔(分钟)
maxPostsPerFetchnumber每次获取最大推文数
maxTweetAgeMinutesnumber推文最大时效(分钟)
groupsGroupConfig[]推送群组配置
pluginsPluginConfigEntry[]插件配置
pluginsDirstring | string[]外部插件目录

users - 监控用户

yaml
users:
  - username: elonmusk          # Twitter 用户名(不含 @)
    displayName: Elon            # 显示名称(可选)
    filters:
      keywords:
        include: [tesla, spacex]  # 包含关键词
        exclude: [ad]             # 排除关键词
      media:
        requireMedia: true        # 要求推文包含媒体
      excludeRetweets: true       # 排除转推
      excludeReplies: true        # 排除回复

discord - Discord 机器人

yaml
discord:
  enabled: true
  token: YOUR_DISCORD_BOT_TOKEN
  embedColor: "#1DA1F2"

telegram - Telegram 机器人

yaml
telegram:
  enabled: true
  token: YOUR_TELEGRAM_BOT_TOKEN
  parseMode: HTML
  apiRoot: ""                     # 自定义 API 地址(可选)

twitter - Twitter 认证

支持两种认证方式,优先使用 Cookie:

yaml
# 方式一:Cookie 认证(推荐)
twitter:
  authToken: "your_auth_token"
  ct0: "your_ct0"

# 方式二:用户名/密码登录
twitter:
  username: "your_username"
  password: "your_password"
  email: "your_email"             # 可选,部分账号需要
  totpSecret: "your_totp_secret"  # 可选,双因素认证

webui - Web 管理界面

yaml
webui:
  enabled: true
  port: 3000
  host: "0.0.0.0"
  password: "your_password"       # 留空不设密码

groups - 推送群组

yaml
groups:
  - name: my-group
    users:
      - username: "*"              # * 表示所有顶层 users
      # 或指定具体用户
      - username: elonmusk
        displayName: Elon
        filters:
          media:
            requireMedia: true
    discord:
      channelId: "1234567890"
      r14ChannelId: "1234567891"   # R14 评级推送频道(可选)
    telegram:
      chatId: "-1001234567890"
      targets:
        r14:
          chatId: "-100_R14_CHAT_ID"
    approval:
      discordAdminChannelId: "1234567892"
      discordApproveRoleId: "1234567893"
      telegramAdminChatIds:
        - "111111111"
    blockedUsers: []               # 该群组拉黑的用户

用户展开规则

  • 群组 users 中使用 username: "*" 会展开为顶层 users 列表中的所有用户
  • 群组内也可以写具体用户名,覆盖该用户在群组内的过滤器
  • 用户被推送到群组的前提是满足群组过滤器和用户自身过滤器

环境变量覆盖

以下环境变量可覆盖配置文件中的敏感字段:

环境变量对应配置
AI_API_URLplugins[].options.apiUrl
AI_API_KEYplugins[].options.apiKey
AI_WEB_SEARCH_API_KEYplugins[].options.webSearch.apiKey
TWITTER_AUTH_TOKENtwitter.authToken
TWITTER_CT0twitter.ct0
TWITTER_USERNAMEtwitter.username
TWITTER_PASSWORDtwitter.password
TWITTER_EMAILtwitter.email
TWITTER_TOTP_SECRETtwitter.totpSecret
X_TO_IMAGE_API_URLxToImageApiUrl
X_TO_IMAGE_API_TOKENxToImageApiToken