mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-08-02 08:29:51 +00:00
✨ 添加聊天功能,支持获取会话信息和发送消息到用户或群组
This commit is contained in:
@ -21,3 +21,24 @@ async def read_file(fp: str) -> str:
|
||||
return await f.read()
|
||||
except Exception as e:
|
||||
return "读取出错: " + str(e)
|
||||
|
||||
|
||||
@on_function_call(description="写入内容到设备上本地文件").params(
|
||||
fp=String(description="文件路径"), content=String(description="写入内容")
|
||||
).permission(SUPERUSER)
|
||||
async def write_file(fp: str, content: str) -> str:
|
||||
"""写入内容到设备上本地文件
|
||||
|
||||
Args:
|
||||
fp (str): 文件路径
|
||||
content (str): 写入内容
|
||||
|
||||
Returns:
|
||||
str: 写入结果
|
||||
"""
|
||||
try:
|
||||
async with aiofiles.open(fp, "w", encoding="utf-8") as f:
|
||||
await f.write(content)
|
||||
return "写入成功"
|
||||
except Exception as e:
|
||||
return "写入出错: " + str(e)
|
||||
|
Reference in New Issue
Block a user