mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-03 09:56:45 +08:00
update post
This commit is contained in:
parent
1956b3ebc5
commit
cac1bb6ef8
@ -1,12 +1,14 @@
|
|||||||
|
from dataclasses import dataclass, field
|
||||||
from . import plugin_config
|
from . import plugin_config
|
||||||
from .utils import parse_text
|
from .utils import parse_text
|
||||||
|
|
||||||
|
@dataclass
|
||||||
class Post:
|
class Post:
|
||||||
|
|
||||||
target_type: str
|
target_type: str
|
||||||
text: str
|
text: str
|
||||||
url: str
|
url: str
|
||||||
pics: list[str]
|
pics: list[str] = field(default_factory=list)
|
||||||
|
|
||||||
async def generate_messages(self):
|
async def generate_messages(self):
|
||||||
if plugin_config.hk_reporter_use_pic:
|
if plugin_config.hk_reporter_use_pic:
|
||||||
@ -22,11 +24,5 @@ class Post:
|
|||||||
res.append("[CQ:image,file={url}]".format(url=pic))
|
res.append("[CQ:image,file={url}]".format(url=pic))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def __init__(self, target_type, text, url, pics=[]):
|
|
||||||
self.target_type = target_type
|
|
||||||
self.text = text
|
|
||||||
self.url = url
|
|
||||||
self.pics = pics
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'type: {}\ntext: {}\nurl: {}\npic: {}'.format(self.target_type, self.text[:50], self.url, ','.join(map(lambda x: 'b64img' if x.startswith('base64') else x, self.pics)))
|
return 'type: {}\ntext: {}\nurl: {}\npic: {}'.format(self.target_type, self.text[:50], self.url, ','.join(map(lambda x: 'b64img' if x.startswith('base64') else x, self.pics)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user