Skip to content

事件列表

Waylay 通过 WebSocket 主动推送事件到 Bot 框架。

消息事件

群消息 message.group

json
{
  "time": 1712640000,
  "self_id": 123456789,
  "post_type": "message",
  "message_type": "group",
  "sub_type": "normal",
  "message_id": 12345,
  "group_id": 987654321,
  "user_id": 111222333,
  "anonymous": null,
  "message": [
    { "type": "text", "data": { "text": "hello" } }
  ],
  "raw_message": "hello",
  "font": 0,
  "sender": {
    "user_id": 111222333,
    "nickname": "张三",
    "card": "群名片",
    "sex": "unknown",
    "age": 0,
    "area": "",
    "level": "0",
    "role": "member",
    "title": ""
  }
}

sender.role 取值:owneradminmember

私聊消息 message.private

json
{
  "time": 1712640000,
  "self_id": 123456789,
  "post_type": "message",
  "message_type": "private",
  "sub_type": "friend",
  "message_id": 12346,
  "user_id": 111222333,
  "message": [ ... ],
  "raw_message": "hello",
  "font": 0,
  "sender": {
    "user_id": 111222333,
    "nickname": "张三",
    "sex": "unknown",
    "age": 0
  }
}

sub_typefriend(好友)或 group(临时会话)

通知事件

群消息撤回 notice.group_recall

json
{
  "post_type": "notice",
  "notice_type": "group_recall",
  "group_id": 987654321,
  "user_id": 111222333,
  "operator_id": 111222333,
  "message_id": 12345
}

好友消息撤回 notice.friend_recall

json
{
  "post_type": "notice",
  "notice_type": "friend_recall",
  "user_id": 111222333,
  "message_id": 12345
}

群成员增加 notice.group_increase

json
{
  "post_type": "notice",
  "notice_type": "group_increase",
  "sub_type": "approve",
  "group_id": 987654321,
  "operator_id": 444555666,
  "user_id": 111222333
}

群成员减少 notice.group_decrease

sub_typekick(被踢)

群禁言 notice.group_ban

json
{
  "post_type": "notice",
  "notice_type": "group_ban",
  "sub_type": "ban",
  "group_id": 987654321,
  "operator_id": 444555666,
  "user_id": 111222333,
  "duration": 600
}

sub_typeban(禁言)或 lift_ban(解禁)

管理员变动 notice.group_admin

sub_typeset(设置)或 unset(取消)

群文件上传 notice.group_upload

json
{
  "post_type": "notice",
  "notice_type": "group_upload",
  "group_id": 987654321,
  "user_id": 111222333,
  "file": {
    "id": "file_uuid",
    "name": "document.pdf",
    "size": 102400,
    "busid": 0
  }
}

好友添加 notice.friend_add

json
{
  "post_type": "notice",
  "notice_type": "friend_add",
  "user_id": 111222333
}

戳一戳 notice.notify.poke

json
{
  "post_type": "notice",
  "notice_type": "notify",
  "sub_type": "poke",
  "group_id": 987654321,
  "user_id": 111222333,
  "target_id": 123456789
}

运气王 notice.notify.lucky_king

群荣誉变更 notice.notify.honor

请求事件

好友请求 request.friend

json
{
  "post_type": "request",
  "request_type": "friend",
  "user_id": 111222333,
  "comment": "验证消息",
  "flag": "friend_uin"
}

加群请求 request.group

json
{
  "post_type": "request",
  "request_type": "group",
  "sub_type": "add",
  "group_id": 987654321,
  "user_id": 111222333,
  "comment": "验证消息",
  "flag": "seq|groupCode|type"
}

sub_typeadd(主动加群)或 invite(被邀请)

元事件

生命周期 meta_event.lifecycle

连接建立时发送。见 连接方式

心跳 meta_event.heartbeat

每 30 秒发送。见 连接方式

Released under the Apache 2.0 License.