diff --git a/.circleci/main.yml b/.circleci/main.yml index 5928a18..0505087 100644 --- a/.circleci/main.yml +++ b/.circleci/main.yml @@ -213,5 +213,6 @@ jobs: name: Publish to Github Release command: | go install github.com/tcnksm/ghr@latest - ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./dist + ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} \ + -delete ${CIRCLE_TAG} -n ${CIRCLE_TAG} -b $(git log --format=%B -n 1 $CIRCLE_SHA1) ./dist diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e44209a..f44d077 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: black - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.6.1 + rev: v2.6.2 hooks: - id: prettier types_or: [markdown, ts, tsx] diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f68581..5e835f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,3 +71,8 @@ - 添加了 [推送消息合并转发功能](https://nonebot-bison.vercel.app/usage/#%E9%85%8D%E7%BD%AE) - 添加了`添加订阅`命令事件的中途取消功能 - 优化了`添加订阅`命令的聊天处理逻辑 + +## [0.5.2] + +- 修复了微博获取全文时接口失效的问题 +- 修复了 bilibili 空列表时的报错 diff --git a/README.md b/README.md index 916d729..b9ed3db 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,18 @@ 支持的平台: - 微博 + - 图文 + - 视频 + - 纯文字 - Bilibili + - 视频 + - 图文 + - 专栏 + - 转发 + - 纯文字 - RSS + - 富文本转换为纯文本 + - 提取出所有图片 - 明日方舟 - 塞壬唱片新闻 - 游戏内公告 @@ -37,6 +47,8 @@ - 网易云音乐 - 歌手发布新专辑 - 电台更新 +- FF14 + - 游戏公告 ## 功能 @@ -68,6 +80,10 @@ yarn && yarn build `COMMAND_START=["/"]`则应发送`/添加订阅` 3. 微博漏订阅了 微博更新了新的风控措施,某些含有某些关键词的微博会获取不到。 +4. 无法使用后台管理页面 + 1. 确认自己正确配置了 nonebot 的端口,如果在远程或容器外访问网页请确保`HOST=0.0.0.0` + 2. 确认自己的云服务器的防火墙配置正确 + 3. 确认自己使用了正确的方法安装插件 ## 参与开发 diff --git a/docs/usage/README.md b/docs/usage/README.md index 24a8be0..4caefa8 100644 --- a/docs/usage/README.md +++ b/docs/usage/README.md @@ -88,7 +88,7 @@ sidebar: auto 1. 安装 pip 包`nonebot-bison` 2. 在`bot.py`中导入插件`nonebot_bison` -### 自动安装 +#### 使用 nb-cli 安装 使用`nb-cli`执行:`nb plugin install nonebot_bison` @@ -111,6 +111,9 @@ sidebar: auto 默认`True` - `BISON_OUTER_URL`: 从外部访问服务器的地址,默认为`http://localhost:8080/bison`,如果你的插件部署 在服务器上,建议配置为`http://<你的服务器ip>:8080/bison` + ::: warning + 如果需要从外网或者 Docker 容器外访问后台页面,请确保`HOST=0.0.0.0` + ::: - `BISON_FILTER_LOG`: 是否过滤来自`nonebot`的 warning 级以下的 log,如果你的 bot 只运行了这个插件可以考虑 开启,默认关 - `BISON_USE_QUEUE`: 是否用队列的方式发送消息,降低发送频率,默认开 @@ -149,27 +152,33 @@ sidebar: auto 所有命令都需要@bot 触发 - 添加订阅(仅管理员和群主和 SUPERUSER):`添加订阅` + ::: tip 关于中止订阅 + 对于[**v0.5.1**](https://github.com/felinae98/nonebot-bison/releases/tag/v0.5.1)及以上的版本中,已经为`添加订阅`命令添加了中止订阅的功能。 + 在添加订阅命令的~~几乎~~各个阶段,都可以向 Bot 发送`取消`消息来中止订阅过程(需要订阅发起者本人发送) + ::: - 查询订阅:`查询订阅` - 删除订阅(仅管理员和群主和 SUPERUSER):`删除订阅` #### 私聊机器人获取后台地址 `后台管理`,之后点击返回的链接 -如果你是 superuser,那么你可以管理所有群的订阅;如果你是 bot 所在的群的其中部分群的管理, -你可以管理你管理的群里的订阅;如果你不是任意一个群的管理,那么 bot 将会报错。 +如果你是 superuser,那么你可以管理所有群的订阅; +如果你是 bot 所在的群的其中部分群的管理,你可以管理你管理的群里的订阅; +如果你不是任意一个群的管理,那么 bot 将会报错。 ::: tip 可以和 bot 通过临时聊天触发 ::: ::: warning -网页的身份鉴别机制全部由 bot 返回的链接确定,所以这个链接并不能透露给别人。 +网页的身份鉴别机制全部由 bot 返回的链接确定,所以这个链接并不能透露给别人。 并且链接会过期,所以一段时间后需要重新私聊 bot 获取新的链接。 ::: #### 私聊机器人进行配置(需要 SUPERUER 权限) -- 添加订阅:`管理-添加订阅` -- 查询订阅:`管理-查询订阅` -- 删除订阅:`管理-删除订阅` +请私聊 bot`群管理` +::: tip 关于中止订阅 +与普通的[`添加订阅`](#在本群中进行配置)命令一样,在`群管理`命令中使用的`添加订阅`命令也可以使用`取消`来中止订阅过程 +::: ### 所支持平台的 uid diff --git a/pyproject.toml b/pyproject.toml index f81db01..065cea6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nonebot-bison" -version = "0.5.0" +version = "0.5.2" description = "Subscribe message from social medias" authors = ["felinae98 "] license = "MIT" diff --git a/src/plugins/nonebot_bison/platform/bilibili.py b/src/plugins/nonebot_bison/platform/bilibili.py index 5ff3cc1..ad21a8a 100644 --- a/src/plugins/nonebot_bison/platform/bilibili.py +++ b/src/plugins/nonebot_bison/platform/bilibili.py @@ -47,7 +47,7 @@ class Bilibili(NewMessage): ) res_dict = json.loads(res.text) if res_dict["code"] == 0: - return res_dict["data"]["cards"] + return res_dict["data"].get("cards") else: return [] diff --git a/src/plugins/nonebot_bison/platform/weibo.py b/src/plugins/nonebot_bison/platform/weibo.py index 2e9f46b..bcd0995 100644 --- a/src/plugins/nonebot_bison/platform/weibo.py +++ b/src/plugins/nonebot_bison/platform/weibo.py @@ -130,7 +130,7 @@ class Weibo(NewMessage): ) try: full_json_text = re.search( - r'"status": ([\s\S]+),\s+"hotScheme"', res.text + r'"status": ([\s\S]+),\s+"call"', res.text ).group(1) info = json.loads(full_json_text) except: diff --git a/src/plugins/nonebot_bison/scheduler.py b/src/plugins/nonebot_bison/scheduler.py index 9f25991..0219f74 100644 --- a/src/plugins/nonebot_bison/scheduler.py +++ b/src/plugins/nonebot_bison/scheduler.py @@ -17,6 +17,18 @@ scheduler = AsyncIOScheduler(timezone="Asia/Shanghai") @get_driver().on_startup async def _start(): + for platform_name, platform in platform_manager.items(): + if platform.schedule_type in ["cron", "interval", "date"]: + logger.info( + f"start scheduler for {platform_name} with {platform.schedule_type} {platform.schedule_kw}" + ) + scheduler.add_job( + fetch_and_send, + platform.schedule_type, + **platform.schedule_kw, + args=(platform_name,), + ) + scheduler.configure({"apscheduler.timezone": "Asia/Shanghai"}) scheduler.start() @@ -64,19 +76,6 @@ async def fetch_and_send(target_type: str): ) -for platform_name, platform in platform_manager.items(): - if platform.schedule_type in ["cron", "interval", "date"]: - logger.info( - f"start scheduler for {platform_name} with {platform.schedule_type} {platform.schedule_kw}" - ) - scheduler.add_job( - fetch_and_send, - platform.schedule_type, - **platform.schedule_kw, - args=(platform_name,), - ) - - class CustomLogHandler(LoguruHandler): def filter(self, record: logging.LogRecord): return record.msg != ( diff --git a/tests/platforms/static/weibo_detail_4645748019299849 b/tests/platforms/static/weibo_detail_4645748019299849 index ae3819d..f216ea8 100644 --- a/tests/platforms/static/weibo_detail_4645748019299849 +++ b/tests/platforms/static/weibo_detail_4645748019299849 @@ -15,7 +15,7 @@ - +
@@ -30,15 +30,23 @@ - + diff --git a/tests/platforms/static/weibo_detail_4649031014551911 b/tests/platforms/static/weibo_detail_4649031014551911 index 2666e3b..7c003a4 100644 --- a/tests/platforms/static/weibo_detail_4649031014551911 +++ b/tests/platforms/static/weibo_detail_4649031014551911 @@ -15,7 +15,7 @@ - +
@@ -30,15 +30,23 @@ - +