-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Members count display #1032
Members count display #1032
Conversation
application/src/main/java/org/togetherjava/tjbot/features/basic/MemberCounter.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/features/basic/MemberCounter.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/features/basic/MemberCounter.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did Changes mentioned by reviewers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome to the project and thank you very much for this PR. I got a few smaller things to tackle for you, shouldn't be that big of a deal. Feel free to ask👍
application/config.json.template
Outdated
@@ -110,5 +110,7 @@ | |||
"special": [ | |||
] | |||
}, | |||
"memberCountCategoryName": "Info", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be a pattern not just a string, change suffix to Pattern and code to use a Pattern.compile(...) and then pattern.matches(...) similiar to other entries in our config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not done
* Gets the categories by this name to showcase the total member count of the server. | ||
* | ||
* @return the categories name types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i find this javadoc confusing wording-wise.
instead:
Gets the pattern matching the category that is used to display the total member count.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the return
part still has confusing naming. perhaps the pattern matching the category
application/src/main/java/org/togetherjava/tjbot/features/Features.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/features/basic/MemberCounter.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/features/basic/MemberCounter.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/features/basic/MemberCounter.java
Outdated
Show resolved
Hide resolved
|
||
@Override | ||
public Schedule createSchedule() { | ||
return new Schedule(ScheduleMode.FIXED_RATE, 0, parseInt(updateMemberCountEveryHour), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just hardcore the number here and get rid of the var and config. u can go for one day
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
application/src/main/java/org/togetherjava/tjbot/features/basic/MemberCounter.java
Outdated
Show resolved
Hide resolved
Review Needed |
Could you please not resolve conversations urself? Just keep them open for the reviewer to check and resolve, thanks 👍 |
ea60d95
to
72f8b89
Compare
Hello yes sorry for that actually had some buggy commits |
My fault on that |
application/src/main/java/org/togetherjava/tjbot/features/basic/MemberCountDisplayRoutine.java
Outdated
Show resolved
Hide resolved
if (baseName.contains(" Members")) { | ||
baseName = Pattern.compile("(.+) - \\d+ Members").toString(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats not really how the pattern thing works. ur supposed to compile that pattern beforehand, for example as private static final
and then use it to match
the given string, which returns a Matcher
and that one has group(1)
to extract the capturing-group (.+)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please test ur code. i would be surprised if this one works at all
import java.util.function.Predicate; | ||
import java.util.regex.Pattern; | ||
|
||
public class MemberCountDisplayRoutine implements Routine { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing javadoc.
jda.getGuilds().forEach(guild -> { | ||
guild.getCategories() | ||
.stream() | ||
.filter(cat -> wordsInCategory.test(cat.getName())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write out cat to avoid confusion -> category
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
guild.getCategories() | ||
.stream() | ||
.filter(cat -> wordsInCategory.test(cat.getName())) | ||
.forEach(this::updateCategoryName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont execute it forEach
but only on the first/any occurence. use findAny()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Been busy this week will work on the changes as i get time |
All good, take your time, it is low priority anyways. |
Closed PR as it was superseded by #1038! |
issue #1028