mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-09 18:27:56 +08:00
✨ 实现 Post.content 相关扩展协议 (#553)
* ✨ `post` 新增 `get_content()` 方法 * 🚨 make linter happy * 💄 auto fix by pre-commit hooks * 🐛 fix: 调整函数使用 * 💄 auto fix by pre-commit hooks * ✨ 转用函数处理文本 * 💄 auto fix by pre-commit hooks * 🔨 使用`Dict`存储`content_handlers` * 💄 auto fix by pre-commit hooks * 🎨 fix * :arts: 简化函数使用 * 🐛 移除`Theme`的过时参数 * 🗑️ 复用 `self.plain_content` * 💄 auto fix by pre-commit hooks * ✨ 注册式装饰器写法 * 💄 auto fix by pre-commit hooks * 🐛 fix * 💄 auto fix by pre-commit hooks * :feat: 通用纯文本处理函数 * 💄 auto fix by pre-commit hooks * :downgrade: 复用`==`处理标题 * 🎨 简化(?)写法 * ✅ 测试修复 * ♻️ via ContentSupport extensions * 🐛 fix test * 💄 auto fix by pre-commit hooks * 🐛 for clean text * 🐛 fix * 💄 auto fix by pre-commit hooks * fix: for xml * 💄 auto fix by pre-commit hooks * chore: art * 💄 auto fix by pre-commit hooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -65,7 +65,7 @@ def mock_platform(app: App):
|
||||
async def parse(self, raw_post: "RawPost") -> "Post":
|
||||
return Post(
|
||||
self,
|
||||
raw_post["text"],
|
||||
content=raw_post["text"],
|
||||
url="http://t.tt/" + str(self.get_id(raw_post)),
|
||||
nickname="Mock",
|
||||
)
|
||||
@@ -88,7 +88,7 @@ def mock_post(app: App, mock_platform):
|
||||
|
||||
return Post(
|
||||
m := mock_platform(ProcessContext(DefaultClientManager())),
|
||||
"text",
|
||||
content="text",
|
||||
title="title",
|
||||
images=["http://t.tt/1.jpg"],
|
||||
timestamp=1234567890,
|
||||
@@ -98,7 +98,7 @@ def mock_post(app: App, mock_platform):
|
||||
description="description",
|
||||
repost=Post(
|
||||
m,
|
||||
"repost",
|
||||
content="repost",
|
||||
title="repost-title",
|
||||
images=["http://t.tt/2.jpg"],
|
||||
timestamp=1234567891,
|
||||
|
||||
Reference in New Issue
Block a user