Skip to content

通知事件

post_type: "notice"——群或好友状态发生了变化。


消息撤回

群消息撤回

notice_type: "group_recall"

字段类型说明
group_idnumber群号
user_idnumber消息发送者
operator_idnumber操作者(谁撤回的,自己撤回则等于 user_id)
message_idstring被撤回的消息 ID
json
{
  "post_type": "notice",
  "notice_type": "group_recall",
  "self_id": "<your-uin>",
  "time": 1700000000,
  "group_id": "<group_id>",
  "user_id": "<friend_id>",
  "operator_id": "<friend_id>",
  "message_id": "<message_id>"
}

好友消息撤回

notice_type: "friend_recall"

字段类型说明
user_idnumber好友 QQ 号
message_idstring被撤回的消息 ID

群成员变动

群成员增加

notice_type: "group_increase"

字段类型说明
sub_typestring"approve"(管理员同意)/ "invite"(被邀请)
group_idnumber群号
operator_idnumber操作者(审批人或邀请人)
user_idnumber新成员
json
{
  "post_type": "notice",
  "notice_type": "group_increase",
  "sub_type": "approve",
  "self_id": "<your-uin>",
  "time": 1700000000,
  "group_id": "<group_id>",
  "operator_id": "<friend_id>",
  "user_id": "<friend_id>"
}

群成员减少

notice_type: "group_decrease"

字段类型说明
sub_typestring"leave"(主动退群)/ "kick"(被踢)/ "kick_me"(Bot 被踢)
group_idnumber群号
operator_idnumber操作者(踢人者,主动退群时等于 user_id)
user_idnumber离开的成员

好友添加

notice_type: "friend_add"

有新好友添加成功时触发。

字段类型说明
user_idnumber新好友 QQ 号

群管理员变动

notice_type: "group_admin"

字段类型说明
sub_typestring"set"(设置管理员)/ "unset"(取消管理员)
group_idnumber群号
user_idnumber被操作的成员
json
{
  "post_type": "notice",
  "notice_type": "group_admin",
  "sub_type": "set",
  "self_id": "<your-uin>",
  "time": 1700000000,
  "group_id": "<group_id>",
  "user_id": "<friend_id>"
}

群禁言

notice_type: "group_ban"

字段类型说明
sub_typestring"ban"(禁言)/ "lift_ban"(解除禁言)
group_idnumber群号
operator_idnumber操作者(管理员)
user_idnumber被禁言的成员
durationnumber禁言时长(秒),解除时为 0
json
{
  "post_type": "notice",
  "notice_type": "group_ban",
  "sub_type": "ban",
  "self_id": "<your-uin>",
  "time": 1700000000,
  "group_id": "<group_id>",
  "operator_id": "<friend_id>",
  "user_id": "<friend_id>",
  "duration": 600
}

群文件上传

notice_type: "group_upload"

同时会收到一条群消息

群文件上传由「含文件的群消息」派生(对齐 NapCat):你会先收到一条 message(含文件段)再收到这条 group_upload 通知。若你既处理群消息又处理本通知,注意去重,避免重复落库。

字段类型说明
group_idnumber群号
user_idnumber上传者
fileobject文件信息(id / name / size / busid)。id 即文件 fid,可直接传给 get_group_file_url / delete_group_file

戳一戳

notice_type: "notify", sub_type: "poke"

字段类型说明
group_idnumber群号(群内戳一戳时存在)
user_idnumber戳人的人
target_idnumber被戳的人
json
{
  "post_type": "notice",
  "notice_type": "notify",
  "sub_type": "poke",
  "self_id": "<your-uin>",
  "time": 1700000000,
  "group_id": "<group_id>",
  "user_id": "<friend_id>",
  "target_id": "<your-uin>"
}

运气王

notice_type: "notify", sub_type: "lucky_king"

红包运气王产生时触发。

字段类型说明
group_idnumber群号
user_idnumber发红包的人
target_idnumber运气王

群荣誉变更

notice_type: "notify", sub_type: "honor"

字段类型说明
group_idnumber群号
user_idnumber获得荣誉的成员
honor_typestring荣誉类型

群打卡

notice_type: "notify", sub_type: "group_sign"

NapCat 扩展

此事件为 NapCat 扩展,非 OneBot 11 标准。

字段类型说明
group_idnumber群号
user_idnumber打卡的成员
nickstring昵称
sign_textstring打卡文本

群名片变更

notice_type: "group_card"

字段类型说明
group_idnumber群号
user_idnumber被修改的成员
card_newstring新群名片
card_oldstring旧群名片

群转让

notice_type: "group_transfer"

NapCat 扩展

此事件为 NapCat 扩展,非 OneBot 11 标准。

字段类型说明
group_idnumber群号
operator_idnumber旧群主
user_idnumber新群主

表情回应

notice_type: "group_msg_emoji_like"

NapCat 扩展

此事件为 NapCat 扩展,非 OneBot 11 标准。

字段类型说明
sub_typestring"add" / "remove"
group_idnumber群号
user_idnumber操作者
message_idstring被回应的消息
likesarray表情列表 [{ emoji_id, count }]
json
{
  "post_type": "notice",
  "notice_type": "group_msg_emoji_like",
  "sub_type": "add",
  "self_id": "<your-uin>",
  "time": 1700000000,
  "group_id": "<group_id>",
  "user_id": "<friend_id>",
  "message_id": "<message_id>",
  "likes": [
    { "emoji_id": "128077", "count": 1 }
  ]
}

机器人掉线 (bot_offline)

notice_type: "bot_offline"

NapCat 扩展

此事件为 NapCat 扩展(BotOfflineEvent),非 OneBot 11 标准。

机器人被服务器踢下线(账号在别处登录、KickNT / 强制下线)时触发。这类掉线不会自动重登,因此除了标准的 meta_event 生命周期 disable(见元事件)外,额外推送此通知,方便仅监听 notice 的客户端感知掉线。

掉线后 get_statusonline 字段会变为 false

字段类型说明
user_idnumber机器人自身 QQ 号(同 self_id
tagstring掉线原因标签,目前为 "kickoff"
messagestring人类可读的掉线原因(服务器返回的踢下线文本)
json
{
  "post_type": "notice",
  "notice_type": "bot_offline",
  "self_id": "<your-uin>",
  "time": 1700000000,
  "user_id": "<your-uin>",
  "tag": "kickoff",
  "message": "[xxx]您的账号在其他设备登录"
}

频道消息撤回

notice_type: "guild_channel_recall"

WARNING

频道事件的所有 ID 字段均为字符串

字段类型说明
guild_idstring频道 ID
channel_idstring子频道 ID
user_idstring消息发送者
operator_idstring操作者
message_idstring被撤回的消息 ID

对方正在输入

notice_type: "notify", sub_type: "input_status"

扩展事件

对齐 NapCat input_status,非 OneBot 11 标准。仅私聊。event_type / status_text 由本桥根据协议给出的「开始/结束」二态合成, NapCat 透传的 NTQQ 原始值,仅供参考。

好友开始(或结束)在私聊里输入时触发。

字段类型说明
user_idnumber正在输入的好友 QQ 号
group_idnumber恒为 0(私聊场景)
event_typenumber1 = 正在输入,0 = 结束输入
status_textstring状态文案(如「对方正在输入...」)
json
{
  "post_type": "notice",
  "notice_type": "notify",
  "sub_type": "input_status",
  "self_id": "<your-uin>",
  "time": 1700000000,
  "user_id": "<friend_id>",
  "group_id": 0,
  "event_type": 1,
  "status_text": "对方正在输入..."
}

已读回执

好友/群成员读到你发的消息时触发。OneBot 11 无对应事件,为本桥扩展。

私聊已读

notice_type: "friend_read"

字段类型说明
user_idnumber已读对方的 QQ 号
timenumber已读时间(时间戳,秒)

群已读

notice_type: "group_read"

字段类型说明
group_idnumber群号
seqnumber已读到的消息序号
json
{
  "post_type": "notice",
  "notice_type": "friend_read",
  "self_id": "<your-uin>",
  "time": 1700000000,
  "user_id": "<friend_id>"
}

好友被删除

notice_type: "friend_decrease"

扩展事件

对齐 icqq notice.friend.decrease,非 OneBot 11 标准。

机器人被某人删除好友(或对方解除好友关系)时触发。

字段类型说明
user_idnumber删除你的(前)好友 QQ 号
json
{
  "post_type": "notice",
  "notice_type": "friend_decrease",
  "self_id": "<your-uin>",
  "time": 1700000000,
  "user_id": "<friend_id>"
}