mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-08 17:58:55 +08:00
@@ -20,15 +20,27 @@ class BasicTheme(Theme):
|
||||
async def render(self, post: "Post") -> list[MessageSegmentFactory]:
|
||||
text = ""
|
||||
|
||||
if post.title:
|
||||
text += f"{post.title}\n\n"
|
||||
text += f"{post.title}\n\n" if post.title else ""
|
||||
|
||||
text += post.content if len(post.content) < 500 else f"{post.content[:500]}..."
|
||||
|
||||
text += f"\n来源: {post.platform.name} {post.nickname or ''}\n"
|
||||
if rp := post.repost:
|
||||
text += f"\n--------------\n转发自 {rp.nickname or ''}:\n"
|
||||
text += f"{rp.title}\n\n" if rp.title else ""
|
||||
text += rp.content if len(rp.content) < 500 else f"{rp.content[:500]}..."
|
||||
|
||||
text += "\n--------------\n"
|
||||
|
||||
text += f"来源: {post.platform.name} {post.nickname or ''}\n"
|
||||
|
||||
urls: list[str] = []
|
||||
if rp and rp.url:
|
||||
urls.append(f"转发详情:{rp.url}")
|
||||
if post.url:
|
||||
text += f"详情: {post.url}"
|
||||
urls.append(f"详情: {post.url}")
|
||||
|
||||
if urls:
|
||||
text += "\n".join(urls)
|
||||
|
||||
msgs: list[MessageSegmentFactory] = [Text(text)]
|
||||
if post.images:
|
||||
|
||||
Reference in New Issue
Block a user