mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-01-19 09:38:21 +08:00
⚡ add support for mirai adapter NudgeEvent
, fix #494
This commit is contained in:
parent
4a7c07a7ac
commit
6d9caadffc
@ -27,6 +27,19 @@ class UserPermission(str, Enum):
|
||||
MEMBER = 'MEMBER'
|
||||
|
||||
|
||||
class NudgeSubjectKind(str, Enum):
|
||||
"""
|
||||
:说明:
|
||||
|
||||
戳一戳类型枚举类
|
||||
|
||||
* ``Group``: 群
|
||||
* ``Friend``: 好友
|
||||
"""
|
||||
Group = 'Group'
|
||||
Friend = 'Friend'
|
||||
|
||||
|
||||
class GroupInfo(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
@ -46,6 +59,11 @@ class PrivateChatInfo(BaseModel):
|
||||
remark: str
|
||||
|
||||
|
||||
class NudgeSubject(BaseModel):
|
||||
id: int
|
||||
kind: NudgeSubjectKind
|
||||
|
||||
|
||||
class Event(BaseEvent):
|
||||
"""
|
||||
mirai-api-http 协议事件,字段与 mirai-api-http 一致。各事件字段参考 `mirai-api-http 事件类型`_
|
||||
|
@ -2,7 +2,7 @@ from typing import Any, Optional
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
from .base import Event, GroupChatInfo, GroupInfo, UserPermission
|
||||
from .base import Event, GroupChatInfo, GroupInfo, NudgeSubject, UserPermission
|
||||
|
||||
|
||||
class NoticeEvent(Event):
|
||||
@ -154,3 +154,12 @@ class MemberPermissionChangeEvent(MemberStateChangeEvent):
|
||||
"""成员权限改变的事件(该成员不是Bot)"""
|
||||
origin: UserPermission
|
||||
current: UserPermission
|
||||
|
||||
|
||||
class NudgeEvent(NoticeEvent):
|
||||
"""戳一戳触发事件"""
|
||||
from_id: int = Field(alias='fromId')
|
||||
target: int
|
||||
subject: NudgeSubject
|
||||
action: str
|
||||
suffix: str
|
||||
|
Loading…
Reference in New Issue
Block a user