import{_ as a,c as s,a7 as t,o as i}from"./chunks/framework.Z6UMW4JZ.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.

class SceneType(int, Enum)

attr PRIVATE = 0

attr GROUP = 1

attr GUILD = 2

attr CHANNEL_TEXT = 3

attr CHANNEL_CATEGORY = 4

attr CHANNEL_VOICE = 5

class User(BaseModel)

attr id: str = NO_DEFAULT

attr name: str | None = None

attr nick: str | None = None

attr avatar: str | None = None

attr gender: str | None = None

class Scene(BaseModel)

attr id: str = NO_DEFAULT

attr type: SceneType = NO_DEFAULT

attr name: str | None = None

attr avatar: str | None = None

attr parent: 'Scene | None' = None

class Role(BaseModel)

attr id: str = NO_DEFAULT

attr level: int | None = None

attr name: str | None = None

class Member(BaseModel)

attr user: User = NO_DEFAULT

attr nickname: str | None = None

attr role: Role | None = None

attr mute: bool | None = None

attr joined_at: datetime | None = None

class Session(BaseModel)


@property

func session_id(self)

源代码在GitHub上查看
python
@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')

@property

func target_id(self)

源代码在GitHub上查看
python
@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}'

attr self_id: str = NO_DEFAULT

attr adapter: str = NO_DEFAULT

attr scope: str = NO_DEFAULT

attr scene: Scene = NO_DEFAULT

attr user: User = NO_DEFAULT

attr member: 'Member | None' = None

attr operator: 'Member | None' = None

',51)]))}const g=a(n,[["render",r]]);export{c as __pageData,g as default};