Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onlineAnnouncement.members只能获取50个人 #2531

Closed
yujumpjump opened this issue Feb 24, 2023 · 5 comments · Fixed by #2530
Closed

onlineAnnouncement.members只能获取50个人 #2531

yujumpjump opened this issue Feb 24, 2023 · 5 comments · Fixed by #2530
Labels
M 优先级: 主要 s:core 子系统: mirai-core t:bug 类型: bug x:protocol 属性: 协议相关
Milestone

Comments

@yujumpjump
Copy link

问题描述

通过mirai框架的onlineAnnouncement.members()方法 只能获取50个人 不能获取全部看过公告的人 而且返回的list集合长度只有50

复现

/---------------------检查看过公告成员----------------------/
while (LOOKMAP.size() >0) {
Thread.sleep(5000);
MiraiGroup group = event.getGroup();
MiraiAnnouncements announcements = group.getAnnouncements();
Announcements originalAnnouncements = announcements.getOriginalAnnouncements();
List onlineAnnouncements = originalAnnouncements.toList();
// 获取群里面的第一个公告
OnlineAnnouncement onlineAnnouncement = onlineAnnouncements.get(0);
// 获取群里面都有谁看了公告
List members = onlineAnnouncement.members(false);
for (int i = 0; i < members.size(); i++) {
// 获取到刚才进群的成员
String key = members.get(i).toString().substring(13, members.get(i).toString().length() - 1);
if (LOOKMAP.get(key)==null) {
continue;
}
// 获取这个新成员进行解除禁言
MiraiMember member1 = group.getMember(LOOKMAP.get(key));
member1.unmuteBlocking();
At at1 = new At(LOOKMAP.get(key));
Messages elements1 = Messages.toMessages(at1, Text.of("\n检测到你已经阅读新人群公告自动解除禁言"));
event.getGroup().sendBlocking(elements1);
LOOKMAP.remove(key);
}
}

}

mirai-core 版本

2.14.0

bot-protocol

ANDROID_WATCH

其他组件版本

No response

系统日志

No response

网络日志

No response

补充信息

No response

@cssxsh
Copy link
Contributor

cssxsh commented Feb 24, 2023

#2530

@yujumpjump
Copy link
Author

你好 我看到不是特别懂 我想问一下 这个如果是bug什么时候可以修复呀

@cssxsh
Copy link
Contributor

cssxsh commented Feb 24, 2023

这是设计失误,因为当时没有测试大群的情况,没发现他最多返回 50 条记录,需要分段获取

@yujumpjump
Copy link
Author

分段获得 怎么获取呀 大佬 可以举个例子嘛

@zhaodice
Copy link
Contributor

你等更新就行了

@Him188 Him188 added t:bug 类型: bug x:protocol 属性: 协议相关 M 优先级: 主要 s:core 子系统: mirai-core labels Feb 28, 2023
@Him188 Him188 added this to the 2.15.0-RC milestone Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M 优先级: 主要 s:core 子系统: mirai-core t:bug 类型: bug x:protocol 属性: 协议相关
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants