QQ号循环群,私信指定成员发送消息,前3个成功了,后边发消息虽然日志显示成功了,但QQ上实际没有发出来
QQ号说明:
机器人一共加了两个群 有两个人同时加入了两个群 有另外两个人只加入了A群 还有另外两个人只加入了B群 A群 B群 是否添加了机器人好友 私信是否发送成功 机器人 √ √ - - QQ号1 √ √ 是 是 QQ号2 √ √ 否 是 QQ号3 √ 是 是 QQ号4 √ 否 否 QQ号5 √ 否 否 QQ号6 √ 否 否代码如下:
// 需要私信的QQ列表 Set<Long> toRemind = new HashSet<>(qqList); Bot bot = botUtil.getBot(); // 循环群 for (Group group : bot.getGroups()) { ContactList<NormalMember> members = group.getMembers(); // 循环群内成员 for (NormalMember member : members) { if (toRemind.contains(member.getId())) { try { // 发送消息 member.sendMessage(data.hint_msg); toRemind.remove(member.getId()); } catch (Exception e) { log.error(e.getClass().getName(), e); } } } }日志如下
2022-11-08 21:39:03 I/Bot 2190915232: Bot login successful. 2022-11-08 21:39:03 V/Net 2190915232: Send: MessageSvc.PbSendMsg(MessageSvc.PbSendMsg) 2022-11-08 21:39:03 V/Bot 2190915232: Friend(**A群的QQ号1**) <- 请大家抓紧时间做核酸啦 2022-11-08 21:39:03 V/Net 2190915232: Recv: MessageSvc.PbSendMsg 2022-11-08 21:39:03 V/Net 2190915232: Send: MessageSvc.PbSendMsg(MessageSvc.PbSendMsg) 2022-11-08 21:39:04 V/Bot 2190915232: NormalMember(**A群的QQ号2**) <- 请大家抓紧时间做核酸啦 2022-11-08 21:39:04 V/Net 2190915232: Recv: MessageSvc.PbSendMsg 2022-11-08 21:39:04 V/Net 2190915232: Send: MessageSvc.PbSendMsg(MessageSvc.PbSendMsg) 2022-11-08 21:39:04 V/Bot 2190915232: Friend(**A群的QQ号3**) <- 请大家抓紧时间做核酸啦 2022-11-08 21:39:04 V/Net 2190915232: Recv: MessageSvc.PbSendMsg 2022-11-08 21:39:04 V/Net 2190915232: Send: MessageSvc.PbSendMsg(MessageSvc.PbSendMsg) 2022-11-08 21:39:04 V/Bot 2190915232: NormalMember(**A群的QQ号4**) <- 请大家抓紧时间做核酸啦 2022-11-08 21:39:04 V/Net 2190915232: Recv: MessageSvc.PbSendMsg 2022-11-08 21:39:04 V/Net 2190915232: Send: MessageSvc.PbSendMsg(MessageSvc.PbSendMsg) 2022-11-08 21:39:05 V/Bot 2190915232: NormalMember(**B群的QQ号5**) <- 请大家抓紧时间做核酸啦 2022-11-08 21:39:05 V/Net 2190915232: Recv: MessageSvc.PbSendMsg 2022-11-08 21:39:05 V/Net 2190915232: Send: MessageSvc.PbSendMsg(MessageSvc.PbSendMsg) 2022-11-08 21:39:05 V/Bot 2190915232: NormalMember(**B群的QQ号6**) <- 请大家抓紧时间做核酸啦 2022-11-08 21:39:05 V/Net 2190915232: Recv: MessageSvc.PbSendMsg 2022-11-08 21:39:05 V/Net 2190915232: Saving bdh session to cache 2022-11-08 21:39:05 V/Net 2190915232: Send: ConfigPushSvc.PushResp(ConfigPushSvc.PushResp) 2022-11-08 21:39:05 V/Net 2190915232: Recv: ConfigPushSvc.PushReq