Skip to content

noneplugin/nonebot-plugin-session-orm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nonebot-plugin-session-orm

session 提供数据库模型及存取方法

安装

  • 使用 nb-cli
nb plugin install nonebot_plugin_session_orm
  • 使用 pip
pip install nonebot_plugin_session_orm

使用

from nonebot import require

require("nonebot_plugin_session_orm")

from nonebot_plugin_session import EventSession
from nonebot_plugin_session_orm import get_session_persist_id, get_session_by_persist_id

@matcher.handle()
async def handle(session: EventSession):
    persist_id = await get_session_persist_id(session) # 存储 session,返回 persist_id
    session_loaded = await get_session_by_persist_id(persist_id) # 通过 persist_id 获取 session