# hooks | Marsho AI
Kawaii, Intelligent and Easy to Extend

Skip to content

# Module `nonebot_plugin_marshoai.hooks` ​

`@driver.on_shutdown`

### async func `auto_backup_context()` ​

Source code or View on 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` ​

- Description: 加载内置插件

- Default: `config.marshoai_plugin_dirs`