Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/modules/mcbbs_news/__init__.py

28 lines
864 B
Python
Raw Normal View History

2022-01-19 14:41:31 +00:00
from core.component import on_command
2022-06-28 06:11:03 +00:00
from core.builtins.message import MessageSession
from core.elements import Url
2022-01-19 14:41:31 +00:00
from .mcbbs_news import news
mcbbs_news = on_command(
bind_prefix='mcbbs_news',
2022-01-21 12:19:32 +00:00
alias=['mn', 'mcbbsnews'],
2022-01-19 14:41:31 +00:00
desc='获得 MCBBS 幻翼快讯版最新新闻(未被版主高亮过的新闻将被忽略)',
2022-01-21 12:19:32 +00:00
developers=['Dianliang233']
2022-01-19 14:41:31 +00:00
)
@mcbbs_news.handle()
async def main(msg: MessageSession):
res = await news()
2022-01-20 12:13:03 +00:00
print('res' + str(res))
2022-01-19 14:41:31 +00:00
if res is None:
message = '没有找到任何新闻。'
else:
lst = []
for i in res:
lst += [f'{i["count"]}. [{i["category"]}] {i["title"]} - {i["author"]} @ {i["time"]}\n{i["url"]}']
message = '\n'.join(lst) + '\n更多资讯详见 ' + \
Url('https://www.mcbbs.net/forum-news-1.html').url
2022-05-21 16:04:29 +00:00
await msg.finish(message)