feat(plugins): 新增日报功能并优化菜单项

- 新增 `daily_report.py` 模块,实现日报功能
- 在 `check.py` 的菜单项中添加 `/日报` 选项
This commit is contained in:
SlyAimer 2025-02-14 11:07:50 +08:00
parent 6d45f43d9d
commit efa21d2b5c
3 changed files with 18 additions and 3 deletions

View file

@ -7,7 +7,7 @@ from src.clover_openai import ai_chat
from src.clover_sqlite.models.chat import GroupChatRole from src.clover_sqlite.models.chat import GroupChatRole
from src.clover_sqlite.models.user import UserList from src.clover_sqlite.models.user import UserList
menu = ['/今日运势','/今日塔罗','/图','/点歌','/摸摸头','/群老婆','/今日老婆', "/开启ai","/关闭ai","/角色列表","/添加人设", "/更新人设", "/删除人设", "/切换人设", "/管理员注册", menu = ['/今日运势','/今日塔罗','/图','/日报','/点歌','/摸摸头','/群老婆','/今日老婆', "/开启ai","/关闭ai","/角色列表","/添加人设", "/更新人设", "/删除人设", "/切换人设", "/管理员注册",
'/待办', '/test','/天气','我喜欢你', "", "/待办查询", "/新建待办", "/删除待办" ,"/cf","/B站搜索", "/BV搜索", "/喜报", "/悲报", "/luxun","/鲁迅说", '/待办', '/test','/天气','我喜欢你', "", "/待办查询", "/新建待办", "/删除待办" ,"/cf","/B站搜索", "/BV搜索", "/喜报", "/悲报", "/luxun","/鲁迅说",
"/奶龙", "/repo", "/info", "/menu"] "/奶龙", "/repo", "/info", "/menu"]

View file

@ -0,0 +1,15 @@
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
from src.configs.path_config import daily_news_path
daily_report = on_command("日报", rule=to_me(), priority=10, block=True)
@daily_report.handle()
async def handle_function():
await Report.get_report_image()
now = datetime.now().date()
await daily_report.finish(MessageSegment.file_image(Path(daily_news_path+f"{now}.png")))

View file

@ -6,12 +6,12 @@ from nonebot.adapters.qq import MessageSegment,MessageEvent
from src.clover_image.get_image import get_image_names from src.clover_image.get_image import get_image_names
from src.clover_image.download_image import download_image from src.clover_image.download_image import download_image
from src.configs.path_config import temp_path from src.configs.path_config import temp_path
from src.clover_report.data_source import Report
image = on_command("", rule=to_me(), priority=10, block=True) image = on_command("", rule=to_me(), priority=10, block=True)
@image.handle() @image.handle()
async def handle_function(): async def handle_function():
await Report.get_report_image()
local_image_path = get_image_names() local_image_path = get_image_names()
await image.finish(MessageSegment.file_image(Path(local_image_path))) await image.finish(MessageSegment.file_image(Path(local_image_path)))