mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-07 12:23:00 +08:00
update
This commit is contained in:
parent
1ecbdf3a1b
commit
50c70b5a0f
@ -153,6 +153,18 @@ sidebar: auto
|
|||||||
- 对于`nonebot_bison.platform.platform.StatusChange`
|
- 对于`nonebot_bison.platform.platform.StatusChange`
|
||||||
`compare_status` 用于比较储存的`old_status`与新传入的`new_status`,并返回发生变更的 RawPost 列表
|
`compare_status` 用于比较储存的`old_status`与新传入的`new_status`,并返回发生变更的 RawPost 列表
|
||||||
|
|
||||||
|
当然我们非常希望你对自己适配的平台写一些单元测试
|
||||||
|
|
||||||
|
你可以参照`tests/platforms/test_*.py`中的内容对单元测试进行编写。
|
||||||
|
|
||||||
|
为保证多次运行测试的一致性,可以 mock http 的响应,测试的内容应包括[获取 RawPost](https://github.com/felinae98/nonebot-bison/blob/v0.5.3/tests/platforms/test_weibo.py#L59),处理成 Post
|
||||||
|
,测试分类以及提取 tag 等,当然最好和 rsshub 做一个交叉验证。
|
||||||
|
|
||||||
|
::: danger
|
||||||
|
Nonebot 项目使用了全异步的处理方式,所以你需要对异步,Python asyncio 的机制有一定了解,当然,
|
||||||
|
依葫芦画瓢也是足够的
|
||||||
|
:::
|
||||||
|
|
||||||
## 一些例子
|
## 一些例子
|
||||||
|
|
||||||
例如要适配微博,我希望 bot 搬运新的消息,所以微博的类应该这样实现:
|
例如要适配微博,我希望 bot 搬运新的消息,所以微博的类应该这样实现:
|
||||||
@ -197,15 +209,3 @@ class Weibo(NewMessage):
|
|||||||
#将需要bot推送的RawPost处理成正式推送的Post
|
#将需要bot推送的RawPost处理成正式推送的Post
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
当然我们非常希望你对自己适配的平台写一些单元测试
|
|
||||||
|
|
||||||
你可以参照`tests/platforms/test_*.py`中的内容对单元测试进行编写。
|
|
||||||
|
|
||||||
为保证多次运行测试的一致性,可以 mock http 的响应,测试的内容应包括[获取 RawPost](https://github.com/felinae98/nonebot-bison/blob/v0.5.3/tests/platforms/test_weibo.py#L59),处理成 Post
|
|
||||||
,测试分类以及提取 tag 等,当然最好和 rsshub 做一个交叉验证。
|
|
||||||
|
|
||||||
::: danger
|
|
||||||
Nonebot 项目使用了全异步的处理方式,所以你需要对异步,Python asyncio 的机制有一定了解,当然,
|
|
||||||
依葫芦画瓢也是足够的
|
|
||||||
:::
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user