npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gocqhttp-twitter-bot

v0.5.3

Published

GoCQHTTP Twitter Bot

Downloads

42

Readme

GoCQHTTP Twitter Bot

修改自:rikakomoe/cqhttp-twitter-bot

使用 API:koishijs/koishi(后台使用:Mrs4s/go-cqhttp

主要区别

  • 去除了 Redis(v0.5.1 已重新加入去重,并加入简单的缓存机制,未来可能会继续加入基于散列值的媒体缓存)
  • 支持通过列表 ID 订阅列表,和网页端体验一致
  • 处理订阅链接时大小写不敏感,新订阅链接时先检查是否存在
  • 支持直接查看指定的推文链接,或(在没有其他用户订阅该用户时)从最新推文回溯到该条推文,由新到旧显示
  • 图片使用 sharp 压缩为 JPEG
  • 视频直接作为短视频发送
  • 机器人的 QQ 号码必须手动填写
  • 由于推特改版后引发了 Chromium 的 bug,截图部分从 Puppeteer 改为 Playwright 并使用特殊的 WebSocket 格式 URL(这种方式可以使用本地或远程 WebSocket 代理服务器上的 Playwright 服务端)
  • 自动处理来自群友的好友请求来自好友的加群邀请

配置

它会从命令传入的 JSON 配置文件里读取配置,配置说明如下

| 配置项 | 说明 | 默认 | | --- | --- | --- | | cq_access_token | OneBot HTTP API access_token(需与插件一致,插件若未配置本项即为空,建议配置为独特值) | ""(空) | | cq_ws_host | OneBot HTTP API 插件服务端地址 | 127.0.0.1 | | cq_ws_port | OneBot HTTP API 插件服务端口 | 6700 | | cq_bot_qq | OneBot HTTP API 登录的目标机器人 QQ 号 | 10000(示例值,必填) | | twitter_consumer_key | Twitter App consumer_key | (必填) | | twitter_consumer_secret | Twitter App consumer_secret | (必填) | | twitter_access_token_key | Twitter App access_token_key | (必填) | | twitter_access_token_secret | Twitter App access_token_secret | (必填) | | mode | 工作模式,0 为图文模式,1 为纯文本模式,2 为文本附图模式 | 0 | | playwright_ws_spec_endpoint | Playwright 配置拉取 URL,内容格式为:{<浏览器>:<开发工具 WebSocket 端点 URL>} | http://127.0.0.1:8080/playwright-ws.json(示例值,模式 0 时必填) | | resume_on_start | 是否在启动时从退出时的进度继续(拉取本应用非活动时期错过的推文) | false | | work_interval | 对单个订阅两次拉取更新的最少间隔时间(秒) | 60 | | webshot_delay | 抓取网页截图时等待网页加载的延迟时长(毫秒) | 10000 | | lockfile | 本地保存订阅信息以便下次启动时恢复 | subscriber.lock | | redis | 是否启用 Redis 服务(当前用于去重和推文缓存) | true | | redis_host | Redis 服务器地址 | 127.0.0.1 | | redis_port | Redis 服务器端口 | 6379 | | redis_expire_time | 用于去重的 Redis 发送状态缓存过期时间(秒)(推文缓存当前固定为 24 小时) | 43200 |

示例文件在 config.example.json此文件兼作默认值和开发时的类型定义模板,非生产环境不建议删除

系统服务

可以使用 systemd 目录里的服务文件设置成自动启动服务

$ cd
$ git clone https://mikeslab.dix.asia/gogs/Pirami/gocqhttp-twitter-bot
$ cd gocqhttp-twitter-bot
$ ./bootstrap_linux_amd64.sh
QQ:
Pass:
Done!
$ rsync -a systemd ~/.config/
$ systemctl --user daemon-reload
$ systemctl --user enable twitterbot.service
$ loginctl enable-linger

注:如果想在本地文件夹保存日志,请取消注释两个服务定义中相应的行,阅读时可以使用 tail -f

Bug

  • 好友消息的图片有可能会失效或直接无法接收(由于更换后台框架,暂时无法进行进一步处理)
  • 视频为实验性功能,可能会有各种问题,如当前元信息缺失会导致预览时的尺寸和时长显示出错,放大后则正常

Todo

  • 重新实现基于 hash 的文件缓存和转推媒体去重
  • 添加选项对时间线进行过滤(目前可以在搜索时指定一些条件,但无法用于订阅,具体请使用 /help 查看文档)