🎨 更新 Python 依赖版本至 3.10,新增 pre-commit 工作流及配置文件

This commit is contained in:
2024-12-13 02:23:38 +08:00
parent 8462830c91
commit 8defcfdd66
38 changed files with 350 additions and 229 deletions

View File

@@ -1,22 +1,26 @@
import httpx
import traceback
import httpx
async def fetch_calendar():
url = 'https://api.bgm.tv/calendar'
url = "https://api.bgm.tv/calendar"
headers = {
'User-Agent': 'LiteyukiStudio/nonebot-plugin-marshoai (https://github.com/LiteyukiStudio/nonebot-plugin-marshoai)'
"User-Agent": "LiteyukiStudio/nonebot-plugin-marshoai (https://github.com/LiteyukiStudio/nonebot-plugin-marshoai)"
}
async with httpx.AsyncClient() as client:
response = await client.get(url, headers=headers)
#print(response.text)
# print(response.text)
return response.json()
async def get_bangumi_news():
result = await fetch_calendar()
info = ""
try:
for i in result:
weekday = i["weekday"]["cn"]
#print(weekday)
# print(weekday)
info += f"{weekday}:"
items = i["items"]
for item in items:
@@ -26,4 +30,4 @@ async def get_bangumi_news():
return info
except Exception as e:
traceback.print_exc()
return ""
return ""

View File

@@ -6,4 +6,4 @@
"description": "获取今天的新番(动漫)列表,在调用之前,你需要知道今天星期几。"
}
}
]
]