🐛 修复原神公告 (#604)

This commit is contained in:
‘KimigaiiWuyi’ 2023-11-13 20:22:45 +08:00
parent c268a9f020
commit 1f5ff52644
2 changed files with 12 additions and 9 deletions

View File

@ -29,11 +29,11 @@ async def ann_(bot: Bot, ev: Event):
img = await convert_img(img)
return await bot.send(img)
ann_id = ann_id.replace('#', '')
if not ann_id.isdigit():
raise Exception('公告ID不正确')
img = await ann_detail_card(int(ann_id))
img = await convert_img(img)
await bot.send(img)

View File

@ -93,15 +93,18 @@ async def ann_detail_card(ann_id):
for a in soup.find_all('a'):
a.string = ''
for img in soup.find_all('img'):
img.string = img.get('src')
msg_list = [ann_img]
msg_list += [
for img in soup.find_all('img'):
msg_list.append(img.get('src'))
# img.string = img.get('src')
msg_list.extend(
[
BeautifulSoup(x.get_text('').replace('<<', ''), 'lxml').get_text()
+ '\n'
for x in soup.find_all('p')
]
)
drow_height = 0
for msg in msg_list: