alicebot.adapter.mirai.event.message
消息事件。
class MessageEvent
Bases: alicebot.adapter.mirai.event.base.MiraiEvent
, alicebot.event.MessageEvent[MiraiAdapter]
消息事件
Attributes
sender (Union[alicebot.adapter.mirai.event.base.FriendInfo, alicebot.adapter.mirai.event.base.GroupMemberInfo, alicebot.adapter.mirai.event.base.OtherClientSender])
messageChain (alicebot.adapter.mirai.message.MiraiMessage)
method __init__(__pydantic_self__, **data)
{#BaseModel.__init__}
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
__init__
uses __pydantic_self__
instead of the more common self
for the first arg to allow self
as a field name.
Arguments
- data (Any)
Returns
Type: None
method get_plain_text(self)
{#MessageEvent.get_plain_text}
获取消息的纯文本内容。
Returns
Type: str
消息的纯文本内容。
async method is_same_sender(self, other)
{#MessageEvent.is_same_sender}
判断自身和另一个事件是否是同一个发送者。
Arguments
- other (typing_extensions.Self) - 另一个事件。
Returns
Type: bool
是否是同一个发送者。
readonly property message
Type: alicebot.adapter.mirai.message.MiraiMessage
与 messageChain 相同。
async method reply(self, message, quote = False)
回复消息。
Arguments
message (Union[List[alicebot.adapter.mirai.message.MiraiMessageSegment], alicebot.adapter.mirai.message.MiraiMessageSegment, str, Mapping[str, Any]]) - 回复消息的内容,同
call_api()
方法。quote (bool) - 引用消息,默认为
False
。
Returns
Type: Dict[str, Any]
API 请求响应。
class FriendMessage
Bases: alicebot.adapter.mirai.event.message.MessageEvent
好友消息
Attributes
type (Literal['FriendMessage'])
sender (alicebot.adapter.mirai.event.base.FriendInfo)
method __init__(__pydantic_self__, **data)
{#BaseModel.__init__}
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
__init__
uses __pydantic_self__
instead of the more common self
for the first arg to allow self
as a field name.
Arguments
- data (Any)
Returns
Type: None
async method reply(self, message, quote = False)
回复消息。
Arguments
message (Union[List[alicebot.adapter.mirai.message.MiraiMessageSegment], alicebot.adapter.mirai.message.MiraiMessageSegment, str, Mapping[str, Any]]) - 回复消息的内容,同
call_api()
方法。quote (bool) - 引用消息,默认为
False
。
Returns
Type: Dict[str, Any]
API 请求响应。
class GroupMessage
Bases: alicebot.adapter.mirai.event.message.MessageEvent
群消息
Attributes
type (Literal['GroupMessage'])
sender (alicebot.adapter.mirai.event.base.GroupMemberInfo)
method __init__(__pydantic_self__, **data)
{#BaseModel.__init__}
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
__init__
uses __pydantic_self__
instead of the more common self
for the first arg to allow self
as a field name.
Arguments
- data (Any)
Returns
Type: None
async method reply(self, message, quote = False)
回复消息。
Arguments
message (Union[List[alicebot.adapter.mirai.message.MiraiMessageSegment], alicebot.adapter.mirai.message.MiraiMessageSegment, str, Mapping[str, Any]]) - 回复消息的内容,同
call_api()
方法。quote (bool) - 引用消息,默认为
False
。
Returns
Type: Dict[str, Any]
API 请求响应。
class TempMessage
Bases: alicebot.adapter.mirai.event.message.MessageEvent
群临时消息
Attributes
type (Literal['TempMessage'])
sender (alicebot.adapter.mirai.event.base.GroupMemberInfo)
method __init__(__pydantic_self__, **data)
{#BaseModel.__init__}
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
__init__
uses __pydantic_self__
instead of the more common self
for the first arg to allow self
as a field name.
Arguments
- data (Any)
Returns
Type: None
async method reply(self, message, quote = False)
回复消息。
Arguments
message (Union[List[alicebot.adapter.mirai.message.MiraiMessageSegment], alicebot.adapter.mirai.message.MiraiMessageSegment, str, Mapping[str, Any]]) - 回复消息的内容,同
call_api()
方法。quote (bool) - 引用消息,默认为
False
。
Returns
Type: Dict[str, Any]
API 请求响应。
class StrangerMessage
Bases: alicebot.adapter.mirai.event.message.MessageEvent
陌生人消息
Attributes
type (Literal['StrangerMessage'])
sender (alicebot.adapter.mirai.event.base.FriendInfo)
method __init__(__pydantic_self__, **data)
{#BaseModel.__init__}
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
__init__
uses __pydantic_self__
instead of the more common self
for the first arg to allow self
as a field name.
Arguments
- data (Any)
Returns
Type: None
async method reply(self, message, quote = False)
回复消息。
Arguments
message (Union[List[alicebot.adapter.mirai.message.MiraiMessageSegment], alicebot.adapter.mirai.message.MiraiMessageSegment, str, Mapping[str, Any]]) - 回复消息的内容,同
call_api()
方法。quote (bool) - 引用消息,默认为
False
。
Returns
Type: Dict[str, Any]
API 请求响应。
class OtherClientMessage
Bases: alicebot.adapter.mirai.event.message.MessageEvent
其他客户端消息
Attributes
type (Literal['OtherClientMessage'])
sender (alicebot.adapter.mirai.event.base.OtherClientSender)
method __init__(__pydantic_self__, **data)
{#BaseModel.__init__}
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
__init__
uses __pydantic_self__
instead of the more common self
for the first arg to allow self
as a field name.
Arguments
- data (Any)
Returns
Type: None
async method reply(self, message, quote = False)
回复消息。
Arguments
message (Union[List[alicebot.adapter.mirai.message.MiraiMessageSegment], alicebot.adapter.mirai.message.MiraiMessageSegment, str, Mapping[str, Any]]) - 回复消息的内容,同
call_api()
方法。quote (bool) - 引用消息,默认为
False
。
Returns
Type: Dict[str, Any]
API 请求响应。