mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-01-31 15:41:34 +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'
|
MEMBER = 'MEMBER'
|
||||||
|
|
||||||
|
|
||||||
|
class NudgeSubjectKind(str, Enum):
|
||||||
|
"""
|
||||||
|
:说明:
|
||||||
|
|
||||||
|
戳一戳类型枚举类
|
||||||
|
|
||||||
|
* ``Group``: 群
|
||||||
|
* ``Friend``: 好友
|
||||||
|
"""
|
||||||
|
Group = 'Group'
|
||||||
|
Friend = 'Friend'
|
||||||
|
|
||||||
|
|
||||||
class GroupInfo(BaseModel):
|
class GroupInfo(BaseModel):
|
||||||
id: int
|
id: int
|
||||||
name: str
|
name: str
|
||||||
@ -46,6 +59,11 @@ class PrivateChatInfo(BaseModel):
|
|||||||
remark: str
|
remark: str
|
||||||
|
|
||||||
|
|
||||||
|
class NudgeSubject(BaseModel):
|
||||||
|
id: int
|
||||||
|
kind: NudgeSubjectKind
|
||||||
|
|
||||||
|
|
||||||
class Event(BaseEvent):
|
class Event(BaseEvent):
|
||||||
"""
|
"""
|
||||||
mirai-api-http 协议事件,字段与 mirai-api-http 一致。各事件字段参考 `mirai-api-http 事件类型`_
|
mirai-api-http 协议事件,字段与 mirai-api-http 一致。各事件字段参考 `mirai-api-http 事件类型`_
|
||||||
|
@ -2,7 +2,7 @@ from typing import Any, Optional
|
|||||||
|
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
|
|
||||||
from .base import Event, GroupChatInfo, GroupInfo, UserPermission
|
from .base import Event, GroupChatInfo, GroupInfo, NudgeSubject, UserPermission
|
||||||
|
|
||||||
|
|
||||||
class NoticeEvent(Event):
|
class NoticeEvent(Event):
|
||||||
@ -154,3 +154,12 @@ class MemberPermissionChangeEvent(MemberStateChangeEvent):
|
|||||||
"""成员权限改变的事件(该成员不是Bot)"""
|
"""成员权限改变的事件(该成员不是Bot)"""
|
||||||
origin: UserPermission
|
origin: UserPermission
|
||||||
current: UserPermission
|
current: UserPermission
|
||||||
|
|
||||||
|
|
||||||
|
class NudgeEvent(NoticeEvent):
|
||||||
|
"""戳一戳触发事件"""
|
||||||
|
from_id: int = Field(alias='fromId')
|
||||||
|
target: int
|
||||||
|
subject: NudgeSubject
|
||||||
|
action: str
|
||||||
|
suffix: str
|
||||||
|
Loading…
x
Reference in New Issue
Block a user