import{_ as a,c as s,a7 as t,o as i}from"./chunks/framework.jrU0lkHV.js";const c=JSON.parse('{"title":"liteyuki.session.models","description":"","frontmatter":{"title":"liteyuki.session.models"},"headers":[],"relativePath":"dev/api/session/models.md","filePath":"zh/dev/api/session/models.md","lastUpdated":null}'),n={name:"dev/api/session/models.md"};function r(o,e,l,h,d,k){return i(),s("div",null,e[0]||(e[0]=[t('
liteyuki.session.models
本模块使用了nonebot-plugin-uninfo的部分模型定义 MIT License
Copyright (c) 2024 RF-Tar-Railt
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SceneType(int, Enum)
PRIVATE = 0
GROUP = 1
GUILD = 2
CHANNEL_TEXT = 3
CHANNEL_CATEGORY = 4
CHANNEL_VOICE = 5
User(BaseModel)
id: str = NO_DEFAULT
name: str | None = None
nick: str | None = None
avatar: str | None = None
gender: str | None = None
Scene(BaseModel)
id: str = NO_DEFAULT
type: SceneType = NO_DEFAULT
name: str | None = None
avatar: str | None = None
parent: 'Scene | None' = None
Role(BaseModel)
id: str = NO_DEFAULT
level: int | None = None
name: str | None = None
Member(BaseModel)
user: User = NO_DEFAULT
nickname: str | None = None
role: Role | None = None
mute: bool | None = None
joined_at: datetime | None = None
Session(BaseModel)
session_id(self)
@property\ndef session_id(self):\n if self.scope == SceneType.PRIVATE:\n return f'{self.scope}:{self.user.id}'\n elif self.scope in (SceneType.GROUP, SceneType.GUILD, SceneType.CHANNEL_TEXT, SceneType.CHANNEL_VOICE, SceneType.CHANNEL_CATEGORY):\n return f'{self.scope}:{self.scene.id}'\n else:\n raise ValueError('Invalid SceneType')
target_id(self)
@property\ndef target_id(self):\n if self.scope == SceneType.PRIVATE:\n return f'{self.scope}:{self.user.id}'\n elif self.scope in (SceneType.GROUP, SceneType.GUILD, SceneType.CHANNEL_TEXT, SceneType.CHANNEL_VOICE, SceneType.CHANNEL_CATEGORY):\n return f'{self.scope}:{self.scene.id}:{self.user.id}'
self_id: str = NO_DEFAULT
adapter: str = NO_DEFAULT
scope: str = NO_DEFAULT
scene: Scene = NO_DEFAULT
user: User = NO_DEFAULT
member: 'Member | None' = None
operator: 'Member | None' = None