Skip to content

alicebot.adapter.onebot.event

OntBot 适配器事件。

class BotSelf

Bases: pydantic.main.BaseModel

机器人自身标识

  • Attributes

    • platform (str)

    • user_id (str)

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

class ImplVersion

Bases: pydantic.main.BaseModel

实现版本

  • Attributes

    • impl (str)

    • version (str)

    • onebot_version (str)

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

class BotStatus

Bases: pydantic.main.BaseModel

机器人状态

  • Attributes

    • self (BotSelf)

    • online (bool)

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

class Status

Bases: pydantic.main.BaseModel

运行状态

  • Attributes

    • good (bool)

    • bots (List[alicebot.adapter.onebot.event.BotStatus])

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

class OntBotEvent

Bases: alicebot.event.Event[OneBotAdapter]

CQHTTP 事件基类

  • Attributes

    • id (str)

    • time (float)

    • type (Literal['meta', 'message', 'notice', 'request'])

    • detail_type (str)

    • sub_type (str)

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_event_type() {#OntBotEvent.get_event_type}

获取事件类型。

  • Returns

    Type: Tuple[Optional[str], Optional[str], Optional[str]]

    事件类型。

class BotEvent

Bases: alicebot.adapter.onebot.event.OntBotEvent

包含 self 字段的机器人事件

  • Attributes

    • self (BotSelf)

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

readonly property to_me {#BotEvent.to_me}

Type: bool

是否是发给自己的。

class MetaEvent

Bases: alicebot.adapter.onebot.event.OntBotEvent

元事件

  • Attributes

    • type (Literal['meta'])

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

class ConnectMetaEvent

Bases: alicebot.adapter.onebot.event.MetaEvent

连接事件

  • Attributes

    • detail_type (Literal['connect'])

    • version (ImplVersion)

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

class HeartbeatMetaEvent

Bases: alicebot.adapter.onebot.event.MetaEvent

心跳事件

  • Attributes

    • detail_type (Literal['heartbeat'])

    • interval (int)

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

class StatusUpdateMetaEvent

Bases: alicebot.adapter.onebot.event.MetaEvent

状态更新事件

  • Attributes

    • detail_type (Literal['status_update'])

    • status (Status)

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

class MessageEvent

Bases: alicebot.adapter.onebot.event.BotEvent, alicebot.event.MessageEvent[OneBotAdapter]

消息事件

  • Attributes

    • type (Literal['message'])

    • message_id (str)

    • message (alicebot.adapter.onebot.message.OneBotMessage)

    • alt_message (str)

    • user_id (str)

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

    是否是同一个发送者。

async method reply(self, message)

回复消息。

  • Arguments

    • message (Union[List[alicebot.adapter.onebot.message.OneBotMessageSegment], alicebot.adapter.onebot.message.OneBotMessageSegment, str, Mapping[str, Any]]) - 回复消息的内容,同 call_api() 方法。
  • Returns

    Type: Dict[str, Any]

    API 请求响应。

class PrivateMessageEvent

Bases: alicebot.adapter.onebot.event.MessageEvent

私聊消息事件

  • Attributes

    • detail_type (Literal['private'])

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)

回复消息。

  • Arguments

    • message (Union[List[alicebot.adapter.onebot.message.OneBotMessageSegment], alicebot.adapter.onebot.message.OneBotMessageSegment, str, Mapping[str, Any]]) - 回复消息的内容,同 call_api() 方法。
  • Returns

    Type: Dict[str, Any]

    API 请求响应。

class GroupMessageEvent

Bases: alicebot.adapter.onebot.event.MessageEvent

群消息事件

  • Attributes

    • detail_type (Literal['group'])

    • group_id (str)

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)

回复消息。

  • Arguments

    • message (Union[List[alicebot.adapter.onebot.message.OneBotMessageSegment], alicebot.adapter.onebot.message.OneBotMessageSegment, str, Mapping[str, Any]]) - 回复消息的内容,同 call_api() 方法。
  • Returns

    Type: Dict[str, Any]

    API 请求响应。

class ChannelMessageEvent

Bases: alicebot.adapter.onebot.event.MessageEvent

频道消息事件

  • Attributes

    • detail_type (Literal['channel'])

    • guild_id (str)

    • channel_id (str)

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)

回复消息。

  • Arguments

    • message (Union[List[alicebot.adapter.onebot.message.OneBotMessageSegment], alicebot.adapter.onebot.message.OneBotMessageSegment, str, Mapping[str, Any]]) - 回复消息的内容,同 call_api() 方法。
  • Returns

    Type: Dict[str, Any]

    API 请求响应。

class NoticeEvent

Bases: alicebot.adapter.onebot.event.BotEvent

通知事件

  • Attributes

    • type (Literal['notice'])

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

class FriendIncreaseEvent

Bases: alicebot.adapter.onebot.event.NoticeEvent

好友增加事件

  • Attributes

    • detail_type (Literal['friend_increase'])

    • user_id (str)

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

class FriendDecreaseEvent

Bases: alicebot.adapter.onebot.event.NoticeEvent

好友减少事件

  • Attributes

    • detail_type (Literal['friend_decrease'])

    • user_id (str)

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

class PrivateMessageDeleteEvent

Bases: alicebot.adapter.onebot.event.NoticeEvent

私聊消息删除

  • Attributes

    • detail_type (Literal['private_message_delete'])

    • message_id (str)

    • user_id (str)

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

class GroupMemberIncreaseEvent

Bases: alicebot.adapter.onebot.event.NoticeEvent

群成员增加事件

  • Attributes

    • detail_type (Literal['group_member_increase'])

    • group_id (str)

    • user_id (str)

    • operator_id (str)

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

class GroupMemberDecreaseEvent

Bases: alicebot.adapter.onebot.event.NoticeEvent

群成员减少事件

  • Attributes

    • detail_type (Literal['group_member_decrease'])

    • group_id (str)

    • user_id (str)

    • operator_id (str)

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

class GroupMessageDeleteEvent

Bases: alicebot.adapter.onebot.event.NoticeEvent

群消息删除事件

  • Attributes

    • detail_type (Literal['group_message_delete'])

    • group_id (str)

    • message_id (str)

    • user_id (str)

    • operator_id (str)

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

class GuildMemberIncreaseEvent

Bases: alicebot.adapter.onebot.event.NoticeEvent

群组成员增加事件

  • Attributes

    • detail_type (Literal['guild_member_increase'])

    • guild_id (str)

    • user_id (str)

    • operator_id (str)

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

class GuildMemberDecreaseEvent

Bases: alicebot.adapter.onebot.event.NoticeEvent

群组成员减少事件

  • Attributes

    • detail_type (Literal['guild_member_decrease'])

    • guild_id (str)

    • user_id (str)

    • operator_id (str)

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

class ChannelMemberIncreaseEvent

Bases: alicebot.adapter.onebot.event.NoticeEvent

频道成员增加事件

  • Attributes

    • detail_type (Literal['channel_member_increase'])

    • guild_id (str)

    • channel_id (str)

    • user_id (str)

    • operator_id (str)

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

class ChannelMemberDecreaseEvent

Bases: alicebot.adapter.onebot.event.NoticeEvent

频道成员减少事件

  • Attributes

    • detail_type (Literal['channel_member_decrease'])

    • guild_id (str)

    • channel_id (str)

    • user_id (str)

    • operator_id (str)

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

class ChannelMessageDeleteEvent

Bases: alicebot.adapter.onebot.event.NoticeEvent

频道消息删除事件

  • Attributes

    • detail_type (Literal['channel_message_delete'])

    • guild_id (str)

    • channel_id (str)

    • message_id (str)

    • user_id (str)

    • operator_id (str)

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

class ChannelCreateEvent

Bases: alicebot.adapter.onebot.event.NoticeEvent

频道新建事件

  • Attributes

    • detail_type (Literal['channel_create'])

    • guild_id (str)

    • channel_id (str)

    • operator_id (str)

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

class ChannelDeleteEvent

Bases: alicebot.adapter.onebot.event.NoticeEvent

频道删除事件

  • Attributes

    • detail_type (Literal['channel_delete'])

    • guild_id (str)

    • channel_id (str)

    • operator_id (str)

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

class RequestEvent

Bases: alicebot.adapter.onebot.event.BotEvent

请求事件

  • Attributes

    • type (Literal['request'])

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

Released under the MIT License.