alicebot.adapter.onebot.message
OneBot 适配器消息。
class OneBotMessage
Bases: alicebot.message.Message
OneBot 消息。
method __init__(self, *messages)
{#Message.__init__}
初始化。
Arguments
- *messages (Union[List[~MessageSegmentT], ~MessageSegmentT, str, Mapping[str, Any]]) - 可以被转化为消息的数据。
Returns
Type: None
method get_segment_class()
{#OneBotMessage.get_segment_class}
获取消息字段类。
Returns
Type: Type[OneBotMessageSegment]
消息字段类。
class OneBotMessageSegment
Bases: alicebot.message.MessageSegment[OneBotMessage]
OneBot 消息字段。
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 audio(file_id)
音频
Returns
Type: typing_extensions.Self
method file(file_id)
文件
Returns
Type: typing_extensions.Self
method from_str(msg)
{#OneBotMessageSegment.from_str}
用于将 str
转换为消息字段。
Returns
Type: typing_extensions.Self
由
str
转换的消息字段。
method get_message_class()
{#OneBotMessageSegment.get_message_class}
获取消息类。
Returns
Type: Type[OneBotMessage]
消息类。
method image(file_id)
图片
Returns
Type: typing_extensions.Self
method location(latitude, longitude, title, content)
位置
Arguments
longitude (float)
title (str)
content (str)
Returns
Type: typing_extensions.Self
method mention(user_id)
提及
Returns
Type: typing_extensions.Self
method mention_all()
{#OneBotMessageSegment.mention_all}
提及所有人
Returns
Type: typing_extensions.Self
method reply(message_id, user_id)
回复
Arguments
- user_id (str)
Returns
Type: typing_extensions.Self
method text(text)
纯文本
Returns
Type: typing_extensions.Self
method video(file_id)
视频
Returns
Type: typing_extensions.Self
method voice(file_id)
语音
Returns
Type: typing_extensions.Self