mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-28 08:41:29 +00:00
🏗️ update cqhttp models
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
from typing_extension import Literal
|
from typing_extensions import Literal
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from nonebot.typing import overrides
|
from nonebot.typing import overrides
|
||||||
@ -218,6 +218,7 @@ class CQHTTPEvent(BaseModel):
|
|||||||
extra = "allow"
|
extra = "allow"
|
||||||
|
|
||||||
|
|
||||||
|
# Models
|
||||||
class Sender(BaseModel):
|
class Sender(BaseModel):
|
||||||
user_id: Optional[int] = None
|
user_id: Optional[int] = None
|
||||||
nickname: Optional[str] = None
|
nickname: Optional[str] = None
|
||||||
@ -252,6 +253,15 @@ class File(BaseModel):
|
|||||||
extra = "allow"
|
extra = "allow"
|
||||||
|
|
||||||
|
|
||||||
|
class Status(BaseModel):
|
||||||
|
online: bool
|
||||||
|
good: bool
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
extra = "allow"
|
||||||
|
|
||||||
|
|
||||||
|
# Message Events
|
||||||
class MessageEvent(CQHTTPEvent):
|
class MessageEvent(CQHTTPEvent):
|
||||||
post_type: Literal["message"]
|
post_type: Literal["message"]
|
||||||
message_type: str
|
message_type: str
|
||||||
@ -280,26 +290,27 @@ class GroupMessageEvent(MessageEvent):
|
|||||||
anonymous: Anonymous
|
anonymous: Anonymous
|
||||||
|
|
||||||
|
|
||||||
|
# Notice Events
|
||||||
class NoticeEvent(CQHTTPEvent):
|
class NoticeEvent(CQHTTPEvent):
|
||||||
post_type: Literal["notice"]
|
post_type: Literal["notice"]
|
||||||
notice_type: str
|
notice_type: str
|
||||||
|
|
||||||
|
|
||||||
class GroupUploadEvent(NoticeEvent):
|
class GroupUploadNoticeEvent(NoticeEvent):
|
||||||
notice_type: Literal["group_upload"]
|
notice_type: Literal["group_upload"]
|
||||||
user_id: int
|
user_id: int
|
||||||
group_id: int
|
group_id: int
|
||||||
file: File
|
file: File
|
||||||
|
|
||||||
|
|
||||||
class GroupAdminEvent(NoticeEvent):
|
class GroupAdminNoticeEvent(NoticeEvent):
|
||||||
notice_type: Literal["group_admin"]
|
notice_type: Literal["group_admin"]
|
||||||
sub_type: str
|
sub_type: str
|
||||||
user_id: int
|
user_id: int
|
||||||
group_id: int
|
group_id: int
|
||||||
|
|
||||||
|
|
||||||
class GroupDecreaseEvent(NoticeEvent):
|
class GroupDecreaseNoticeEvent(NoticeEvent):
|
||||||
notice_type: Literal["group_decrease"]
|
notice_type: Literal["group_decrease"]
|
||||||
sub_type: str
|
sub_type: str
|
||||||
user_id: int
|
user_id: int
|
||||||
@ -307,7 +318,7 @@ class GroupDecreaseEvent(NoticeEvent):
|
|||||||
operator_id: int
|
operator_id: int
|
||||||
|
|
||||||
|
|
||||||
class GroupIncreaseEvent(NoticeEvent):
|
class GroupIncreaseNoticeEvent(NoticeEvent):
|
||||||
notice_type: Literal["group_increase"]
|
notice_type: Literal["group_increase"]
|
||||||
sub_type: str
|
sub_type: str
|
||||||
user_id: int
|
user_id: int
|
||||||
@ -315,7 +326,7 @@ class GroupIncreaseEvent(NoticeEvent):
|
|||||||
operator_id: int
|
operator_id: int
|
||||||
|
|
||||||
|
|
||||||
class GroupBanEvent(NoticeEvent):
|
class GroupBanNoticeEvent(NoticeEvent):
|
||||||
notice_type: Literal["group_ban"]
|
notice_type: Literal["group_ban"]
|
||||||
sub_type: str
|
sub_type: str
|
||||||
user_id: int
|
user_id: int
|
||||||
@ -324,12 +335,12 @@ class GroupBanEvent(NoticeEvent):
|
|||||||
duration: int
|
duration: int
|
||||||
|
|
||||||
|
|
||||||
class FriendAddEvent(NoticeEvent):
|
class FriendAddNoticeEvent(NoticeEvent):
|
||||||
notice_type: Literal["friend_add"]
|
notice_type: Literal["friend_add"]
|
||||||
user_id: int
|
user_id: int
|
||||||
|
|
||||||
|
|
||||||
class GroupRecallEvent(NoticeEvent):
|
class GroupRecallNoticeEvent(NoticeEvent):
|
||||||
notice_type: Literal["group_recall"]
|
notice_type: Literal["group_recall"]
|
||||||
user_id: int
|
user_id: int
|
||||||
group_id: int
|
group_id: int
|
||||||
@ -337,7 +348,7 @@ class GroupRecallEvent(NoticeEvent):
|
|||||||
message_id: int
|
message_id: int
|
||||||
|
|
||||||
|
|
||||||
class FriendRecallEvent(NoticeEvent):
|
class FriendRecallNoticeEvent(NoticeEvent):
|
||||||
notice_type: Literal["friend_recall"]
|
notice_type: Literal["friend_recall"]
|
||||||
user_id: int
|
user_id: int
|
||||||
message_id: int
|
message_id: int
|
||||||
@ -360,3 +371,41 @@ class LuckyKingNotifyEvent(NotifyEvent):
|
|||||||
|
|
||||||
class HonorNotifyEvent(NotifyEvent):
|
class HonorNotifyEvent(NotifyEvent):
|
||||||
honor_type: str
|
honor_type: str
|
||||||
|
|
||||||
|
|
||||||
|
# Request Events
|
||||||
|
class RequestEvent(CQHTTPEvent):
|
||||||
|
post_type: Literal["request"]
|
||||||
|
request_type: str
|
||||||
|
|
||||||
|
|
||||||
|
class FriendRequestEvent(RequestEvent):
|
||||||
|
request_type: Literal["friend"]
|
||||||
|
user_id: int
|
||||||
|
comment: str
|
||||||
|
flag: str
|
||||||
|
|
||||||
|
|
||||||
|
class GroupRequestEvent(RequestEvent):
|
||||||
|
request_type: Literal["group"]
|
||||||
|
sub_type: str
|
||||||
|
group_id: int
|
||||||
|
user_id: int
|
||||||
|
comment: str
|
||||||
|
flag: str
|
||||||
|
|
||||||
|
|
||||||
|
class MetaEvent(CQHTTPEvent):
|
||||||
|
post_type: Literal["meta_event"]
|
||||||
|
meta_event_type: str
|
||||||
|
|
||||||
|
|
||||||
|
class LifecycleMetaEvent(MetaEvent):
|
||||||
|
meta_event_type: Literal["lifecycle"]
|
||||||
|
sub_type: str
|
||||||
|
|
||||||
|
|
||||||
|
class HeartbeatMetaEvent(MetaEvent):
|
||||||
|
meta_event_type: Literal["heartbeat"]
|
||||||
|
status: Status
|
||||||
|
interval: int
|
||||||
|
21
poetry.lock
generated
21
poetry.lock
generated
@ -778,6 +778,7 @@ python-versions = ">=3.6"
|
|||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
python-dotenv = {version = ">=0.10.4", optional = true, markers = "extra == \"dotenv\""}
|
python-dotenv = {version = ">=0.10.4", optional = true, markers = "extra == \"dotenv\""}
|
||||||
|
typing-extensions = {version = ">=3.7.2", optional = true, markers = "extra == \"typing_extensions\""}
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
dotenv = ["python-dotenv (>=0.10.4)"]
|
dotenv = ["python-dotenv (>=0.10.4)"]
|
||||||
@ -1335,6 +1336,19 @@ type = "legacy"
|
|||||||
url = "https://mirrors.aliyun.com/pypi/simple"
|
url = "https://mirrors.aliyun.com/pypi/simple"
|
||||||
reference = "aliyun"
|
reference = "aliyun"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typing-extensions"
|
||||||
|
version = "3.7.4.3"
|
||||||
|
description = "Backported and Experimental Type Hints for Python 3.5+"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
|
||||||
|
[package.source]
|
||||||
|
type = "legacy"
|
||||||
|
url = "https://mirrors.aliyun.com/pypi/simple"
|
||||||
|
reference = "aliyun"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tzlocal"
|
name = "tzlocal"
|
||||||
version = "2.1"
|
version = "2.1"
|
||||||
@ -1525,7 +1539,7 @@ reference = "aliyun"
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "1.1"
|
lock-version = "1.1"
|
||||||
python-versions = "^3.7"
|
python-versions = "^3.7"
|
||||||
content-hash = "0da75a94321ca12c591f2cff0f9a2d7a78d9889fff5194f2b8c542f5299f13bd"
|
content-hash = "c27248983f636cada2e4fb0385fe8ea0a1e933dd85fc149bccf67587bdc7a0b8"
|
||||||
|
|
||||||
[metadata.files]
|
[metadata.files]
|
||||||
aiofiles = [
|
aiofiles = [
|
||||||
@ -2026,6 +2040,11 @@ texttable = [
|
|||||||
{file = "texttable-1.6.3-py2.py3-none-any.whl", hash = "sha256:f802f2ef8459058736264210f716c757cbf85007a30886d8541aa8c3404f1dda"},
|
{file = "texttable-1.6.3-py2.py3-none-any.whl", hash = "sha256:f802f2ef8459058736264210f716c757cbf85007a30886d8541aa8c3404f1dda"},
|
||||||
{file = "texttable-1.6.3.tar.gz", hash = "sha256:ce0faf21aa77d806bbff22b107cc22cce68dc9438f97a2df32c93e9afa4ce436"},
|
{file = "texttable-1.6.3.tar.gz", hash = "sha256:ce0faf21aa77d806bbff22b107cc22cce68dc9438f97a2df32c93e9afa4ce436"},
|
||||||
]
|
]
|
||||||
|
typing-extensions = [
|
||||||
|
{file = "typing_extensions-3.7.4.3-py2-none-any.whl", hash = "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"},
|
||||||
|
{file = "typing_extensions-3.7.4.3-py3-none-any.whl", hash = "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918"},
|
||||||
|
{file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"},
|
||||||
|
]
|
||||||
tzlocal = [
|
tzlocal = [
|
||||||
{file = "tzlocal-2.1-py2.py3-none-any.whl", hash = "sha256:e2cb6c6b5b604af38597403e9852872d7f534962ae2954c7f35efcb1ccacf4a4"},
|
{file = "tzlocal-2.1-py2.py3-none-any.whl", hash = "sha256:e2cb6c6b5b604af38597403e9852872d7f534962ae2954c7f35efcb1ccacf4a4"},
|
||||||
{file = "tzlocal-2.1.tar.gz", hash = "sha256:643c97c5294aedc737780a49d9df30889321cbe1204eac2c2ec6134035a92e44"},
|
{file = "tzlocal-2.1.tar.gz", hash = "sha256:643c97c5294aedc737780a49d9df30889321cbe1204eac2c2ec6134035a92e44"},
|
||||||
|
@ -29,7 +29,7 @@ loguru = "^0.5.1"
|
|||||||
pygtrie = "^2.4.1"
|
pygtrie = "^2.4.1"
|
||||||
fastapi = "^0.58.1"
|
fastapi = "^0.58.1"
|
||||||
uvicorn = "^0.11.5"
|
uvicorn = "^0.11.5"
|
||||||
pydantic = { extras = ["dotenv"], version = "^1.7.2" }
|
pydantic = {extras = ["dotenv", "typing_extensions"], version = "^1.7.3"}
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
yapf = "^0.30.0"
|
yapf = "^0.30.0"
|
||||||
|
Reference in New Issue
Block a user