跳转至

message

Ariadne 消息事件

ActiveFriendMessage 🔗

Bases: ActiveMessage

主动好友消息

Source code in src/graia/ariadne/event/message.py
183
184
185
186
187
188
189
190
191
192
class ActiveFriendMessage(ActiveMessage):
    """主动好友消息"""

    type: str = "ActiveFriendMessage"

    message_chain: MessageChain = Field(..., alias="messageChain")
    """消息链"""

    subject: Friend
    """消息接收者"""

message_chain class-attribute instance-attribute 🔗

message_chain: MessageChain = Field(..., alias='messageChain')

消息链

subject instance-attribute 🔗

subject: Friend

消息接收者

ActiveGroupMessage 🔗

Bases: ActiveMessage

主动群组消息

Source code in src/graia/ariadne/event/message.py
195
196
197
198
199
200
201
202
203
204
class ActiveGroupMessage(ActiveMessage):
    """主动群组消息"""

    type: str = "ActiveGroupMessage"

    message_chain: MessageChain = Field(..., alias="messageChain")
    """消息链"""

    subject: Group
    """消息接收者"""

message_chain class-attribute instance-attribute 🔗

message_chain: MessageChain = Field(..., alias='messageChain')

消息链

subject instance-attribute 🔗

subject: Group

消息接收者

ActiveMessage 🔗

Bases: MiraiEvent

主动消息:Bot 账号发送给他人的消息

Source code in src/graia/ariadne/event/message.py
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
class ActiveMessage(MiraiEvent):
    """主动消息:Bot 账号发送给他人的消息"""

    type: str

    message_chain: MessageChain = Field(..., alias="messageChain")
    """消息链"""

    subject: Union[Friend, Group, Member, Stranger]
    """消息接收者"""

    sync: bool = False
    """是否为同步消息"""

    source: Source
    """消息元数据标识"""

    quote: Optional[Quote] = None
    """可能的引用消息对象"""

    __source_quote_setter = root_validator(pre=True, allow_reuse=True)(_set_source_quote)

    def __int__(self):
        return self.id

    @property
    def id(self) -> int:
        return self.source.id

    class Dispatcher(BaseDispatcher):
        mixin = [MessageChainDispatcher, SourceDispatcher, QuoteDispatcher, SubjectDispatcher]

message_chain class-attribute instance-attribute 🔗

message_chain: MessageChain = Field(..., alias='messageChain')

消息链

quote class-attribute instance-attribute 🔗

quote: Optional[Quote] = None

可能的引用消息对象

source instance-attribute 🔗

source: Source

消息元数据标识

subject instance-attribute 🔗

subject: Union[Friend, Group, Member, Stranger]

消息接收者

sync class-attribute instance-attribute 🔗

sync: bool = False

是否为同步消息

ActiveStrangerMessage 🔗

Bases: ActiveMessage

主动陌生人消息

Source code in src/graia/ariadne/event/message.py
225
226
227
228
229
230
231
232
233
234
class ActiveStrangerMessage(ActiveMessage):
    """主动陌生人消息"""

    type: str = "ActiveStrangerMessage"

    message_chain: MessageChain = Field(..., alias="messageChain")
    """消息链"""

    subject: Stranger
    """消息接收者"""

message_chain class-attribute instance-attribute 🔗

message_chain: MessageChain = Field(..., alias='messageChain')

消息链

subject instance-attribute 🔗

subject: Stranger

消息接收者

ActiveTempMessage 🔗

Bases: ActiveMessage

主动临时消息

Source code in src/graia/ariadne/event/message.py
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
class ActiveTempMessage(ActiveMessage):
    """主动临时消息"""

    type: str = "ActiveTempMessage"

    message_chain: MessageChain = Field(..., alias="messageChain")
    """消息链"""

    subject: Member
    """消息接收者"""

    class Dispatcher(ActiveMessage.Dispatcher):
        @staticmethod
        async def catch(interface: DispatcherInterface):
            if isinstance(interface.event, ActiveTempMessage) and interface.annotation is Group:
                return interface.event.subject.group

message_chain class-attribute instance-attribute 🔗

message_chain: MessageChain = Field(..., alias='messageChain')

消息链

subject instance-attribute 🔗

subject: Member

消息接收者

FriendMessage 🔗

Bases: MessageEvent, FriendEvent

好友消息

Source code in src/graia/ariadne/event/message.py
78
79
80
81
82
83
84
85
86
87
class FriendMessage(MessageEvent, FriendEvent):
    """好友消息"""

    type: str = "FriendMessage"

    message_chain: MessageChain = Field(..., alias="messageChain")
    """消息链"""

    sender: Friend
    """发送者"""

message_chain class-attribute instance-attribute 🔗

message_chain: MessageChain = Field(..., alias='messageChain')

消息链

sender instance-attribute 🔗

sender: Friend

发送者

FriendSyncMessage 🔗

Bases: SyncMessage, ActiveFriendMessage

好友同步消息

Source code in src/graia/ariadne/event/message.py
243
244
245
246
class FriendSyncMessage(SyncMessage, ActiveFriendMessage):
    """好友同步消息"""

    type: str = "FriendSyncMessage"

GroupMessage 🔗

Bases: MessageEvent, GroupEvent

群组消息

Source code in src/graia/ariadne/event/message.py
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
class GroupMessage(MessageEvent, GroupEvent):
    """群组消息"""

    type: str = "GroupMessage"

    message_chain: MessageChain = Field(..., alias="messageChain")
    """消息链"""

    sender: Member
    """发送者"""

    class Dispatcher(MessageEvent.Dispatcher):
        @staticmethod
        async def catch(interface: DispatcherInterface):
            if isinstance(interface.event, GroupMessage) and generic_issubclass(Group, interface.annotation):
                return interface.event.sender.group

message_chain class-attribute instance-attribute 🔗

message_chain: MessageChain = Field(..., alias='messageChain')

消息链

sender instance-attribute 🔗

sender: Member

发送者

GroupSyncMessage 🔗

Bases: SyncMessage, ActiveGroupMessage

群组同步消息

Source code in src/graia/ariadne/event/message.py
249
250
251
252
class GroupSyncMessage(SyncMessage, ActiveGroupMessage):
    """群组同步消息"""

    type: str = "GroupSyncMessage"

MessageEvent 🔗

Bases: MiraiEvent

Ariadne 消息事件基类

Source code in src/graia/ariadne/event/message.py
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
class MessageEvent(MiraiEvent):
    """Ariadne 消息事件基类"""

    type: str = "MessageEvent"

    message_chain: MessageChain = Field(..., alias="messageChain")
    """消息链"""

    sender: Union[Friend, Member, Client, Stranger]
    """发送者"""

    source: Source
    """消息元数据标识"""

    quote: Optional[Quote] = None
    """可能的引用消息对象"""

    __source_quote_setter = root_validator(pre=True, allow_reuse=True)(_set_source_quote)

    def __int__(self):
        return self.id

    @property
    def id(self) -> int:
        return self.source.id

    class Dispatcher(BaseDispatcher):
        mixin = [MessageChainDispatcher, SourceDispatcher, QuoteDispatcher, SenderDispatcher]

message_chain class-attribute instance-attribute 🔗

message_chain: MessageChain = Field(..., alias='messageChain')

消息链

quote class-attribute instance-attribute 🔗

quote: Optional[Quote] = None

可能的引用消息对象

sender instance-attribute 🔗

sender: Union[Friend, Member, Client, Stranger]

发送者

source instance-attribute 🔗

source: Source

消息元数据标识

OtherClientMessage 🔗

Bases: MessageEvent

其他客户端消息

Source code in src/graia/ariadne/event/message.py
126
127
128
129
130
131
132
133
134
135
class OtherClientMessage(MessageEvent):
    """其他客户端消息"""

    type: str = "OtherClientMessage"

    message_chain: MessageChain = Field(..., alias="messageChain")
    """消息链"""

    sender: Client
    """发送者"""

message_chain class-attribute instance-attribute 🔗

message_chain: MessageChain = Field(..., alias='messageChain')

消息链

sender instance-attribute 🔗

sender: Client

发送者

StrangerMessage 🔗

Bases: MessageEvent

陌生人消息

Source code in src/graia/ariadne/event/message.py
138
139
140
141
142
143
144
145
146
147
class StrangerMessage(MessageEvent):
    """陌生人消息"""

    type: str = "StrangerMessage"

    message_chain: MessageChain = Field(..., alias="messageChain")
    """消息链"""

    sender: Stranger
    """发送者"""

message_chain class-attribute instance-attribute 🔗

message_chain: MessageChain = Field(..., alias='messageChain')

消息链

sender instance-attribute 🔗

sender: Stranger

发送者

StrangerSyncMessage 🔗

Bases: SyncMessage, ActiveStrangerMessage

陌生人同步消息

Source code in src/graia/ariadne/event/message.py
261
262
263
264
class StrangerSyncMessage(SyncMessage, ActiveStrangerMessage):
    """陌生人同步消息"""

    type: str = "StrangerSyncMessage"

SyncMessage 🔗

Bases: MiraiEvent

同步消息:从其他客户端同步的主动消息

Source code in src/graia/ariadne/event/message.py
237
238
239
240
class SyncMessage(MiraiEvent):
    """同步消息:从其他客户端同步的主动消息"""

    sync = True

TempMessage 🔗

Bases: MessageEvent

临时消息

Source code in src/graia/ariadne/event/message.py
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
class TempMessage(MessageEvent):
    """临时消息"""

    type: str = "TempMessage"

    message_chain: MessageChain = Field(..., alias="messageChain")
    """消息链"""

    sender: Member
    """发送者"""

    class Dispatcher(MessageEvent.Dispatcher):
        @staticmethod
        async def catch(interface: DispatcherInterface):
            if isinstance(interface.event, TempMessage) and generic_issubclass(Group, interface.annotation):
                return interface.event.sender.group

message_chain class-attribute instance-attribute 🔗

message_chain: MessageChain = Field(..., alias='messageChain')

消息链

sender instance-attribute 🔗

sender: Member

发送者

TempSyncMessage 🔗

Bases: SyncMessage, ActiveTempMessage

临时会话同步消息

Source code in src/graia/ariadne/event/message.py
255
256
257
258
class TempSyncMessage(SyncMessage, ActiveTempMessage):
    """临时会话同步消息"""

    type: str = "TempSyncMessage"