import{_ as i,c as a,ae as t,o as n}from"./chunks/framework.BzDBnRMZ.js";const m=JSON.parse('{"title":"command","description":"","frontmatter":{"title":"command","order":100},"headers":[],"relativePath":"dev/api/plugins_test/marshoai_memory/command.md","filePath":"zh/dev/api/plugins_test/marshoai_memory/command.md","lastUpdated":null}'),h={name:"dev/api/plugins_test/marshoai_memory/command.md"};function e(k,s,p,l,r,d){return n(),a("div",null,s[0]||(s[0]=[t(`

模块 nonebot_plugin_marshoai.plugins_test.marshoai_memory.command


@marsho_memory_cmd.assign('view')

async func view_memory(matcher: Matcher, state: T_State, event: Event)

源代码在GitHub上查看
python
@marsho_memory_cmd.assign('view')
async def view_memory(matcher: Matcher, state: T_State, event: Event):
    user_id = str(event.get_user_id())
    with open(memory_path, 'r', encoding='utf-8') as f:
        memory_data = json.load(f)
    memorys = memory_data.get(user_id, [])
    if not memorys:
        await matcher.finish('好像对ta还没有任何记忆呢~')
    await matcher.finish('这些是有关ta的记忆:' + '\\n'.join(memorys))

@marsho_memory_cmd.assign('reset')

async func reset_memory(matcher: Matcher, state: T_State, event: Event)

源代码在GitHub上查看
python
@marsho_memory_cmd.assign('reset')
async def reset_memory(matcher: Matcher, state: T_State, event: Event):
    user_id = str(event.get_user_id())
    with open(memory_path, 'r', encoding='utf-8') as f:
        memory_data = json.load(f)
    if user_id in memory_data:
        del memory_data[user_id]
        with open(memory_path, 'w', encoding='utf-8') as f:
            json.dump(memory_data, f, ensure_ascii=False, indent=4)
        await matcher.finish('记忆已重置~')
    await matcher.finish('没有找到该用户的记忆~')
`,9)]))}const o=i(h,[["render",e]]);export{m as __pageData,o as default};