-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[FEATURE] Interpolate message sending #40
Comments
|
Ah, alright, guess I'll have to stick with the default help for now then |
I have two possible solutions up in mind:
@Component
public class HelpEventListener implements EventListener {
@Override
public void onGenericHelp(GenericHelpEvent event, Message message) {
// Acknowledge the event, tells jda-commands that this listener will handle the event and the default listener shouldn't be called
event.consume();
// manipulate the message to meet your desires
message.doWhateverYouWant();
// send message
event.getChannel().sendMessage(message).queue();
}
} The second solution brings in more modularity and options. which may be useful especially with regards to slash commands coming. However it's more complicated and the |
Hmm alright, so if I understand that second one right, we would implement the "onGenericHelp" method which we could customize however we want. I see how it could be confusing, wouldn't worry too much about it though, as most people who want to change the sending behavior probably also know how JDA Listeners work |
The question is whether we have a real gain from the 2. solution. The first and old solution works fine and is easier to implement, so I think I will just go with the first one |
This has been implemented as following and will become available with the next update. public interface MessageSender {
/**
* Called when a generic help message should be sent.
*
* @param context the corresponding {@link CommandContext}
* @param message the help message to send
*/
void sendGenericHelpMessage(@NotNull CommandContext context, @NotNull Message message);
/**
* Called when a specific help message should be sent.
*
* @param context the corresponding {@link CommandContext}
* @param message the help message to send
*/
void sendSpecificHelpMessage(@NotNull CommandContext context, @NotNull Message message);
/**
* Called when an error message should be sent.
*
* @param context the corresponding {@link CommandContext}
* @param message the error message to send
*/
void sendErrorMessage(@NotNull CommandContext context, @NotNull Message message);
} |
So, I have two quick questions about the new version of jda-commands, as I'm currently in the process of migrating my Bots structure to Version 2.0.0
I can't figure out how to give it the packages where my commands reside in. In the example you do it like this:


but the only methods I can find in the library have Strings there.
What pattern would I have to use for example to find all Commands in say example.commands?
Is there no way anymore to customize how the help Command gets sent? Because I until now have written my own custom help sending mechanism:

This was easy in the prior versions, but I can't seem to find a way to do it in Version 2.0.0 (I could very well have overseen something, but as of right now I can't find anything)
The text was updated successfully, but these errors were encountered: