添加开发文档和 API 文档的初始结构;更新 .gitignore 以排除生成的文档目录

This commit is contained in:
2024-12-14 18:49:06 +08:00
parent 8c06f1336e
commit 8530e2e34a
66 changed files with 5224 additions and 7 deletions

View File

@ -0,0 +1,72 @@
---
title: index
collapsed: true
---
# **Module** `nonebot_plugin_marshoai.plugins.marshoai_bangumi`
---
### ***async func*** `fetch_calendar()`
<details>
<summary> <b>Source code</b> or <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/plugins/marshoai_bangumi/__init__.py#L16' target='_blank'>View on GitHub</a></summary>
```python
async def fetch_calendar():
url = 'https://api.bgm.tv/calendar'
headers = {'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)
return response.json()
```
</details>
---
`@function_call`
### ***async func*** `get_bangumi_news() -> str`
**Description**: 获取今天的新番(动漫)列表,在调用之前,你需要知道今天星期几。
**Return**: _type_: _description_
<details>
<summary> <b>Source code</b> or <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/plugins/marshoai_bangumi/__init__.py#L28' target='_blank'>View on GitHub</a></summary>
```python
@function_call
async def get_bangumi_news() -> str:
result = await fetch_calendar()
info = ''
try:
for i in result:
weekday = i['weekday']['cn']
info += f'{weekday}:'
items = i['items']
for item in items:
name = item['name_cn']
info += f'《{name}》'
info += '\n'
return info
except Exception as e:
traceback.print_exc()
return ''
```
</details>
---
`@function_call`
### ***func*** `test_sync() -> str`
<details>
<summary> <b>Source code</b> or <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/plugins/marshoai_bangumi/__init__.py#L53' target='_blank'>View on GitHub</a></summary>
```python
@function_call
def test_sync() -> str:
return 'sync'
```
</details>

View File

@ -0,0 +1,52 @@
---
title: index
collapsed: true
---
# **Module** `nonebot_plugin_marshoai.plugins.marshoai_basic`
---
### ***async func*** `get_weather(location: str)`
<details>
<summary> <b>Source code</b> or <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/plugins/marshoai_basic/__init__.py#L6' target='_blank'>View on GitHub</a></summary>
```python
async def get_weather(location: str):
return f'{location}的温度是114514℃。'
```
</details>
---
### ***async func*** `get_current_env()`
<details>
<summary> <b>Source code</b> or <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/plugins/marshoai_basic/__init__.py#L10' target='_blank'>View on GitHub</a></summary>
```python
async def get_current_env():
ver = os.popen('uname -a').read()
return str(ver)
```
</details>
---
### ***async func*** `get_current_time()`
<details>
<summary> <b>Source code</b> or <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/plugins/marshoai_basic/__init__.py#L15' target='_blank'>View on GitHub</a></summary>
```python
async def get_current_time():
current_time = DateTime.now().strftime('%Y.%m.%d %H:%M:%S')
current_weekday = DateTime.now().weekday()
weekdays = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日']
current_weekday_name = weekdays[current_weekday]
current_lunar_date = DateTime.now().to_lunar().date_hanzify()[5:]
time_prompt = f'现在的时间是{current_time}{current_weekday_name},农历{current_lunar_date}。'
return time_prompt
```
</details>