mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-05 19:36:43 +08:00
add override use pic
This commit is contained in:
parent
d4d62da739
commit
de456630f3
@ -11,9 +11,15 @@ class Post:
|
|||||||
url: str
|
url: str
|
||||||
target_name: Optional[str] = None
|
target_name: Optional[str] = None
|
||||||
compress: bool = False
|
compress: bool = False
|
||||||
|
override_use_pic: Optional[bool] = None
|
||||||
|
|
||||||
pics: list[str] = field(default_factory=list)
|
pics: list[str] = field(default_factory=list)
|
||||||
|
|
||||||
|
def _use_pic(self):
|
||||||
|
if self.override_use_pic != None:
|
||||||
|
return self.override_use_pic
|
||||||
|
return plugin_config.hk_reporter_use_pic
|
||||||
|
|
||||||
async def generate_messages(self):
|
async def generate_messages(self):
|
||||||
msgs = []
|
msgs = []
|
||||||
text = '来源: {}'.format(self.target_type)
|
text = '来源: {}'.format(self.target_type)
|
||||||
@ -21,7 +27,7 @@ class Post:
|
|||||||
text += ' {}'.format(self.target_name)
|
text += ' {}'.format(self.target_name)
|
||||||
if self.text:
|
if self.text:
|
||||||
text += '\n{}'.format(self.text)
|
text += '\n{}'.format(self.text)
|
||||||
if plugin_config.hk_reporter_use_pic:
|
if self._use_pic():
|
||||||
msgs.append(await parse_text(text))
|
msgs.append(await parse_text(text))
|
||||||
if not self.target_type == 'rss':
|
if not self.target_type == 'rss':
|
||||||
msgs.append(self.url)
|
msgs.append(self.url)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user