Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

请问如何监听加入新群的事件 #201

Closed
Arondight opened this issue Aug 15, 2021 · 4 comments
Closed

请问如何监听加入新群的事件 #201

Arondight opened this issue Aug 15, 2021 · 4 comments
Labels
protocol Something about oicq protocol

Comments

@Arondight
Copy link

例如 bot 正在运行中,我用 qq 客户端手动加入了一个群,bot 如何判断有群列表新增了一个群?我找了找没有找到相关的事件。

oicq/index.d.ts

Lines 970 to 998 in 0961154

on(event: "request.friend" | "request.friend.add" | "request.friend.single", listener: (this: Client, data: FriendAddEventData) => void): this; //收到好友申请事件
on(event: "request.group.add", listener: (this: Client, data: GroupAddEventData) => void): this; //收到加群申请事件
on(event: "request.group.invite", listener: (this: Client, data: GroupInviteEventData) => void): this; //收到群邀请事件
on(event: "request.group", listener: (this: Client, data: GroupAddEventData | GroupInviteEventData) => void): this;
on(event: "request", listener: (this: Client, data: RequestEventData) => void): this; //监听以上所有request事件
on(event: "message.private" | "message.private.friend" | "message.private.group" |
"message.private.single" | "message.private.other" | "message.private.self", listener: (this: Client, data: PrivateMessageEventData) => void): this; //私聊消息事件
on(event: "message.group" | "message.group.normal" | "message.group.anonymous", listener: (this: Client, data: GroupMessageEventData) => void): this; //群消息事件
on(event: "message.discuss", listener: (this: Client, data: DiscussMessageEventData) => void): this; //讨论组消息事件
on(event: "message", listener: (this: Client, data: MessageEventData) => void): this; //监听以上所有message事件
on(event: "notice.friend.increase", listener: (this: Client, data: FriendIncreaseEventData) => void): this; //新增好友事件
on(event: "notice.friend.decrease", listener: (this: Client, data: FriendDecreaseEventData) => void): this; //好友(被)删除事件
on(event: "notice.friend.recall", listener: (this: Client, data: FriendRecallEventData) => void): this; //好友消息撤回事件
on(event: "notice.friend.profile", listener: (this: Client, data: FriendProfileEventData) => void): this; //好友资料变更事件
on(event: "notice.friend.poke", listener: (this: Client, data: FriendPokeEventData) => void): this; //好友戳一戳事件
on(event: "notice.group.increase", listener: (this: Client, data: MemberIncreaseEventData) => void): this; //入群・群员增加事件
on(event: "notice.group.decrease", listener: (this: Client, data: MemberDecreaseEventData) => void): this; //踢群・退群事件
on(event: "notice.group.recall", listener: (this: Client, data: GroupRecallEventData) => void): this; //群消息撤回事件
on(event: "notice.group.admin", listener: (this: Client, data: GroupAdminEventData) => void): this; //管理员变更事件
on(event: "notice.group.ban", listener: (this: Client, data: GroupMuteEventData) => void): this; //群禁言事件
on(event: "notice.group.transfer", listener: (this: Client, data: GroupTransferEventData) => void): this; //群转让事件
on(event: "notice.group.title", listener: (this: Client, data: GroupTitleEventData) => void): this; //群头衔变更事件
on(event: "notice.group.poke", listener: (this: Client, data: GroupPokeEventData) => void): this; //群戳一戳事件
on(event: "notice.group.setting", listener: (this: Client, data: GroupSettingEventData) => void): this; //群设置变更事件
on(event: "notice.friend", listener: (this: Client, data: FriendNoticeEventData) => void): this; //监听以上所有好友notice事件
on(event: "notice.group", listener: (this: Client, data: GroupNoticeEventData) => void): this; //监听以上所有群notice事件
on(event: "notice", listener: (this: Client, data: NoticeEventData) => void): this; //监听以上所有notice事件

@takayama-lily takayama-lily added the protocol Something about oicq protocol label Aug 15, 2021
@takayama-lily
Copy link
Owner

目前这种情况好像没有事件上报,只有被管理员邀请入群才有事件。
以前酷Q时代好像也有这个问题,一直没有对应。

@Arondight
Copy link
Author

我看代码已经更新了,事件85也被对应到了group.increase,但是从最终用户的视角上看,似乎和以前并无区别,因为还是分不清这个事件究竟是群员增加了,还是机器人被拉入群了。

@takayama-lily
Copy link
Owner

我看代码已经更新了,事件85也被对应到了group.increase,但是从最终用户的视角上看,似乎和以前并无区别,因为还是分不清这个事件究竟是群员增加了,还是机器人被拉入群了。

机灵一点,判断user_id是不是你自己

@Arondight
Copy link
Author

有道理

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
protocol Something about oicq protocol
Projects
None yet
Development

No branches or pull requests

2 participants