-
-
Notifications
You must be signed in to change notification settings - Fork 92
Fixed command system issues #119
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
Conversation
application/src/main/java/org/togetherjava/tjbot/commands/AbstractCommand.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/AbstractCommand.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/Command.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/Command.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/Command.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/CommandHandler.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/example/CommandExample.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/example/SubCommandExample.java
Outdated
Show resolved
Hide resolved
Made a few mistakes causing the merge commit, I'll squash |
application/src/main/java/org/togetherjava/tjbot/db/package-info.java
Outdated
Show resolved
Hide resolved
857ab95
to
7382386
Compare
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'd prefer qualifying the javadoc link and not the code itself.
application/src/main/java/org/togetherjava/tjbot/commands/example/CommandExample.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/example/CommandExample.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/example/CommandExample.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/example/CommandExample.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/example/CommandExample.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/example/CommandExample.java
Outdated
Show resolved
Hide resolved
Just a suggestion, but maybe you should learn Java @Tais993 |
application/src/main/java/org/togetherjava/tjbot/commands/CommandHandler.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/CommandHandler.java
Outdated
Show resolved
Hide resolved
28515f8
new ErrorHandler().handle(ErrorResponse.MISSING_ACCESS, errorResponseException -> { | ||
// * Hard to read, there's no other accurate way to get a channel you've the write | ||
// * permission in. | ||
guild.getTextChannelCache().stream().filter(textChannel -> { |
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.
This can be a utility method Optional<TextChannel> getTextChannelWithWritePermissions(Guild)
to aid readability
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.
Creating something like
ChannelUtil#getChannelsWithPermissions(Guild, Permissions) seems fair
But this should be done within another PR
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.
Ok. I have already created one JDAUtils. I will move it in my PR instead.
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.
Don't remember JDAUtils having anything relating, and JDAUtils is extremely outdated
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 something I have written and will pull out your piece.
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.
Ah, thought you were talking about JDA utlities
}).findFirst().ifPresent(textChannel -> { | ||
textChannel | ||
.sendMessage("This bot needs the commands scope, please invite it correctly!\n" | ||
+ "You can join https://discord.gg/UJBwS2Hvcx for more info, I'll leave now.") |
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.
What is this url? May be a constant
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.
Together Java Discord, should be a constant in the main/application/whatever the main is called in that case imo
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 also be moved out into the "config system" #100
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.
See PR #142 which will add a discordGuildInvite
property for this.
@@ -47,17 +49,20 @@ public CommandExample() { | |||
// * adds the second option | |||
new OptionData(OptionType.STRING, "times-to-ping", | |||
"Amount of times the user will be pinged, default 1") | |||
.addChoices(new Command.Choice("Once", "1"), | |||
new Command.Choice("Twice", "2")) | |||
.addChoices( |
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 sure if this is formatter related but the deleted lines look more readable to me.
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'd assume formatter since I don't remember it myself
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.
spotlessApply
^^
Since requested, requires some time to develop a proper permission system. |
This branch contains quite some useful improvements to the command system. If the permission thing needs more time, why not split this into two PRs and get this finally merged? |
Sure, will look at this later today. |
0424e3f
to
4e2b591
Compare
Sorry, I messed up the rebase. Ill rescue it, gimme a minute |
Moved AbstractCommand to the Commands package instead of the example package, this was an accident.
Improved docs:
And optimized imports