Skip to content

Commit

Permalink
New Update
Browse files Browse the repository at this point in the history
1. Fix
  • Loading branch information
megoRU committed Jan 18, 2024
1 parent 124f4a2 commit 46d267d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
4 changes: 0 additions & 4 deletions src/main/java/main/config/BotStart.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,11 @@ private void startBot() {

List<CacheFlag> cacheFlags = new ArrayList<>(
Arrays.asList(
CacheFlag.ONLINE_STATUS,
CacheFlag.VOICE_STATE,
CacheFlag.ROLE_TAGS,
CacheFlag.ACTIVITY,
CacheFlag.MEMBER_OVERRIDES));

jdaBuilder.disableCache(cacheFlags);
jdaBuilder.setMemberCachePolicy(MemberCachePolicy.ALL);
jdaBuilder.setChunkingFilter(ChunkingFilter.ALL);
jdaBuilder.enableIntents(intents);
jdaBuilder.setAutoReconnect(true);
jdaBuilder.setStatus(OnlineStatus.ONLINE);
Expand Down
21 changes: 17 additions & 4 deletions src/main/java/main/service/ParticipantsUpdaterService.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,15 @@ public void update(JDA jda) {

if (isForSpecificRole) {
Role roleGiveaway = jda.getRoleById(giveaway.getRoleId());
List<Member> membersWithRoles = guild.getMembersWithRoles(roleGiveaway);
for (Member member : membersWithRoles) {
long startTime = System.currentTimeMillis();
List<Member> members = guild.loadMembers().get();
long endTime = System.currentTimeMillis();
long timeElapsed = endTime - startTime;
System.out.printf("\nЗамер выполнение метода: Guild_ID: %s, Size: %s, Время: %s ms",
guildIdLong,
members.size(),
timeElapsed);
for (Member member : members) {
boolean contains = member.getRoles().contains(roleGiveaway);
if (!contains) {
userList.remove(member.getId());
Expand All @@ -83,8 +90,14 @@ public void update(JDA jda) {

if (forbiddenRole != null) {
Role roleGiveaway = jda.getRoleById(giveaway.getForbiddenRole());
List<Member> membersWithRoles = guild.getMembersWithRoles(roleGiveaway);
for (Member member : membersWithRoles) {
long startTime = System.currentTimeMillis();
List<Member> members = guild.loadMembers().get();
long endTime = System.currentTimeMillis();
long timeElapsed = endTime - startTime;
System.out.printf("\nЗамер выполнение метода: Guild_ID: %s, Size: %s, Время: %s ms",
guildIdLong,
members.size(),
timeElapsed); for (Member member : members) {
boolean contains = member.getRoles().contains(roleGiveaway);
if (contains) {
userList.remove(member.getId());
Expand Down

0 comments on commit 46d267d

Please sign in to comment.