Merge branch 'main' into arknights

This commit is contained in:
felinae98 2021-02-19 00:26:38 +08:00
commit 764643ec96
No known key found for this signature in database
GPG Key ID: 00C8B010587FF610

View File

@ -11,9 +11,15 @@ class Post:
url: str
target_name: Optional[str] = None
compress: bool = False
override_use_pic: Optional[bool] = None
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):
msgs = []
text = '来源: {}'.format(self.target_type)
@ -21,7 +27,7 @@ class Post:
text += ' {}'.format(self.target_name)
if self.text:
text += '\n{}'.format(self.text)
if plugin_config.hk_reporter_use_pic:
if self._use_pic():
msgs.append(await parse_text(text))
if not self.target_type == 'rss':
msgs.append(self.url)