模块 nonebot_plugin_marshoai.hooks
@driver.on_shutdown
async func auto_backup_context()
源代码 或 在GitHub上查看
python
@driver.on_shutdown
async def auto_backup_context():
for target_info in target_list:
target_id, target_private = target_info
contexts_data = context.build(target_id, target_private)
if target_private:
target_uid = 'private_' + target_id
else:
target_uid = 'group_' + target_id
await save_context_to_json(f'back_up_context_{target_uid}', contexts_data, 'contexts/backup')
logger.info(f'已保存会话 {target_id} 的上下文备份,将在下次对话时恢复~')
var marshoai_plugin_dirs
说明: 加载内置插件
默认值:
config.marshoai_plugin_dirs