2025-02-20 09:33:58 +00:00
|
|
|
from datetime import datetime
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
from nonebot.rule import to_me
|
|
|
|
|
from nonebot.plugin import on_command
|
|
|
|
|
from nonebot.adapters.qq import MessageSegment
|
|
|
|
|
from src.clover_report.data_source import Report
|
2025-03-03 03:25:03 +00:00
|
|
|
from src.configs.path_config import temp_path
|
2025-02-20 09:33:58 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
2025-02-28 06:19:15 +00:00
|
|
|
daily_report = on_command("日报", rule=to_me(), priority=10)
|
2025-02-20 09:33:58 +00:00
|
|
|
@daily_report.handle()
|
|
|
|
|
async def handle_function():
|
|
|
|
|
now = datetime.now()
|
2025-03-03 03:25:03 +00:00
|
|
|
file = Path() / temp_path / f"{now.date()}日报.png"
|
2025-02-20 09:33:58 +00:00
|
|
|
if not os.path.exists(file):
|
|
|
|
|
await daily_report.send("您是今天第一个查看日报的哦,来看看世界上都发生了些什么吧💫\nCrunching the latest news, just for you. Hang tight…")
|
|
|
|
|
await Report.get_report_image()
|
2025-03-03 03:25:03 +00:00
|
|
|
await daily_report.finish(MessageSegment.file_image(Path(temp_path+f"{now}日报.png")))
|